Merge branch 'r/paopao-ce-plus' into r/paopao-ce-xtra

r/paopao-ce-xtra
Michael Li 2 years ago
commit 7a067b2bfd
No known key found for this signature in database

@ -21,15 +21,6 @@ All notable changes to paopao-ce are documented in this file.
CREATE TABLE p_following (ID BIGSERIAL PRIMARY KEY,user_id BIGINT NOT NULL,follow_id BIGINT NOT NULL,is_del SMALLINT NOT NULL DEFAULT 0,created_on BIGINT NOT NULL DEFAULT 0,modified_on BIGINT NOT NULL DEFAULT 0,deleted_on BIGINT NOT NULL DEFAULT 0);
CREATE INDEX idx_following_user_follow ON p_following USING btree (user_id,follow_id);
```
custom set config.yaml in `Features` section add `Followship` to enable Followship feature:
```yaml
...
# add Followship to enable this feature
Features:
Default: ["Meili", "LoggerMeili", "Base", "Sqlite3", "BigCacheIndex", "MinIO", "Followship"]
Base: ["Redis", "PhoneBind"]
...
```
### Changed
- change man content width to 600px and optimize tweet/comment/replay text length. [#333](https://github.com/rocboss/paopao-ce/pull/333)
@ -41,6 +32,8 @@ All notable changes to paopao-ce are documented in this file.
make build TAGS='slim embed'
```
- frontend: optimize user profile page route path to domain/#/u/?s=username. [&c857142](https://github.com/rocboss/paopao-ce/commit/c857142565f0c28294344c7abc5c2df4e363b04c
- change the `Friendship` feature and `Followship` feature as builtin feature. [#362](https://github.com/rocboss/paopao-ce/pull/362)
- deprecated/remove `Lightship` feature. [#362](https://github.com/rocboss/paopao-ce/pull/362)
## 0.3.1
### Fixed

@ -18,7 +18,7 @@ RELEASE_DARWIN_AMD64 = $(RELEASE_ROOT)/darwin-amd64/$(PROJECT)
RELEASE_DARWIN_ARM64 = $(RELEASE_ROOT)/darwin-arm64/$(PROJECT)
RELEASE_WINDOWS_AMD64 = $(RELEASE_ROOT)/windows-amd64/$(PROJECT)
BUILD_VERSION := $(shell git describe --tags --always | cut -f1 -f2 -d "-")
BUILD_VERSION := $(shell git describe --tags --always | cut -f 1 -f 2 -d "-")
BUILD_DATE := $(shell date +'%Y-%m-%d %H:%M:%S')
SHA_SHORT := $(shell git rev-parse --short HEAD)

@ -373,9 +373,9 @@ release/paopao-ce --no-default-features --features sqlite3,localoss,loggerfile,r
|`LoggerFile` | 日志 | 稳定 | 使用文件写日志 |
|`LoggerZinc` | 日志 | 稳定(推荐) | 使用[Zinc](https://github.com/zinclabs/zinc)写日志 |
|`LoggerMeili` | 日志 | 内测 | 使用[Meilisearch](https://github.com/meilisearch/meilisearch)写日志 |
|[`Friendship`](docs/proposal/002-关于Friendship功能项的设计.md) | 关系模式 | 内 | 弱关系好友模式,类似微信朋友圈 |
|[`Followship`](docs/proposal/003-关于Followship功能项的设计.md) | 关系模式 | WIP | 关注者模式类似Twitter的Follow模式 |
|[`Lightship`](docs/proposal/011-关于Lightship功能项的设计.md) | 关系模式 | 内测(默认) | 开放模式,所有推文都公开可见 |
|[`Friendship`](docs/proposal/22110410-关于Friendship功能项的设计.md) | 关系模式 | 内置 Builtin | 弱关系好友模式,类似微信朋友圈 |
|[`Followship`](docs/proposal/22110409-关于Followship功能项的设计.md) | 关系模式 | 内置 Builtin | 关注者模式类似Twitter的Follow模式 |
|[`Lightship`](docs/proposal/22121409-关于Lightship功能项的设计.md) | 关系模式 | 弃用 Deprecated | 开放模式,所有推文都公开可见 |
|`Alipay` | 支付 | 稳定 | 开启基于[支付宝开放平台](https://open.alipay.com/)的钱包功能 |
|`Sms` | 短信验证 | 稳定 | 开启短信验证码功能,用于手机绑定验证手机是否注册者的;功能如果没有开启,手机绑定时任意短信验证码都可以绑定手机 |
|`Docs:OpenAPI` | 开发文档 | 稳定 | 开启openapi文档功能提供web api文档说明(visit http://127.0.0.1:8008/docs/openapi) |

@ -12,7 +12,7 @@ Server: # 服务设置
ReadTimeout: 60
WriteTimeout: 60
Features:
Default: ["Web", "Frontend:EmbedWeb", "Zinc", "LocalOSS", "MySQL", "BigCacheIndex", "LoggerZinc", "Friendship", "Followship"]
Default: ["Web", "Frontend:EmbedWeb", "Meili", "LocalOSS", "MySQL", "BigCacheIndex", "LoggerFile"]
Develop: ["Base", "MySQL", "BigCacheIndex", "Meili", "Sms", "AliOSS", "LoggerMeili", "OSS:Retention"]
Demo: ["Base", "MySQL", "Option", "Zinc", "Sms", "MinIO", "LoggerZinc", "Migration"]
Slim: ["Base", "Sqlite3", "LocalOSS", "LoggerFile", "OSS:TempDir"]

@ -41,7 +41,7 @@ services:
# - paopao-network
redis:
image: redis/redis-stack:7.0.6-RC8
image: redis/redis-stack:7.2.0-RC3
restart: always
ports:
- 6379:6379
@ -51,33 +51,33 @@ services:
networks:
- paopao-network
zinc:
image: public.ecr.aws/zinclabs/zinc:latest
user: root
restart: always
ports:
- 4080:4080
volumes:
- ./custom/data/zinc/data:/data
environment:
ZINC_FIRST_ADMIN_USER: admin
ZINC_FIRST_ADMIN_PASSWORD: admin
DATA_PATH: /data
networks:
- paopao-network
# meili:
# image: getmeili/meilisearch:v1.2
# zinc:
# image: bitbus/zincsearch:latest
# user: zincsearch
# restart: always
# ports:
# - 7700:7700
# - 4080:4080
# volumes:
# - ./custom/data/meili/data:/meili_data
# - ./custom/data/zinc/data:/data
# environment:
# - MEILI_MASTER_KEY=paopao-meilisearch
# ZINC_FIRST_ADMIN_USER: admin
# ZINC_FIRST_ADMIN_PASSWORD: admin
# DATA_PATH: /data
# networks:
# - paopao-network
meili:
image: getmeili/meilisearch:v1.3
restart: always
ports:
- 7700:7700
volumes:
- ./custom/data/meili/data:/meili_data
environment:
- MEILI_MASTER_KEY=paopao-meilisearch
networks:
- paopao-network
# pyroscope:
# image: pyroscope/pyroscope:latest
# restart: always
@ -107,7 +107,7 @@ services:
depends_on:
- db
- redis
- zinc
- meili
# modify below to reflect your custom configure
volumes:
- ./config.yaml.sample:/app/paopao-ce/config.yaml

@ -1,6 +1,6 @@
| 编号 | 作者 | 发表时间 | 变更时间 | 版本 | 状态 |
| ----- | ----- | ----- | ----- | ----- | ----- |
| 22110409| 北野 | 2022-11-04 | 2023-08-14 | v1.0 | 提议 |
| 22110409| 北野 | 2022-11-04 | 2023-08-16 | v1.0 | 提议 |
### 关于Followship功能项的设计
Followship是实现类似Twitter Timeline模式**关注者模型**的时间线信息流广场推文列表的生成将主要与推文时间、用户的关注者相关。Twitter的推文消息流是非常智能的用户体验也非常好这得益于其背后的智能推荐算法以及完善的关注者模型体系当然还有很多其他机制共同作用下的结果。本提按作为一个总纲为paopao-ce引入类似的机制这将是一个持续完善的缓慢过程一切都是为了用户体验用户就是上帝用户需要什么paopao-ce就努力提供什么
@ -39,21 +39,16 @@
* 参考实现(PR):
[add Followship feature #355](https://github.com/rocboss/paopao-ce/pull/355)
#### 状态:
内置 Builtin
### 疑问
1. Friendship与Followship这两功能项是否可以共存还是互斥呢
理论上这两个功能项是可以共存的如果设置成共存就需要同时提供这两个机制的UI交互同时广场推文列表的生成机制也需要做相应适配可能会比较复杂。前期开发将把这两个功能设置为互斥的即**用户关系模型**只能设置为其中之一,待两个功能项都趋于稳定后,再测试这两个功能项共存后的用户体验,如果效果还不错就引入共存机制。
1. 如何开启这个功能?
在配置文件config.yaml中的`Features`中添加`Followship`功能项开启该功能:
```yaml
...
# features中加上 Followship
Features:
Default: ["Meili", "LoggerMeili", "Base", "Sqlite3", "BigCacheIndex", "MinIO", "Followship"]
Base: ["Redis", "PhoneBind"]
...
```
内置 Builtin
### 更新记录
#### v0.0(2022-11-04) - 北野
@ -64,3 +59,6 @@
#### v1.0(2023-08-14) - 北野
* 添加参考实现;
#### v1.1(2023-08-16) - 北野
* 添加状态信息;

@ -1,6 +1,6 @@
| 编号 | 作者 | 发表时间 | 变更时间 | 版本 | 状态 |
| ----- | ----- | ----- | ----- | ----- | ----- |
| 22110410 | 北野 | 2022-11-04 | 2023-01-04 | v1.0 | 提议 |
| 22110410 | 北野 | 2022-11-04 | 2023-08-16 | v1.1 | 提议 |
### Friendship功能项的设计概要
Friendship功能提供好友间分享推文信息的机制更好的帮助用户建立自己的推文分享小圈子。Friendship本质上想优化的是泡泡广场页面推文列表的生成机制开启功能后推文列表只能获取 `公开/私密/好友` 的推文,每个用户都有属于自己的个性化推文列表。在提供个性化推文列表生成机制的同时,好友体系的建立也顺便帮助用户建立自己的个性化有限范围内的灵魂社交小圈子,只有相互间拥有个性化认同感的用户才能互为好友。
@ -30,6 +30,9 @@ Friendship功能提供好友间分享推文信息的机制更好的帮助用
* 参考实现(PR):
[add support Friendship feature #192](https://github.com/rocboss/paopao-ce/pull/192)
#### 状态:
内置 Builtin
* 预览
| |
@ -46,15 +49,7 @@ Friendship功能提供好友间分享推文信息的机制更好的帮助用
2. 如何形成这种好友体系?
形成好友体系分 **建立、维持、解除** 好友关系。Friendship提供 *建立/解除* 好友关系的机制,泡泡广场的推文列表依据这个好友体系为每个用户生成个性化推文列表。而好友关系的**维持**本质上就是用户推文的持久更新、思想的持续演化使得好友对你一直保持兴趣Friendship也为每一条推文的访问权限进行**标记(私密/好友可见)**,这可以传达这样一种信息: **“时刻让好友知道我非常在乎好友、对好友特殊关照,你看这条推文就是只有我的好友(也就是你)才可以看到,够意思吧”!** 顺便一说,每一条推文的访问权限标记(公开/私密/好友可见)是建立Friendship弱关系体系的隐性催化剂可以加速Friendship的形成。
3. 如何开启这个功能?
在配置文件config.yaml中的`Features`中添加`Friendship`功能项开启该功能:
```yaml
...
# features中加上 Friendship
Features:
Default: ["Meili", "LoggerMeili", "Base", "Sqlite3", "BigCacheIndex", "MinIO", "Friendship"]
Base: ["Redis", "PhoneBind"]
...
```
内置 Builtin
### 更新记录
#### v0.1(2022-11-04) - 北野
@ -65,3 +60,6 @@ Friendship功能提供好友间分享推文信息的机制更好的帮助用
#### v1.0(2023-01-04) - 北野
* 添加参考实现PR信息
#### v1.1(2023-08-16) - 北野
* 添加状态信息;

@ -1,9 +1,9 @@
| 编号 | 作者 | 发表时间 | 变更时间 | 版本 | 状态 |
| ----- | ----- | ----- | ----- | ----- | ----- |
| 22121409 | 北野 | 2022-12-14 | 2022-01-09 | v1.1 | 提议 |
| 22121409 | 北野 | 2022-12-14 | 2023-08-16 | v1.2 | 提议 |
### 关于Lightship功能项的设计
Lightship(开放模式)功能提供完全公开的推文分享服务,有别于[Friendship](002-关于Friendship功能项的设计.md "关于Friendship功能项的设计")、[Followship](003-关于Followship功能项的设计.md "关于Followship功能项的设计")使用Lightship用户模式部署paopao-ce用户发布的所有推文都是公开可访问的广场推文列表展示的是全站所有公开推文的Timeline Tweets。
Lightship(开放模式)功能提供完全公开的推文分享服务,有别于[Friendship](22110410-关于Friendship功能项的设计.md "关于Friendship功能项的设计")、[Followship](22110410-关于Followship功能项的设计.md "关于Followship功能项的设计")使用Lightship用户模式部署paopao-ce用户发布的所有推文都是公开可访问的广场推文列表展示的是全站所有公开推文的Timeline Tweets。
### 场景
一般用于非常小的站点,或者推文更新不频繁的站点。
@ -24,6 +24,9 @@ Lightship(开放模式)功能提供完全公开的推文分享服务,有别于
#### 参考实现(PR):
[add Lightship feature support #198](https://github.com/rocboss/paopao-ce/pull/198)
#### 状态:
弃用 Deprecated
### 疑问
1. 公开模式为什么命名为Lightship
@ -45,3 +48,6 @@ Features:
#### v1.1(2022-01-09) - 北野
* 添加参考实现PR信息
#### v1.2(2023-08-16) - 北野
* 添加状态信息

@ -150,15 +150,15 @@
* [x] 业务逻辑实现
#### 关系模式:
* `Friendship` 弱关系好友模式,类似微信朋友圈(目前状态: 内);
* `Friendship` 弱关系好友模式,类似微信朋友圈(目前状态: 内置Builtin);
* [x] [提按文档](docs/proposal/22110410-关于Friendship功能项的设计.md)
* [x] 接口定义
* [x] 业务逻辑实现
* `Followship` 关注者模式类似Twitter的Follow模式(目前状态: WIP);
* `Followship` 关注者模式类似Twitter的Follow模式(目前状态: 内置Builtin);
* [ ] [提按文档](docs/proposal/22110409-关于Followship功能项的设计.md)
* [ ] 接口定义
* [ ] 业务逻辑实现
* `Lightship` 开放模式,所有推文都公开可见(目前状态: 内测、默认);
* `Lightship` 开放模式,所有推文都公开可见(目前状态: 弃用Deprecated);
* [x] [提按文档](docs/proposal/22121409-关于Lightship功能项的设计.md)
* [x] 接口定义
* [x] 业务逻辑实现

@ -14,9 +14,7 @@ var (
)
type bigCacheTweetsCache struct {
name string
version *semver.Version
bc *bigcache.BigCache
bc *bigcache.BigCache
}
func (s *bigCacheTweetsCache) getTweetsBytes(key string) ([]byte, error) {

@ -5,6 +5,7 @@
package cache
import (
"context"
"time"
"github.com/allegro/bigcache/v3"
@ -28,7 +29,7 @@ func NewBigCacheIndexService(ips core.IndexPostsService, ams core.AuthorizationM
c.MaxEntrySize = 10000
c.Logger = logrus.StandardLogger()
bc, err := bigcache.NewBigCache(c)
bc, err := bigcache.New(context.Background(), c)
if err != nil {
logrus.Fatalf("initial bigCahceIndex failure by err: %v", err)
}

@ -14,7 +14,7 @@ type Following struct {
*Model
User *User `json:"-" gorm:"foreignKey:ID;references:FollowId"`
UserId int64 `json:"user_id"`
FollowId int64 `json:"friend_id"`
FollowId int64 `json:"follow_id"`
}
func (f *Following) GetFollowing(db *gorm.DB, userId, followId int64) (*Following, error) {

@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
// Core service implement base gorm+mysql/postgresql/sqlite3.
// package jinzhu Core service implement base gorm+mysql/postgresql/sqlite3.
// Jinzhu is the primary developer of gorm so use his name as
// package name as a saluter.
@ -60,24 +60,12 @@ func NewDataService() (core.DataService, core.VersionInfo) {
var (
v core.VersionInfo
cis core.CacheIndexService
ips core.IndexPostsService
)
db := conf.MustGormDB()
pvs := security.NewPhoneVerifyService()
ams := NewAuthorizationManageService()
ths := newTweetHelpService(db)
// initialize core.IndexPostsService
if cfg.If("Friendship") {
ips = newFriendIndexService(db, ams, ths)
} else if cfg.If("Followship") {
ips = newFollowIndexService(db, ths)
} else if cfg.If("Lightship") {
ips = newLightIndexService(db, ths)
} else {
// default use lightship post index service
ips = newLightIndexService(db, ths)
}
ips := newShipIndexService(db, ams, ths)
// initialize core.CacheIndexService
cfg.On(cfg.Actions{
@ -87,7 +75,6 @@ func NewDataService() (core.DataService, core.VersionInfo) {
cis, v = cache.NewSimpleCacheIndexService(ips)
},
"BigCacheIndex": func() {
// TODO: make cache index post in different scence like friendship/followship/lightship
cis, v = cache.NewBigCacheIndexService(ips, ams)
},
"RedisCacheIndex": func() {

@ -15,35 +15,23 @@ import (
)
var (
_ core.IndexPostsService = (*friendIndexSrv)(nil)
_ core.IndexPostsService = (*followIndexSrv)(nil)
_ core.IndexPostsService = (*lightIndexSrv)(nil)
_ core.IndexPostsService = (*shipIndexSrv)(nil)
_ core.IndexPostsService = (*simpleIndexPostsSrv)(nil)
)
type friendIndexSrv struct {
type shipIndexSrv struct {
ams core.AuthorizationManageService
ths core.TweetHelpService
db *gorm.DB
}
type followIndexSrv struct {
ths core.TweetHelpService
db *gorm.DB
}
type lightIndexSrv struct {
ths core.TweetHelpService
db *gorm.DB
}
type simpleIndexPostsSrv struct {
ths core.TweetHelpService
db *gorm.DB
}
// IndexPosts 根据userId查询广场推文列表简单做到不同用户的主页都是不同的
func (s *friendIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) {
func (s *shipIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) {
predicates := dbr.Predicates{
"ORDER": []any{"is_top DESC, latest_replied_on DESC"},
}
@ -77,60 +65,6 @@ func (s *friendIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (*ms.I
}, nil
}
func (s *friendIndexSrv) TweetTimeline(userId int64, offset int, limit int) (*cs.TweetBox, error) {
// TODO
return nil, debug.ErrNotImplemented
}
// IndexPosts 根据userId查询广场推文列表
func (s *followIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) {
// TODO
return nil, debug.ErrNotImplemented
}
func (s *followIndexSrv) TweetTimeline(userId int64, offset int, limit int) (*cs.TweetBox, error) {
// TODO
return nil, debug.ErrNotImplemented
}
// IndexPosts 根据userId查询广场推文列表获取公开可见Tweet或者所属用户的私有Tweet
func (s *lightIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) {
predicates := dbr.Predicates{
"ORDER": []any{"is_top DESC, latest_replied_on DESC"},
}
if user == nil {
predicates["visibility = ?"] = []any{dbr.PostVisitPublic}
} else if !user.IsAdmin {
args := []any{dbr.PostVisitPublic, dbr.PostVisitPrivate, user.ID}
predicates["visibility = ? OR (visibility = ? AND user_id = ?)"] = args
}
posts, err := (&dbr.Post{}).Fetch(s.db, predicates, offset, limit)
if err != nil {
logrus.Debugf("gormIndexPostsSrv.IndexPosts err: %v", err)
return nil, err
}
formatPosts, err := s.ths.MergePosts(posts)
if err != nil {
return nil, err
}
total, err := (&dbr.Post{}).CountBy(s.db, predicates)
if err != nil {
return nil, err
}
return &ms.IndexTweetList{
Tweets: formatPosts,
Total: total,
}, nil
}
func (s *lightIndexSrv) TweetTimeline(userId int64, offset int, limit int) (*cs.TweetBox, error) {
// TODO
return nil, debug.ErrNotImplemented
}
// simpleCacheIndexGetPosts simpleCacheIndex 专属获取广场推文列表函数
func (s *simpleIndexPostsSrv) IndexPosts(_user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) {
predicates := dbr.Predicates{
@ -165,28 +99,14 @@ func (s *simpleIndexPostsSrv) TweetTimeline(userId int64, offset int, limit int)
return nil, debug.ErrNotImplemented
}
func newFriendIndexService(db *gorm.DB, ams core.AuthorizationManageService, ths core.TweetHelpService) core.IndexPostsService {
return &friendIndexSrv{
func newShipIndexService(db *gorm.DB, ams core.AuthorizationManageService, ths core.TweetHelpService) core.IndexPostsService {
return &shipIndexSrv{
ams: ams,
ths: ths,
db: db,
}
}
func newFollowIndexService(db *gorm.DB, ths core.TweetHelpService) core.IndexPostsService {
return &followIndexSrv{
ths: ths,
db: db,
}
}
func newLightIndexService(db *gorm.DB, ths core.TweetHelpService) core.IndexPostsService {
return &lightIndexSrv{
ths: ths,
db: db,
}
}
func newSimpleIndexPostsService(db *gorm.DB, ths core.TweetHelpService) core.IndexPostsService {
return &simpleIndexPostsSrv{
ths: ths,

@ -5,9 +5,10 @@
package sakila
import (
"time"
"github.com/jmoiron/sqlx"
"github.com/rocboss/paopao-ce/internal/core"
"github.com/rocboss/paopao-ce/internal/core/cs"
"github.com/rocboss/paopao-ce/internal/core/ms"
"github.com/rocboss/paopao-ce/internal/dao/sakila/yesql/cc"
)
@ -16,38 +17,79 @@ var (
_ core.FollowingManageService = (*followingManageSrv)(nil)
)
type followItem struct {
UserId int64
Username string
Nickname string
Avatar string
}
type followingManageSrv struct {
*sqlxSrv
q *cc.FollowingManager
}
func (s *followingManageSrv) FollowUser(userId int64, followId int64) error {
// TODO
return cs.ErrNotImplemented
func (s *followingManageSrv) FollowUser(userId int64, followId int64) (err error) {
exist := false
if err = s.q.ExistFollowing.Get(&exist, userId, followId); err == nil && exist {
return
}
_, err = s.q.CreateFollowing.Exec(userId, followId, time.Now().Unix())
return
}
func (s *followingManageSrv) UnfollowUser(userId int64, followId int64) error {
// TDOO
return cs.ErrNotImplemented
func (s *followingManageSrv) UnfollowUser(userId int64, followId int64) (err error) {
_, err = s.q.DeleteFollowing.Exec(time.Now().Unix(), userId, followId)
return
}
func (s *followingManageSrv) ListFollows(userId int64, limit, offset int) (*ms.ContactList, error) {
// TODO
return nil, cs.ErrNotImplemented
func (s *followingManageSrv) ListFollows(userId int64, limit, offset int) (res *ms.ContactList, err error) {
follows := []followItem{}
res = &ms.ContactList{}
if err = s.q.ListFollows.Select(&follows, userId, limit, offset); err == nil {
err = s.q.CountFollows.Get(&res.Total, userId)
}
for _, f := range follows {
res.Contacts = append(res.Contacts, ms.ContactItem{
UserId: f.UserId,
Username: f.Username,
Nickname: f.Nickname,
Avatar: f.Avatar,
IsFollow: true,
})
}
return
}
func (s *followingManageSrv) ListFollowings(userId int64, limit, offset int) (*ms.ContactList, error) {
// TODO
return nil, cs.ErrNotImplemented
func (s *followingManageSrv) ListFollowings(userId int64, limit, offset int) (res *ms.ContactList, err error) {
followings := []followItem{}
res = &ms.ContactList{}
if err = s.q.ListFollowings.Select(&followings, userId, limit, offset); err == nil {
err = s.q.CountFollowings.Get(&res.Total, userId)
}
for _, f := range followings {
res.Contacts = append(res.Contacts, ms.ContactItem{
UserId: f.UserId,
Username: f.Username,
Nickname: f.Nickname,
Avatar: f.Avatar,
IsFollow: s.IsFollow(userId, f.UserId),
})
}
return
}
func (s *followingManageSrv) GetFollowCount(userId int64) (int64, int64, error) {
// TODO
return 0, 0, cs.ErrNotImplemented
func (s *followingManageSrv) GetFollowCount(userId int64) (follows int64, followings int64, err error) {
if err = s.q.CountFollows.Get(&follows); err == nil {
err = s.q.CountFollowings.Get(&followings)
}
return
}
func (s *followingManageSrv) IsFollow(userId int64, followId int64) bool {
// TODO
func (s *followingManageSrv) IsFollow(userId int64, followId int64) (yn bool) {
if err := s.q.ExistFollowing.Get(&yn, userId, followId); err == nil {
return
}
return false
}

@ -56,23 +56,11 @@ func NewDataService() (core.DataService, core.VersionInfo) {
var (
v core.VersionInfo
cis core.CacheIndexService
ips core.IndexPostsService
)
pvs := security.NewPhoneVerifyService()
ams := NewAuthorizationManageService()
ths := newTweetHelpService(_db)
// initialize core.IndexPostsService
if cfg.If("Friendship") {
ips = newFriendIndexService(_db, ams, ths)
} else if cfg.If("Followship") {
ips = newFollowIndexService(_db, ths)
} else if cfg.If("Lightship") {
ips = newLightIndexService(_db, ths)
} else {
// default use lightship post index service
ips = newLightIndexService(_db, ths)
}
ips := newShipIndexService(_db, ams, ths)
// initialize core.CacheIndexService
cfg.On(cfg.Actions{
@ -119,23 +107,11 @@ func NewWebDataServantA() (core.WebDataServantA, core.VersionInfo) {
var (
v core.VersionInfo
cis core.CacheIndexService
ips core.IndexPostsService
)
// pvs := security.NewPhoneVerifyService()
ams := NewAuthorizationManageService()
ths := newTweetHelpService(_db)
// initialize core.IndexPostsService
if cfg.If("Friendship") {
ips = newFriendIndexService(_db, ams, ths)
} else if cfg.If("Followship") {
ips = newFollowIndexService(_db, ths)
} else if cfg.If("Lightship") {
ips = newLightIndexService(_db, ths)
} else {
// default use lightship post index service
ips = newLightIndexService(_db, ths)
}
ips := newShipIndexService(_db, ams, ths)
// initialize core.CacheIndexService
cfg.On(cfg.Actions{

@ -39,6 +39,7 @@ func (s *sqlxSrv) with(handle func(tx *sqlx.Tx) error) error {
return tx.Commit()
}
//lint:ignore U1000 withTx
func (s *sqlxSrv) withTx(ctx context.Context, opts *sql.TxOptions, handle func(*sqlx.Tx) error) error {
tx, err := s.db.BeginTxx(ctx, opts)
if err != nil {
@ -51,6 +52,7 @@ func (s *sqlxSrv) withTx(ctx context.Context, opts *sql.TxOptions, handle func(*
return tx.Commit()
}
//lint:ignore U1000 in
func (s *sqlxSrv) in(query string, args ...any) (string, []any, error) {
q, params, err := sqlx.In(query, args...)
if err != nil {
@ -59,6 +61,7 @@ func (s *sqlxSrv) in(query string, args ...any) (string, []any, error) {
return s.db.Rebind(q), params, nil
}
//lint:ignore U1000 inExec
func (s *sqlxSrv) inExec(query string, args ...any) (sql.Result, error) {
q, params, err := sqlx.In(query, args...)
if err != nil {
@ -102,6 +105,8 @@ func (s *sqlxSrv) inSelectx(queryer sqlx.Queryer, dest any, query string, args .
}
// inGetx get for in clause with Transcation
//
//lint:ignore U1000 inGetx
func (s *sqlxSrv) inGetx(queryer sqlx.Queryer, dest any, query string, args ...any) error {
q, params, err := sqlx.In(query, args...)
if err != nil {
@ -117,10 +122,12 @@ func newSqlxSrv(db *sqlx.DB) *sqlxSrv {
}
}
//lint:ignore U1000 r
func r(query string) string {
return _db.Rebind(t(query))
}
//lint:ignore U1000 c
func c(query string) *sqlx.Stmt {
query = _db.Rebind(t(query))
stmt, err := _db.Preparex(query)
@ -130,6 +137,7 @@ func c(query string) *sqlx.Stmt {
return stmt
}
//lint:ignore U1000 n
func n(query string) *sqlx.NamedStmt {
query = t(query)
stmt, err := _db.PrepareNamed(query)
@ -165,6 +173,8 @@ func t(query string) string {
}
// yesqlScan yesql.Scan help function
//
//lint:ignore U1000 yesqlScan
func yesqlScan[T any](query yesql.SQLQuery, obj T) T {
if err := yesql.Scan(obj, query); err != nil {
logrus.Fatal(err)

@ -11,37 +11,22 @@ import (
"github.com/rocboss/paopao-ce/internal/core/ms"
"github.com/rocboss/paopao-ce/internal/dao/sakila/yesql/cc"
"github.com/rocboss/paopao-ce/pkg/debug"
"github.com/sirupsen/logrus"
)
var (
_ core.IndexPostsService = (*friendIndexSrv)(nil)
_ core.IndexPostsService = (*followIndexSrv)(nil)
_ core.IndexPostsService = (*lightIndexSrv)(nil)
_ core.IndexPostsService = (*shipIndexSrv)(nil)
_ core.IndexPostsService = (*simpleIndexPostsSrv)(nil)
_ core.IndexPostsServantA = (*friendIndexSrvA)(nil)
_ core.IndexPostsServantA = (*followIndexSrvA)(nil)
_ core.IndexPostsServantA = (*lightIndexSrvA)(nil)
_ core.IndexPostsServantA = (*shipIndexSrvA)(nil)
_ core.IndexPostsServantA = (*simpleIndexPostsSrvA)(nil)
)
type friendIndexSrv struct {
type shipIndexSrv struct {
*sqlxSrv
ams core.AuthorizationManageService
ths core.TweetHelpService
q *cc.FriendIndex
}
type followIndexSrv struct {
*sqlxSrv
ths core.TweetHelpService
q *cc.FollowIndex
}
type lightIndexSrv struct {
*sqlxSrv
ths core.TweetHelpService
q *cc.LightIndex
q *cc.ShipIndex
}
type simpleIndexPostsSrv struct {
@ -50,23 +35,11 @@ type simpleIndexPostsSrv struct {
q *cc.SimpleIndex
}
type friendIndexSrvA struct {
type shipIndexSrvA struct {
*sqlxSrv
ams core.AuthorizationManageService
ths core.TweetHelpServantA
q *cc.FriendIndexA
}
type followIndexSrvA struct {
*sqlxSrv
ths core.TweetHelpServantA
q *cc.FollowIndexA
}
type lightIndexSrvA struct {
*sqlxSrv
ths core.TweetHelpServantA
q *cc.LightIndexA
q *cc.ShipIndexA
}
type simpleIndexPostsSrvA struct {
@ -76,43 +49,57 @@ type simpleIndexPostsSrvA struct {
}
// IndexPosts 根据userId查询广场推文列表简单做到不同用户的主页都是不同的
func (s *friendIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) {
// TODO
return nil, debug.ErrNotImplemented
}
// IndexPosts 根据userId查询广场推文列表简单做到不同用户的主页都是不同的
func (s *followIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) {
// TODO
return nil, debug.ErrNotImplemented
}
// IndexPosts 根据userId查询广场推文列表简单做到不同用户的主页都是不同的
func (s *lightIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) {
// TODO
return nil, debug.ErrNotImplemented
func (s *shipIndexSrv) IndexPosts(user *ms.User, offset int, limit int) (res *ms.IndexTweetList, err error) {
var posts []*ms.Post
res = &ms.IndexTweetList{}
switch {
case user == nil:
if err = s.q.IndexByGuest.Select(&posts, limit, offset); err == nil {
err = s.q.IndexCountByGuest.Get(&res.Total)
}
case user != nil && user.IsAdmin:
if err = s.q.IndexByAdmin.Select(&posts, limit, offset); err == nil {
err = s.q.IndexByAdmin.Get(&res.Total)
}
default:
friendIds, _ := s.ams.BeFriendIds(user.ID)
friendIds = append(friendIds, user.ID)
err = s.inSelect(&posts, s.q.IndexBySelf, user.ID, friendIds, limit, offset)
if err == nil {
err = s.inGet(&res.Total, s.q.IndexCountBySelf, user.ID, friendIds)
}
}
if err != nil {
logrus.Debugf("shipIndex.IndexPosts err: %s", err)
return
}
if res.Tweets, err = s.ths.MergePosts(posts); err != nil {
logrus.Debugf("shipIndex.IndexPosts merge posts err: %s", err)
return
}
return
}
// simpleCacheIndexGetPosts simpleCacheIndex 专属获取广场推文列表函数
func (s *simpleIndexPostsSrv) IndexPosts(_user *ms.User, offset int, limit int) (*ms.IndexTweetList, error) {
// TODO
return nil, debug.ErrNotImplemented
}
// IndexPosts 根据userId查询广场推文列表简单做到不同用户的主页都是不同的
func (s *friendIndexSrvA) IndexPosts(user *ms.User, limit int, offset int) (*cs.TweetBox, error) {
// TODO
return nil, debug.ErrNotImplemented
}
// IndexPosts 根据userId查询广场推文列表简单做到不同用户的主页都是不同的
func (s *followIndexSrvA) IndexPosts(user *ms.User, limit int, offset int) (*cs.TweetBox, error) {
// TODO
return nil, debug.ErrNotImplemented
func (s *simpleIndexPostsSrv) IndexPosts(_user *ms.User, offset int, limit int) (res *ms.IndexTweetList, err error) {
var posts []*ms.Post
res = &ms.IndexTweetList{}
if err = s.q.Index.Select(&posts, limit, offset); err == nil {
err = s.q.IndexCount.Get(&res.Total)
}
if err != nil {
logrus.Debugf("simpleIndexPostsSrv.IndexPosts err: %s", err)
return
}
if res.Tweets, err = s.ths.MergePosts(posts); err != nil {
logrus.Debugf("shipIndex.IndexPosts merge posts err: %s", err)
return
}
return
}
// IndexPosts 根据userId查询广场推文列表简单做到不同用户的主页都是不同的
func (s *lightIndexSrvA) IndexPosts(user *ms.User, limit int, offset int) (*cs.TweetBox, error) {
func (s *shipIndexSrvA) IndexPosts(user *ms.User, limit int, offset int) (*cs.TweetBox, error) {
// TODO
return nil, debug.ErrNotImplemented
}
@ -123,28 +110,12 @@ func (s *simpleIndexPostsSrvA) IndexPosts(_user *ms.User, limit int, offset int)
return nil, debug.ErrNotImplemented
}
func newFriendIndexService(db *sqlx.DB, ams core.AuthorizationManageService, ths core.TweetHelpService) core.IndexPostsService {
return &friendIndexSrv{
func newShipIndexService(db *sqlx.DB, ams core.AuthorizationManageService, ths core.TweetHelpService) core.IndexPostsService {
return &shipIndexSrv{
ams: ams,
ths: ths,
sqlxSrv: newSqlxSrv(db),
q: mustBuild(db, cc.BuildFriendIndex),
}
}
func newFollowIndexService(db *sqlx.DB, ths core.TweetHelpService) core.IndexPostsService {
return &followIndexSrv{
ths: ths,
sqlxSrv: newSqlxSrv(db),
q: mustBuild(db, cc.BuildFollowIndex),
}
}
func newLightIndexService(db *sqlx.DB, ths core.TweetHelpService) core.IndexPostsService {
return &lightIndexSrv{
ths: ths,
sqlxSrv: newSqlxSrv(db),
q: mustBuild(db, cc.BuildLightIndex),
q: mustBuild(db, cc.BuildShipIndex),
}
}
@ -156,35 +127,21 @@ func newSimpleIndexPostsService(db *sqlx.DB, ths core.TweetHelpService) core.Ind
}
}
func newFriendIndexServantA(db *sqlx.DB, ams core.AuthorizationManageService, ths core.TweetHelpServantA) core.IndexPostsServantA {
return &friendIndexSrvA{
//lint:ignore U1000 newShipIndexServantA
func newShipIndexServantA(db *sqlx.DB, ams core.AuthorizationManageService, ths core.TweetHelpServantA) core.IndexPostsServantA {
return &shipIndexSrvA{
ams: ams,
ths: ths,
sqlxSrv: newSqlxSrv(db),
q: mustBuild(db, cc.BuildFriendIndexA),
}
}
func newFollowIndexServantA(db *sqlx.DB, ths core.TweetHelpServantA) core.IndexPostsServantA {
return &followIndexSrvA{
ths: ths,
sqlxSrv: newSqlxSrv(db),
q: mustBuild(db, cc.BuildFollowIndexA),
}
}
func newLightIndexServantA(db *sqlx.DB, ths core.TweetHelpServantA) core.IndexPostsServantA {
return &lightIndexSrvA{
ths: ths,
sqlxSrv: newSqlxSrv(db),
q: mustBuild(db, cc.BuildLightIndexA),
q: mustBuildFn(db, cc.BuildShipIndexA),
}
}
//lint:ignore U1000 newSimpleIndexPostsServantA
func newSimpleIndexPostsServantA(db *sqlx.DB, ths core.TweetHelpServantA) core.IndexPostsServantA {
return &simpleIndexPostsSrvA{
ths: ths,
sqlxSrv: newSqlxSrv(db),
q: mustBuild(db, cc.BuildSimpleIndexA),
q: mustBuildFn(db, cc.BuildSimpleIndexA),
}
}

@ -263,9 +263,23 @@ func (s *tweetManageSrv) StickPost(r *ms.Post) error {
return err
}
func (s *tweetManageSrv) HighlightPost(userId, postId int64) (int, error) {
// TODO
return 0, cs.ErrNotImplemented
func (s *tweetManageSrv) HighlightPost(userId, postId int64) (is_essence int, err error) {
err = s.with(func(tx *sqlx.Tx) error {
var postUserId int64
err = tx.Stmtx(s.q.PostHighlightStatus).QueryRowx(postId).Scan(&postUserId, &is_essence)
if err != nil {
return err
}
if postUserId != userId {
return cs.ErrNoPermission
}
if _, err = tx.Stmtx(s.q.HighlightPost).Exec(postId); err != nil {
return err
}
is_essence = 1 - is_essence
return nil
})
return
}
func (s *tweetManageSrv) VisiblePost(post *ms.Post, visibility core.PostVisibleT) (err error) {
@ -370,19 +384,65 @@ func (s *tweetSrv) GetUserPostStars(userID int64, limit int, offset int) (res []
return
}
func (s *tweetSrv) ListUserStarTweets(user *cs.VistUser, limit int, offset int) ([]*ms.PostStar, int64, error) {
// TODO
return nil, 0, cs.ErrNotImplemented
func (s *tweetSrv) ListUserStarTweets(user *cs.VistUser, limit int, offset int) (res []*ms.PostStar, total int64, err error) {
switch user.RelTyp {
case cs.RelationAdmin:
if err = s.q.UserStarTweetsByAdmin.Select(&res, user.UserId, limit, offset); err == nil {
err = s.q.UserStarTweetsCountByAdmin.Get(&total, user.UserId)
}
case cs.RelationSelf:
// Fixed: 这里的查询有Bug没有考虑查询Friend star 时如果对方已经不是你好友时应该去除这个star
if err = s.q.UserStarTweetsBySelf.Select(&res, user.UserId, user.UserId, limit, offset); err == nil {
err = s.q.UserStarTweetsCountByAdmin.Get(&total, user.UserId, user.UserId)
}
case cs.RelationFriend:
if err = s.q.UserStarTweetsByFriend.Select(&res, user.UserId, limit, offset); err == nil {
err = s.q.UserStarTweetsByFriend.Get(&total, user.UserId)
}
case cs.RelationGuest:
fallthrough
default:
if err = s.q.UserStarTweetsByGuest.Select(&res, user.UserId, limit, offset); err == nil {
err = s.q.UserStarTweetsCountByGuest.Get(&total, user.UserId)
}
}
return
}
func (s *tweetSrv) ListUserMediaTweets(user *cs.VistUser, limit int, offset int) ([]*ms.Post, int64, error) {
// TODO
return nil, 0, cs.ErrNotImplemented
func (s *tweetSrv) ListUserMediaTweets(user *cs.VistUser, limit int, offset int) (res []*ms.Post, total int64, err error) {
gStmt, cStmt := s.q.UserMediaTweetsByGuest, s.q.UserMediaTweetsCountByGuest
switch user.RelTyp {
case cs.RelationAdmin, cs.RelationSelf:
gStmt, cStmt = s.q.UserMediaTweetsBySelf, s.q.UserMediaTweetsCountBySelf
case cs.RelationFriend:
gStmt, cStmt = s.q.UserMediaTweetsByFriend, s.q.UserMediaTweetsCountByFriend
case cs.RelationGuest:
fallthrough
default:
// nothing
}
if err = gStmt.Select(&res, user.UserId, limit, offset); err == nil {
err = cStmt.Get(&total, user.UserId)
}
return
}
func (s *tweetSrv) ListUserCommentTweets(user *cs.VistUser, limit int, offset int) ([]*ms.Post, int64, error) {
// TODO
return nil, 0, cs.ErrNotImplemented
func (s *tweetSrv) ListUserCommentTweets(user *cs.VistUser, limit int, offset int) (res []*ms.Post, total int64, err error) {
gStmt, cStmt := s.q.UserCommentTweetsByGuest, s.q.UserCommentTweetsCountByGuest
switch user.RelTyp {
case cs.RelationAdmin, cs.RelationSelf:
gStmt, cStmt = s.q.UserCommentTweetsBySelf, s.q.UserCommentTweetsCountBySelf
case cs.RelationFriend:
gStmt, cStmt = s.q.UserCommentTweetsByFriend, s.q.UserCommentTweetsCountByFriend
case cs.RelationGuest:
fallthrough
default:
// nothing
}
if err = gStmt.Select(&res, user.UserId, limit, offset); err == nil {
err = cStmt.Get(&total, user.UserId)
}
return
}
func (s *tweetSrv) GetUserPostStarCount(userID int64) (res int64, err error) {
@ -421,76 +481,43 @@ func (s *tweetSrv) GetPostContentByID(id int64) (res *ms.PostContent, err error)
}
func (s *tweetSrvA) TweetInfoById(id int64) (*cs.TweetInfo, error) {
res := &cs.TweetInfo{}
err := s.q.TweetInfoById.Get(res, id)
return res, err
// TODO
return nil, debug.ErrNotImplemented
}
func (s *tweetSrvA) TweetItemById(id int64) (*cs.TweetItem, error) {
res := &cs.TweetItem{}
err := s.q.TweetItemById.Get(res, id)
if err != nil {
return nil, err
}
// TODO need add contents info to res
return res, nil
// TODO
return nil, debug.ErrNotImplemented
}
func (s *tweetSrvA) UserTweets(visitorId, userId int64) (res cs.TweetList, err error) {
res = cs.TweetList{}
switch s.checkRelationBy(visitorId, userId) {
case 0: // admin
err = s.q.UserTweetsByAdmin.Select(&res, userId)
case 1: // self
err = s.q.UserTweetsBySelf.Select(&res, userId)
case 2: // friend
err = s.q.UserTweetsByFriend.Select(&res, userId)
case 3: // follower
fallthrough
default: // guest
err = s.q.UserTweetsByGuest.Select(&res, userId)
}
if err != nil {
return nil, err
}
// TODO need add contents info to res
return res, nil
}
// checkRelationBy check the relation of visitor with user
func (s *tweetSrvA) checkRelationBy(visitorId, userId int64) uint {
// TODO
return 0
return nil, debug.ErrNotImplemented
}
func (s *tweetSrvA) ReactionByTweetId(userId int64, tweetId int64) (*cs.ReactionItem, error) {
res := &cs.ReactionItem{}
err := s.q.ReactionByTweetId.Get(res, userId, tweetId)
return res, err
// TODO
return nil, debug.ErrNotImplemented
}
func (s *tweetSrvA) UserReactions(userId int64, limit int, offset int) (cs.ReactionList, error) {
res := cs.ReactionList{}
err := s.q.UserReactions.Select(&res, userId)
return res, err
// TODO
return nil, debug.ErrNotImplemented
}
func (s *tweetSrvA) FavoriteByTweetId(userId int64, tweetId int64) (*cs.FavoriteItem, error) {
res := &cs.FavoriteItem{}
err := s.q.FavoriteByTweetId.Get(res, userId, tweetId)
return res, err
// TODO
return nil, debug.ErrNotImplemented
}
func (s *tweetSrvA) UserFavorites(userId int64, limit int, offset int) (cs.FavoriteList, error) {
res := cs.FavoriteList{}
err := s.q.UserFavorites.Select(&res, userId)
return res, err
// TODO
return nil, debug.ErrNotImplemented
}
func (s *tweetSrvA) AttachmentByTweetId(userId int64, tweetId int64) (*cs.AttachmentBill, error) {
res := &cs.AttachmentBill{}
err := s.q.AttachmentByTweetId.Get(res, userId, tweetId)
return res, err
// TODO
return nil, debug.ErrNotImplemented
}
func (s *tweetManageSrvA) CreateAttachment(obj *cs.Attachment) (int64, error) {
@ -578,7 +605,7 @@ func newTweetHelpService(db *sqlx.DB) core.TweetHelpService {
func newTweetServantA(db *sqlx.DB) core.TweetServantA {
return &tweetSrvA{
sqlxSrv: newSqlxSrv(db),
q: mustBuild(db, cc.BuildTweetA),
q: mustBuildFn(db, cc.BuildTweetA),
}
}
@ -586,13 +613,13 @@ func newTweetManageServantA(db *sqlx.DB, cacheIndex core.CacheIndexService) core
return &tweetManageSrvA{
sqlxSrv: newSqlxSrv(db),
cis: cacheIndex,
q: mustBuild(db, cc.BuildTweetManageA),
q: mustBuildFn(db, cc.BuildTweetManageA),
}
}
func newTweetHelpServantA(db *sqlx.DB) core.TweetHelpServantA {
return &tweetHelpSrvA{
sqlxSrv: newSqlxSrv(db),
q: mustBuild(db, cc.BuildTweetHelpA),
q: mustBuildFn(db, cc.BuildTweetHelpA),
}
}

@ -50,13 +50,13 @@ const (
_ContactManager_ListFriend = `SELECT c.friend_id user_id, u.username username, u.nickname nickname, u.avatar avatar, u.phone phone FROM @contact c JOIN @user u ON c.friend_id=u.id WHERE user_id=? AND status=2 AND is_del=0 ORDER BY u.nickname ASC LIMIT ? OFFSET ?`
_ContactManager_RejectFriendMsgsUpdate = `UPDATE @message SET reply_id=?, modified_on=? WHERE sender_user_id = ? AND receiver_user_id = ? AND type = ? AND reply_id = ?`
_ContactManager_TotalFriendsById = `SELECT count(*) FROM @contact WHERE user_id=? AND status=2 AND is_del=0`
_FollowIndexA_UserInfo = `SELECT * FROM @user WHERE username=?`
_FollowIndex_UserInfo = `SELECT * FROM @user WHERE username=?`
_FollowingManager_CountFollowings = `SELECT count(*) FROM @following WHERE follow_id=? AND is_del=0`
_FollowingManager_CountFollows = `SELECT count(*) FROM @following WHERE user_id=? AND is_del=0`
_FollowingManager_CreateFollowing = `INSERT INTO @following (user_id, follow_id, created_on) VALUES (?, ?, ?)`
_FriendIndexA_UserInfo = `SELECT * FROM @user WHERE username=?`
_FriendIndex_UserInfo = `SELECT * FROM @user WHERE username=?`
_LightIndexA_UserInfo = `SELECT * FROM @user WHERE username=?`
_LightIndex_UserInfo = `SELECT * FROM @user WHERE username=?`
_FollowingManager_DeleteFollowing = `UPDATE @following SET is_del=0, deleted_on=? WHERE user_id=? AND follow_id=? AND is_del=0`
_FollowingManager_ExistFollowing = `SELECT 1 FROM @following WHERE user_id=? AND follow_id AND is_del=0`
_FollowingManager_ListFollowings = `SELECT u.user_id user_id, u.username username, u.nickname nickname, u.avatar avatar FROM @following f JOIN @user u ON f.user_id=u.id WHERE f.follow_id=? AND f.is_del=0 ORDER BY u.nickname ASC LIMIT ? OFFSET ?`
_FollowingManager_ListFollows = `SELECT u.user_id user_id, u.username username, u.nickname nickname, u.avatar avatar FROM @following f JOIN @user u ON f.follow_id=u.id WHERE f.user_id=? AND f.is_del=0 ORDER BY u.nickname ASC LIMIT ? OFFSET ?`
_Message_CreateMessage = `INSERT INTO @message (sender_user_id, receiver_user_id, type, brief, content, post_id, comment_id, reply_id, created_on) VALUES (:sender_user_id, :receiver_user_id, :type, :brief, :content, :post_id, :comment_id, :reply_id, :created_on)`
_Message_GetMessageById = `SELECT * FROM @message WHERE id=? AND is_del=0`
_Message_GetMessageCount = `SELECT count(*) FROM @message WHERE receiver_user_id=:recerver_user_id AND is_del=0`
@ -66,8 +66,16 @@ const (
_Security_CreatePhoneCaptcha = `INSERT INTO @captcha (phone, captcha, expired_on, created_on) VALUES (:phone, :captcha, :expired_on, :created_on)`
_Security_GetLatestPhoneCaptcha = `SELECT * FROM @captcha WHERE phone=? AND is_del=0`
_Security_UsePhoneCaptcha = `UPDATE @captcha SET use_times=use_times+1, modified_on=? WHERE id=? AND is_del=0`
_ShipIndexA_UserInfo = `SELECT * FROM @user WHERE username=?`
_ShipIndex_IndexByAdmin = `SELECT * FROM @p_post WHERE is_del=0 ORDER BY is_top DESC, latest_replied_on DESC LIMIT ? OFFSET ?`
_ShipIndex_IndexByGuest = `SELECT * FROM @p_post WHERE visibility=0 AND is_del=0 ORDER BY is_top DESC, latest_replied_on DESC LIMIT ? OFFSET ?`
_ShipIndex_IndexBySelf = `SELECT * FROM @p_post WHERE is_del=0 AND (visibility=0 OR (visibility=1 AND user_id=?) OR (visibility=2 AND user_id IN ?)) ORDER BY is_top DESC, latest_replied_on DESC LIMIT ? OFFSET ?`
_ShipIndex_IndexCountByAdmin = `SELECT count(*) FROM @p_post WHERE is_del=0`
_ShipIndex_IndexCountByGuest = `SELECT count(*) FROM @p_post WHERE visibility=0 AND is_del=0`
_ShipIndex_IndexCountBySelf = `SELECT count(*) FROM @p_post WHERE is_del=0 AND (visibility=0 OR (visibility=1 AND user_id=?) OR (visibility=2 AND user_id IN ?))`
_SimpleIndexA_UserInfo = `SELECT * FROM @user WHERE username=?`
_SimpleIndex_UserInfo = `SELECT * FROM @user WHERE username=?`
_SimpleIndex_Index = `SELECT * FROM @p_post WHERE visibility=0 ORDER BY is_top DESC, latest_replied_on DESC LIMIT ? OFFSET ?`
_SimpleIndex_IndexCount = `SELECT count(*) FROM @p_post WHERE visibility=0`
_TopicA_DecrTagsById = `UPDATE @tag SET quote_num=quote_num-1, modified_on=? WHERE id IN (?)`
_TopicA_HotTags = `SELECT t.id id, t.user_id user_id, t.tag tag, t.quote_num quote_num, u.id, u.nickname, u.username, u.status, u.avatar, u.is_admin FROM @tag t JOIN @user u ON t.user_id = u.id WHERE t.is_del = 0 AND t.quote_num > 0 ORDER BY t.quote_num DESC LIMIT ? OFFSET ?`
_TopicA_IncrTagsById = `UPDATE @tag SET quote_num=quote_num+1, is_del=0, modified_on=? WHERE id IN (?)`
@ -121,11 +129,33 @@ const (
_TweetManage_DelPostCollection = `UPDATE @post_collection SET is_del=1, deleted_on=? WHERE id=? AND is_del=0`
_TweetManage_DelPostStar = `UPDATE @post_star SET is_del=1, deleted_on=? WHERE id=? AND is_del=0`
_TweetManage_DelReplyByCommentIds = `UPDATE @comment_reply SET deleted_on=?, is_del=1 WHERE comment_id IN (?) AND is_del=0`
_TweetManage_HighlightPost = `UPDATE @post SET is_essence=1-is_essence WHERE id=? AND is_del=0`
_TweetManage_LockPost = `UPDATE @post SET is_lock=1-is_lock, modified_on=? WHERE id=? AND is_del=0`
_TweetManage_MediaContentByPostId = `SELECT content FROM post_content WHERE post_id=? AND is_del=0 AND type IN (3, 4, 5, 7, 8)`
_TweetManage_PostHighlightStatus = `SELECT user_id, is_essence FROM @post WHERE id=? AND is_del=0`
_TweetManage_StickPost = `UPDATE @post SET is_top=1-is_top, modified_on=? WHERE id=? AND is_del=0`
_TweetManage_UpdatePost = `UPDATE @post SET comment_count=:comment_count, upvote_count=:upvote_count, collection_count=:collection_count, latest_replies_on=:latest_replies_on, modified_on=:modified_on WHERE id=:id AND is_del=0`
_TweetManage_VisiblePost = `UPDATE @post SET visibility=?, is_top=?, modified_on=? WHERE id=? AND is_del=0`
_Tweet_UserCommentTweetsByFriend = `SELECT * FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? AND (visibility=0 OR visibility=2) ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserCommentTweetsByGuest = `SELECT * FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? AND visibility=0 ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserCommentTweetsBySelf = `SELECT * FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserCommentTweetsCountByFriend = `SELECT count(*) FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? AND (visibility=0 OR visibility=2)`
_Tweet_UserCommentTweetsCountByGuest = `SELECT count(*) FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? AND visibility=0`
_Tweet_UserCommentTweetsCountBySelf = `SELECT count(*) FROM @post_by_comment WHERE is_del=0 AND comment_user_id=?`
_Tweet_UserMediaTweetsByFriend = `SELECT * FROM @post_by_media WHERE is_del=0 AND user_id=? AND (visibility=0 OR visibility=2) ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserMediaTweetsByGuest = `SELECT * FROM @post_by_media WHERE is_del=0 AND user_id=? AND visibility=0 ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserMediaTweetsBySelf = `SELECT * FROM @post_by_media WHERE is_del=0 AND user_id=? ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserMediaTweetsCountByFriend = `SELECT count(*) FROM @post_by_media WHERE is_del=0 AND user_id=? AND (visibility=0 OR visibility=2)`
_Tweet_UserMediaTweetsCountByGuest = `SELECT count(*) FROM @post_by_media WHERE is_del=0 AND user_id=? AND visibility=0`
_Tweet_UserMediaTweetsCountBySelf = `SELECT count(*) FROM @post_by_media WHERE is_del=0 AND user_id=?`
_Tweet_UserStarTweetsByAdmin = `SELECT star.*, post.ID "post.id", post.created_on "post.created_on", post.modified_on "post.modified_on", post.deleted_on "post.deleted_on", post.is_del "post.is_del", post.user_id "post.user_id", post.comment_count "post.comment_count", post.collection_count "post.collection_count", post.share_count "post.share_count", post.upvote_count "post.upvote_count", post.visibility "post.visibility", post.is_top "post.is_top", post.is_essence "post.is_essence", post.is_lock "post.is_lock", post.latest_replied_on "post.latest_replied_on", post.tags "post.tags", post.attachment_price "post.attachment_price", post.ip "post.ip", post.ip_loc "post.ip_loc" FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? ORDER BY post.latest_replied_on DESC; LIMIT ? OFFSET ?`
_Tweet_UserStarTweetsByFriend = `SELECT star.*, post.ID "post.id", post.created_on "post.created_on", post.modified_on "post.modified_on", post.deleted_on "post.deleted_on", post.is_del "post.is_del", post.user_id "post.user_id", post.comment_count "post.comment_count", post.collection_count "post.collection_count", post.share_count "post.share_count", post.upvote_count "post.upvote_count", post.visibility "post.visibility", post.is_top "post.is_top", post.is_essence "post.is_essence", post.is_lock "post.is_lock", post.latest_replied_on "post.latest_replied_on", post.tags "post.tags", post.attachment_price "post.attachment_price", post.ip "post.ip", post.ip_loc "post.ip_loc" FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND (post.visibility=0 OR post.visibility=2) ORDER BY post.latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserStarTweetsByGuest = `SELECT star.*, post.ID "post.id", post.created_on "post.created_on", post.modified_on "post.modified_on", post.deleted_on "post.deleted_on", post.is_del "post.is_del", post.user_id "post.user_id", post.comment_count "post.comment_count", post.collection_count "post.collection_count", post.share_count "post.share_count", post.upvote_count "post.upvote_count", post.visibility "post.visibility", post.is_top "post.is_top", post.is_essence "post.is_essence", post.is_lock "post.is_lock", post.latest_replied_on "post.latest_replied_on", post.tags "post.tags", post.attachment_price "post.attachment_price", post.ip "post.ip", post.ip_loc "post.ip_loc" FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del = 0 AND star.user_id =? AND post.visibility = 0 ORDER BY post.latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserStarTweetsBySelf = `SELECT star.*, post.ID "post.id", post.created_on "post.created_on", post.modified_on "post.modified_on", post.deleted_on "post.deleted_on", post.is_del "post.is_del", post.user_id "post.user_id", post.comment_count "post.comment_count", post.collection_count "post.collection_count", post.share_count "post.share_count", post.upvote_count "post.upvote_count", post.visibility "post.visibility", post.is_top "post.is_top", post.is_essence "post.is_essence", post.is_lock "post.is_lock", post.latest_replied_on "post.latest_replied_on", post.tags "post.tags", post.attachment_price "post.attachment_price", post.ip "post.ip", post.ip_loc "post.ip_loc" FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND (post.visibility<>0 (post.visibility=0 AND post.user_id=?)) ORDER BY post.latest_replied_on DESC; LIMIT ? OFFSET ?`
_Tweet_UserStarTweetsCountByAdmin = `SELECT count(*) FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=?`
_Tweet_UserStarTweetsCountByFriend = `SELECT count(*) FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND (post.visibility=0 OR post.visibility=2)`
_Tweet_UserStarTweetsCountByGuest = `SELECT count(*) FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND post.visibility=0`
_Tweet_UserStarTweetsCountBySelf = `SELECT count(*) FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND (post.visibility<>0 (post.visibility=0 AND post.user_id=?))`
_UserManage_CreateUser = `INSERT INTO @user (username, nickname, password, salt, avatar, status, created_on) VALUES (:username, :nickname, :password, :salt, :avatar, :status, :created_on)`
_UserManage_GetAnyUsers = `SELECT * FROM @user WHERE is_del=0 ORDER BY id ASC limit 6`
_UserManage_GetUserById = `SELECT * FROM @user WHERE id=? AND is_del=0`
@ -205,39 +235,15 @@ type ContactManager struct {
CreateMessage *sqlx.NamedStmt `yesql:"create_message"`
}
type FollowIndex struct {
yesql.Namespace `yesql:"follow_index"`
UserInfo *sqlx.Stmt `yesql:"user_info"`
}
type FollowIndexA struct {
yesql.Namespace `yesql:"follow_index_a"`
UserInfo *sqlx.Stmt `yesql:"user_info"`
}
type FollowingManager struct {
yesql.Namespace `yesql:"following_manager"`
CountFollowings *sqlx.Stmt `yesql:"count_followings"`
CountFollows *sqlx.Stmt `yesql:"count_follows"`
CreateFollowing *sqlx.Stmt `yesql:"create_following"`
}
type FriendIndex struct {
yesql.Namespace `yesql:"friend_index"`
UserInfo *sqlx.Stmt `yesql:"user_info"`
}
type FriendIndexA struct {
yesql.Namespace `yesql:"friend_index_a"`
UserInfo *sqlx.Stmt `yesql:"user_info"`
}
type LightIndex struct {
yesql.Namespace `yesql:"light_index"`
UserInfo *sqlx.Stmt `yesql:"user_info"`
}
type LightIndexA struct {
yesql.Namespace `yesql:"light_index_a"`
UserInfo *sqlx.Stmt `yesql:"user_info"`
DeleteFollowing *sqlx.Stmt `yesql:"delete_following"`
ExistFollowing *sqlx.Stmt `yesql:"exist_following"`
ListFollowings *sqlx.Stmt `yesql:"list_followings"`
ListFollows *sqlx.Stmt `yesql:"list_follows"`
}
type Message struct {
@ -257,14 +263,30 @@ type Security struct {
CreatePhoneCaptcha *sqlx.NamedStmt `yesql:"create_phone_captcha"`
}
type ShipIndex struct {
yesql.Namespace `yesql:"ship_index"`
IndexBySelf string `yesql:"index_by_self"`
IndexCountBySelf string `yesql:"index_count_by_self"`
IndexByAdmin *sqlx.Stmt `yesql:"index_by_admin"`
IndexByGuest *sqlx.Stmt `yesql:"index_by_guest"`
IndexCountByAdmin *sqlx.Stmt `yesql:"index_count_by_admin"`
IndexCountByGuest *sqlx.Stmt `yesql:"index_count_by_guest"`
}
type ShipIndexA struct {
yesql.Namespace `yesql:"ship_index_a"`
UserInfo string `yesql:"user_info"`
}
type SimpleIndex struct {
yesql.Namespace `yesql:"simple_index"`
UserInfo *sqlx.Stmt `yesql:"user_info"`
Index *sqlx.Stmt `yesql:"index"`
IndexCount *sqlx.Stmt `yesql:"index_count"`
}
type SimpleIndexA struct {
yesql.Namespace `yesql:"simple_index_a"`
UserInfo *sqlx.Stmt `yesql:"user_info"`
UserInfo string `yesql:"user_info"`
}
type TopicA struct {
@ -282,37 +304,57 @@ type TopicA struct {
}
type Tweet struct {
yesql.Namespace `yesql:"tweet"`
GetAnyPostCount string `yesql:"get_any_post_count"`
GetAnyPosts string `yesql:"get_any_posts"`
GetPostContentsByIds string `yesql:"get_post_contents_by_ids"`
GetUserPostCount string `yesql:"get_user_post_count"`
GetUserPosts string `yesql:"get_user_posts"`
GetPostAttachmentBill *sqlx.Stmt `yesql:"get_post_attachment_bill"`
GetPostById *sqlx.Stmt `yesql:"get_post_by_id"`
GetPostContentById *sqlx.Stmt `yesql:"get_post_content_by_id"`
GetUserPostCollection *sqlx.Stmt `yesql:"get_user_post_collection"`
GetUserPostCollectionCount *sqlx.Stmt `yesql:"get_user_post_collection_count"`
GetUserPostCollections *sqlx.Stmt `yesql:"get_user_post_collections"`
GetUserPostStar *sqlx.Stmt `yesql:"get_user_post_star"`
GetUserPostStarCount *sqlx.Stmt `yesql:"get_user_post_star_count"`
GetUserPostStars *sqlx.Stmt `yesql:"get_user_post_stars"`
yesql.Namespace `yesql:"tweet"`
GetAnyPostCount string `yesql:"get_any_post_count"`
GetAnyPosts string `yesql:"get_any_posts"`
GetPostContentsByIds string `yesql:"get_post_contents_by_ids"`
GetUserPostCount string `yesql:"get_user_post_count"`
GetUserPosts string `yesql:"get_user_posts"`
GetPostAttachmentBill *sqlx.Stmt `yesql:"get_post_attachment_bill"`
GetPostById *sqlx.Stmt `yesql:"get_post_by_id"`
GetPostContentById *sqlx.Stmt `yesql:"get_post_content_by_id"`
GetUserPostCollection *sqlx.Stmt `yesql:"get_user_post_collection"`
GetUserPostCollectionCount *sqlx.Stmt `yesql:"get_user_post_collection_count"`
GetUserPostCollections *sqlx.Stmt `yesql:"get_user_post_collections"`
GetUserPostStar *sqlx.Stmt `yesql:"get_user_post_star"`
GetUserPostStarCount *sqlx.Stmt `yesql:"get_user_post_star_count"`
GetUserPostStars *sqlx.Stmt `yesql:"get_user_post_stars"`
UserCommentTweetsByFriend *sqlx.Stmt `yesql:"user_comment_tweets_by_friend"`
UserCommentTweetsByGuest *sqlx.Stmt `yesql:"user_comment_tweets_by_guest"`
UserCommentTweetsBySelf *sqlx.Stmt `yesql:"user_comment_tweets_by_self"`
UserCommentTweetsCountByFriend *sqlx.Stmt `yesql:"user_comment_tweets_count_by_friend"`
UserCommentTweetsCountByGuest *sqlx.Stmt `yesql:"user_comment_tweets_count_by_guest"`
UserCommentTweetsCountBySelf *sqlx.Stmt `yesql:"user_comment_tweets_count_by_self"`
UserMediaTweetsByFriend *sqlx.Stmt `yesql:"user_media_tweets_by_friend"`
UserMediaTweetsByGuest *sqlx.Stmt `yesql:"user_media_tweets_by_guest"`
UserMediaTweetsBySelf *sqlx.Stmt `yesql:"user_media_tweets_by_self"`
UserMediaTweetsCountByFriend *sqlx.Stmt `yesql:"user_media_tweets_count_by_friend"`
UserMediaTweetsCountByGuest *sqlx.Stmt `yesql:"user_media_tweets_count_by_guest"`
UserMediaTweetsCountBySelf *sqlx.Stmt `yesql:"user_media_tweets_count_by_self"`
UserStarTweetsByAdmin *sqlx.Stmt `yesql:"user_star_tweets_by_admin"`
UserStarTweetsByFriend *sqlx.Stmt `yesql:"user_star_tweets_by_friend"`
UserStarTweetsByGuest *sqlx.Stmt `yesql:"user_star_tweets_by_guest"`
UserStarTweetsBySelf *sqlx.Stmt `yesql:"user_star_tweets_by_self"`
UserStarTweetsCountByAdmin *sqlx.Stmt `yesql:"user_star_tweets_count_by_admin"`
UserStarTweetsCountByFriend *sqlx.Stmt `yesql:"user_star_tweets_count_by_friend"`
UserStarTweetsCountByGuest *sqlx.Stmt `yesql:"user_star_tweets_count_by_guest"`
UserStarTweetsCountBySelf *sqlx.Stmt `yesql:"user_star_tweets_count_by_self"`
}
type TweetA struct {
yesql.Namespace `yesql:"tweet_a"`
AttachmentByTweetId *sqlx.Stmt `yesql:"attachment_by_tweet_id"`
FavoriteByTweetId *sqlx.Stmt `yesql:"favorite_by_tweet_id"`
ReactionByTweetId *sqlx.Stmt `yesql:"reaction_by_tweet_id"`
TweetInfoById *sqlx.Stmt `yesql:"tweet_info_by_id"`
TweetItemById *sqlx.Stmt `yesql:"tweet_item_by_id"`
UserFavorites *sqlx.Stmt `yesql:"user_favorites"`
UserInfo *sqlx.Stmt `yesql:"user_info"`
UserReactions *sqlx.Stmt `yesql:"user_reactions"`
UserTweetsByAdmin *sqlx.Stmt `yesql:"user_tweets_by_admin"`
UserTweetsByFriend *sqlx.Stmt `yesql:"user_tweets_by_friend"`
UserTweetsByGuest *sqlx.Stmt `yesql:"user_tweets_by_guest"`
UserTweetsBySelf *sqlx.Stmt `yesql:"user_tweets_by_self"`
AttachmentByTweetId string `yesql:"attachment_by_tweet_id"`
FavoriteByTweetId string `yesql:"favorite_by_tweet_id"`
ReactionByTweetId string `yesql:"reaction_by_tweet_id"`
TweetInfoById string `yesql:"tweet_info_by_id"`
TweetItemById string `yesql:"tweet_item_by_id"`
UserFavorites string `yesql:"user_favorites"`
UserInfo string `yesql:"user_info"`
UserReactions string `yesql:"user_reactions"`
UserTweetsByAdmin string `yesql:"user_tweets_by_admin"`
UserTweetsByFriend string `yesql:"user_tweets_by_friend"`
UserTweetsByGuest string `yesql:"user_tweets_by_guest"`
UserTweetsBySelf string `yesql:"user_tweets_by_self"`
}
type TweetHelp struct {
@ -323,7 +365,7 @@ type TweetHelp struct {
type TweetHelpA struct {
yesql.Namespace `yesql:"tweet_help_a"`
UserInfo *sqlx.Stmt `yesql:"user_info"`
UserInfo string `yesql:"user_info"`
}
type TweetManage struct {
@ -339,8 +381,10 @@ type TweetManage struct {
DelPostById *sqlx.Stmt `yesql:"del_post_by_id"`
DelPostCollection *sqlx.Stmt `yesql:"del_post_collection"`
DelPostStar *sqlx.Stmt `yesql:"del_post_star"`
HighlightPost *sqlx.Stmt `yesql:"highlight_post"`
LockPost *sqlx.Stmt `yesql:"lock_post"`
MediaContentByPostId *sqlx.Stmt `yesql:"media_content_by_post_id"`
PostHighlightStatus *sqlx.Stmt `yesql:"post_highlight_status"`
StickPost *sqlx.Stmt `yesql:"stick_post"`
VisiblePost *sqlx.Stmt `yesql:"visible_post"`
AddPost *sqlx.NamedStmt `yesql:"add_post"`
@ -350,7 +394,7 @@ type TweetManage struct {
type TweetManageA struct {
yesql.Namespace `yesql:"tweet_manage_a"`
UserInfo *sqlx.Stmt `yesql:"user_info"`
UserInfo string `yesql:"user_info"`
}
type UserManage struct {
@ -542,99 +586,33 @@ func BuildContactManager(p yesql.PreparexBuilder, ctx ...context.Context) (obj *
return
}
func BuildFollowIndex(p yesql.PreparexBuilder, ctx ...context.Context) (obj *FollowIndex, err error) {
func BuildFollowingManager(p yesql.PreparexBuilder, ctx ...context.Context) (obj *FollowingManager, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
}
obj = &FollowIndex{}
if obj.UserInfo, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowIndex_UserInfo))); err != nil {
obj = &FollowingManager{}
if obj.CountFollowings, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_CountFollowings))); err != nil {
return
}
return
}
func BuildFollowIndexA(p yesql.PreparexBuilder, ctx ...context.Context) (obj *FollowIndexA, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
}
obj = &FollowIndexA{}
if obj.UserInfo, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowIndexA_UserInfo))); err != nil {
if obj.CountFollows, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_CountFollows))); err != nil {
return
}
return
}
func BuildFollowingManager(p yesql.PreparexBuilder, ctx ...context.Context) (obj *FollowingManager, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
}
obj = &FollowingManager{}
if obj.CreateFollowing, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_CreateFollowing))); err != nil {
return
}
return
}
func BuildFriendIndex(p yesql.PreparexBuilder, ctx ...context.Context) (obj *FriendIndex, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
}
obj = &FriendIndex{}
if obj.UserInfo, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FriendIndex_UserInfo))); err != nil {
if obj.DeleteFollowing, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_DeleteFollowing))); err != nil {
return
}
return
}
func BuildFriendIndexA(p yesql.PreparexBuilder, ctx ...context.Context) (obj *FriendIndexA, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
}
obj = &FriendIndexA{}
if obj.UserInfo, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FriendIndexA_UserInfo))); err != nil {
if obj.ExistFollowing, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_ExistFollowing))); err != nil {
return
}
return
}
func BuildLightIndex(p yesql.PreparexBuilder, ctx ...context.Context) (obj *LightIndex, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
}
obj = &LightIndex{}
if obj.UserInfo, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_LightIndex_UserInfo))); err != nil {
if obj.ListFollowings, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_ListFollowings))); err != nil {
return
}
return
}
func BuildLightIndexA(p yesql.PreparexBuilder, ctx ...context.Context) (obj *LightIndexA, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
}
obj = &LightIndexA{}
if obj.UserInfo, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_LightIndexA_UserInfo))); err != nil {
if obj.ListFollows, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_FollowingManager_ListFollows))); err != nil {
return
}
return
@ -689,34 +667,63 @@ func BuildSecurity(p yesql.PreparexBuilder, ctx ...context.Context) (obj *Securi
return
}
func BuildSimpleIndex(p yesql.PreparexBuilder, ctx ...context.Context) (obj *SimpleIndex, err error) {
func BuildShipIndex(p yesql.PreparexBuilder, ctx ...context.Context) (obj *ShipIndex, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
}
obj = &SimpleIndex{}
if obj.UserInfo, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_SimpleIndex_UserInfo))); err != nil {
obj = &ShipIndex{
IndexBySelf: p.QueryHook(_ShipIndex_IndexBySelf),
IndexCountBySelf: p.QueryHook(_ShipIndex_IndexCountBySelf),
}
if obj.IndexByAdmin, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ShipIndex_IndexByAdmin))); err != nil {
return
}
if obj.IndexByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ShipIndex_IndexByGuest))); err != nil {
return
}
if obj.IndexCountByAdmin, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ShipIndex_IndexCountByAdmin))); err != nil {
return
}
if obj.IndexCountByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_ShipIndex_IndexCountByGuest))); err != nil {
return
}
return
}
func BuildSimpleIndexA(p yesql.PreparexBuilder, ctx ...context.Context) (obj *SimpleIndexA, err error) {
func BuildShipIndexA(p yesql.PreparexBuilder) (obj *ShipIndexA, err error) {
obj = &ShipIndexA{
UserInfo: p.QueryHook(_ShipIndexA_UserInfo),
}
return
}
func BuildSimpleIndex(p yesql.PreparexBuilder, ctx ...context.Context) (obj *SimpleIndex, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
}
obj = &SimpleIndexA{}
if obj.UserInfo, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_SimpleIndexA_UserInfo))); err != nil {
obj = &SimpleIndex{}
if obj.Index, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_SimpleIndex_Index))); err != nil {
return
}
if obj.IndexCount, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_SimpleIndex_IndexCount))); err != nil {
return
}
return
}
func BuildSimpleIndexA(p yesql.PreparexBuilder) (obj *SimpleIndexA, err error) {
obj = &SimpleIndexA{
UserInfo: p.QueryHook(_SimpleIndexA_UserInfo),
}
return
}
func BuildTopicA(p yesql.PreparexBuilder, ctx ...context.Context) (obj *TopicA, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
@ -790,56 +797,87 @@ func BuildTweet(p yesql.PreparexBuilder, ctx ...context.Context) (obj *Tweet, er
if obj.GetUserPostStars, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_GetUserPostStars))); err != nil {
return
}
return
}
func BuildTweetA(p yesql.PreparexBuilder, ctx ...context.Context) (obj *TweetA, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
if obj.UserCommentTweetsByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserCommentTweetsByFriend))); err != nil {
return
}
if obj.UserCommentTweetsByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserCommentTweetsByGuest))); err != nil {
return
}
if obj.UserCommentTweetsBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserCommentTweetsBySelf))); err != nil {
return
}
if obj.UserCommentTweetsCountByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserCommentTweetsCountByFriend))); err != nil {
return
}
if obj.UserCommentTweetsCountByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserCommentTweetsCountByGuest))); err != nil {
return
}
if obj.UserCommentTweetsCountBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserCommentTweetsCountBySelf))); err != nil {
return
}
obj = &TweetA{}
if obj.AttachmentByTweetId, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetA_AttachmentByTweetId))); err != nil {
if obj.UserMediaTweetsByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserMediaTweetsByFriend))); err != nil {
return
}
if obj.FavoriteByTweetId, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetA_FavoriteByTweetId))); err != nil {
if obj.UserMediaTweetsByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserMediaTweetsByGuest))); err != nil {
return
}
if obj.ReactionByTweetId, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetA_ReactionByTweetId))); err != nil {
if obj.UserMediaTweetsBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserMediaTweetsBySelf))); err != nil {
return
}
if obj.TweetInfoById, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetA_TweetInfoById))); err != nil {
if obj.UserMediaTweetsCountByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserMediaTweetsCountByFriend))); err != nil {
return
}
if obj.TweetItemById, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetA_TweetItemById))); err != nil {
if obj.UserMediaTweetsCountByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserMediaTweetsCountByGuest))); err != nil {
return
}
if obj.UserFavorites, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetA_UserFavorites))); err != nil {
if obj.UserMediaTweetsCountBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserMediaTweetsCountBySelf))); err != nil {
return
}
if obj.UserInfo, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetA_UserInfo))); err != nil {
if obj.UserStarTweetsByAdmin, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsByAdmin))); err != nil {
return
}
if obj.UserReactions, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetA_UserReactions))); err != nil {
if obj.UserStarTweetsByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsByFriend))); err != nil {
return
}
if obj.UserTweetsByAdmin, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetA_UserTweetsByAdmin))); err != nil {
if obj.UserStarTweetsByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsByGuest))); err != nil {
return
}
if obj.UserTweetsByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetA_UserTweetsByFriend))); err != nil {
if obj.UserStarTweetsBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsBySelf))); err != nil {
return
}
if obj.UserTweetsByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetA_UserTweetsByGuest))); err != nil {
if obj.UserStarTweetsCountByAdmin, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsCountByAdmin))); err != nil {
return
}
if obj.UserTweetsBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetA_UserTweetsBySelf))); err != nil {
if obj.UserStarTweetsCountByFriend, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsCountByFriend))); err != nil {
return
}
if obj.UserStarTweetsCountByGuest, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsCountByGuest))); err != nil {
return
}
if obj.UserStarTweetsCountBySelf, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_Tweet_UserStarTweetsCountBySelf))); err != nil {
return
}
return
}
func BuildTweetA(p yesql.PreparexBuilder) (obj *TweetA, err error) {
obj = &TweetA{
AttachmentByTweetId: p.QueryHook(_TweetA_AttachmentByTweetId),
FavoriteByTweetId: p.QueryHook(_TweetA_FavoriteByTweetId),
ReactionByTweetId: p.QueryHook(_TweetA_ReactionByTweetId),
TweetInfoById: p.QueryHook(_TweetA_TweetInfoById),
TweetItemById: p.QueryHook(_TweetA_TweetItemById),
UserFavorites: p.QueryHook(_TweetA_UserFavorites),
UserInfo: p.QueryHook(_TweetA_UserInfo),
UserReactions: p.QueryHook(_TweetA_UserReactions),
UserTweetsByAdmin: p.QueryHook(_TweetA_UserTweetsByAdmin),
UserTweetsByFriend: p.QueryHook(_TweetA_UserTweetsByFriend),
UserTweetsByGuest: p.QueryHook(_TweetA_UserTweetsByGuest),
UserTweetsBySelf: p.QueryHook(_TweetA_UserTweetsBySelf),
}
return
}
func BuildTweetHelp(p yesql.PreparexBuilder) (obj *TweetHelp, err error) {
obj = &TweetHelp{
GetPostContentByIds: p.QueryHook(_TweetHelp_GetPostContentByIds),
@ -848,16 +886,9 @@ func BuildTweetHelp(p yesql.PreparexBuilder) (obj *TweetHelp, err error) {
return
}
func BuildTweetHelpA(p yesql.PreparexBuilder, ctx ...context.Context) (obj *TweetHelpA, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
}
obj = &TweetHelpA{}
if obj.UserInfo, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetHelpA_UserInfo))); err != nil {
return
func BuildTweetHelpA(p yesql.PreparexBuilder) (obj *TweetHelpA, err error) {
obj = &TweetHelpA{
UserInfo: p.QueryHook(_TweetHelpA_UserInfo),
}
return
}
@ -898,12 +929,18 @@ func BuildTweetManage(p yesql.PreparexBuilder, ctx ...context.Context) (obj *Twe
if obj.DelPostStar, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_DelPostStar))); err != nil {
return
}
if obj.HighlightPost, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_HighlightPost))); err != nil {
return
}
if obj.LockPost, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_LockPost))); err != nil {
return
}
if obj.MediaContentByPostId, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_MediaContentByPostId))); err != nil {
return
}
if obj.PostHighlightStatus, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_PostHighlightStatus))); err != nil {
return
}
if obj.StickPost, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManage_StickPost))); err != nil {
return
}
@ -922,16 +959,9 @@ func BuildTweetManage(p yesql.PreparexBuilder, ctx ...context.Context) (obj *Twe
return
}
func BuildTweetManageA(p yesql.PreparexBuilder, ctx ...context.Context) (obj *TweetManageA, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
}
obj = &TweetManageA{}
if obj.UserInfo, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_TweetManageA_UserInfo))); err != nil {
return
func BuildTweetManageA(p yesql.PreparexBuilder) (obj *TweetManageA, err error) {
obj = &TweetManageA{
UserInfo: p.QueryHook(_TweetManageA_UserInfo),
}
return
}

@ -149,6 +149,46 @@ WHERE id=? AND is_del=0;
-- prepare: stmt
INSERT INTO @following (user_id, follow_id, created_on) VALUES (?, ?, ?);
-- name: exist_following@following_manager
-- prepare: stmt
SELECT 1 FROM @following WHERE user_id=? AND follow_id=? AND is_del=0;
-- name: delete_following@following_manager
-- prepare: stmt
UPDATE @following
SET is_del=0, deleted_on=?
WHERE user_id=? AND follow_id=? AND is_del=0;
-- name: list_follows@following_manager
-- prepare: stmt
SELECT u.user_id user_id,
u.username username,
u.nickname nickname,
u.avatar avatar
FROM @following f JOIN @user u ON f.follow_id=u.id
WHERE f.user_id=? AND f.is_del=0
ORDER BY u.nickname ASC
LIMIT ? OFFSET ?;
-- name: count_follows@following_manager
-- prepare: stmt
SELECT count(*) FROM @following WHERE user_id=? AND is_del=0;
-- name: list_followings@following_manager
-- prepare: stmt
SELECT u.user_id user_id,
u.username username,
u.nickname nickname,
u.avatar avatar
FROM @following f JOIN @user u ON f.user_id=u.id
WHERE f.follow_id=? AND f.is_del=0
ORDER BY u.nickname ASC
LIMIT ? OFFSET ?;
-- name: count_followings@following_manager
-- prepare: stmt
SELECT count(*) FROM @following WHERE follow_id=? AND is_del=0;
--------------------------------------------------------------------------------
-- contact_manager sql dml
--------------------------------------------------------------------------------
@ -270,59 +310,83 @@ INSERT INTO @captcha (phone, captcha, expired_on, created_on)
VALUES (:phone, :captcha, :expired_on, :created_on);
--------------------------------------------------------------------------------
-- friend_index sql dml
-- ship_index sql dml
--------------------------------------------------------------------------------
-- name: user_info@friend_index
-- name: index_by_admin@ship_index
-- prepare: stmt
SELECT * FROM @user WHERE username=?
--------------------------------------------------------------------------------
-- follow_index sql dml
--------------------------------------------------------------------------------
SELECT *
FROM @p_post
WHERE is_del=0
ORDER BY is_top DESC, latest_replied_on DESC
LIMIT ? OFFSET ?;
-- name: user_info@follow_index
-- name: index_count_by_admin@ship_index
-- prepare: stmt
SELECT * FROM @user WHERE username=?
SELECT count(*)
FROM @p_post
WHERE is_del=0;
--------------------------------------------------------------------------------
-- light_index sql dml
--------------------------------------------------------------------------------
-- name: index_by_guest@ship_index
-- prepare: stmt
SELECT *
FROM @p_post
WHERE visibility=0 AND is_del=0
ORDER BY is_top DESC, latest_replied_on DESC
LIMIT ? OFFSET ?;
-- name: user_info@light_index
-- name: index_count_by_guest@ship_index
-- prepare: stmt
SELECT * FROM @user WHERE username=?
SELECT count(*)
FROM @p_post
WHERE visibility=0 AND is_del=0;
--------------------------------------------------------------------------------
-- simple_index sql dml
--------------------------------------------------------------------------------
-- name: index_by_self@ship_index
-- prepare: raw
-- clause: in
SELECT *
FROM @p_post
WHERE is_del=0 AND
(visibility=0 OR
(visibility=1 AND user_id=?) OR
(visibility=2 AND user_id IN ?))
ORDER BY is_top DESC, latest_replied_on DESC
LIMIT ? OFFSET ?;
-- name: user_info@simple_index
-- prepare: stmt
SELECT * FROM @user WHERE username=?
-- name: index_count_by_self@ship_index
-- prepare: raw
-- clause: in
SELECT count(*)
FROM @p_post
WHERE is_del=0 AND
(visibility=0 OR
(visibility=1 AND user_id=?) OR
(visibility=2 AND user_id IN ?));
--------------------------------------------------------------------------------
-- friend_index_a sql dml
-- simple_index sql dml
--------------------------------------------------------------------------------
-- name: user_info@friend_index_a
-- name: index@simple_index
-- prepare: stmt
SELECT * FROM @user WHERE username=?
--------------------------------------------------------------------------------
-- follow_index_a sql dml
--------------------------------------------------------------------------------
SELECT *
FROM @p_post
WHERE visibility=0
ORDER BY is_top DESC, latest_replied_on DESC
LIMIT ? OFFSET ?;
-- name: user_info@follow_index_a
-- name: index_count@simple_index
-- prepare: stmt
SELECT * FROM @user WHERE username=?
SELECT count(*)
FROM @p_post
WHERE visibility=0;
--------------------------------------------------------------------------------
-- light_index_a sql dml
-- ship_index_a sql dml
--------------------------------------------------------------------------------
-- name: user_info@light_index_a
-- prepare: stmt
-- name: user_info@ship_index_a
-- prepare: raw
SELECT * FROM @user WHERE username=?
--------------------------------------------------------------------------------
@ -330,7 +394,7 @@ SELECT * FROM @user WHERE username=?
--------------------------------------------------------------------------------
-- name: user_info@simple_index_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
--------------------------------------------------------------------------------
@ -541,6 +605,245 @@ WHERE post_id IN (?) AND is_del=0;
-- prepare: stmt
SELECT * FROM @post_content WHERE id=? AND is_del=0;
-- name: user_media_tweets_by_guest@tweet
-- prepare: stmt
SELECT *
FROM @post_by_media
WHERE is_del=0 AND user_id=? AND visibility=0
ORDER BY latest_replied_on DESC
LIMIT ? OFFSET ?;
-- name: user_media_tweets_count_by_guest@tweet
-- prepare: stmt
SELECT count(*)
FROM @post_by_media
WHERE is_del=0 AND user_id=? AND visibility=0;
-- name: user_media_tweets_by_friend@tweet
-- prepare: stmt
SELECT *
FROM @post_by_media
WHERE is_del=0 AND user_id=? AND (visibility=0 OR visibility=2)
ORDER BY latest_replied_on DESC
LIMIT ? OFFSET ?;
-- name: user_media_tweets_count_by_friend@tweet
-- prepare: stmt
SELECT count(*)
FROM @post_by_media
WHERE is_del=0 AND user_id=? AND (visibility=0 OR visibility=2);
-- name: user_media_tweets_by_self@tweet
-- prepare: stmt
SELECT *
FROM @post_by_media
WHERE is_del=0 AND user_id=?
ORDER BY latest_replied_on DESC
LIMIT ? OFFSET ?;
-- name: user_media_tweets_count_by_self@tweet
-- prepare: stmt
SELECT count(*)
FROM @post_by_media
WHERE is_del=0 AND user_id=?;
-- name: user_comment_tweets_by_guest@tweet
-- prepare: stmt
SELECT *
FROM @post_by_comment
WHERE is_del=0 AND comment_user_id=? AND visibility=0
ORDER BY latest_replied_on DESC
LIMIT ? OFFSET ?;
-- name: user_comment_tweets_count_by_guest@tweet
-- prepare: stmt
SELECT count(*)
FROM @post_by_comment
WHERE is_del=0 AND comment_user_id=? AND visibility=0;
-- name: user_comment_tweets_by_friend@tweet
-- prepare: stmt
SELECT *
FROM @post_by_comment
WHERE is_del=0 AND comment_user_id=? AND (visibility=0 OR visibility=2)
ORDER BY latest_replied_on DESC
LIMIT ? OFFSET ?;
-- name: user_comment_tweets_count_by_friend@tweet
-- prepare: stmt
SELECT count(*)
FROM @post_by_comment
WHERE is_del=0 AND comment_user_id=? AND (visibility=0 OR visibility=2);
-- name: user_comment_tweets_by_self@tweet
-- prepare: stmt
SELECT *
FROM @post_by_comment
WHERE is_del=0 AND comment_user_id=?
ORDER BY latest_replied_on DESC
LIMIT ? OFFSET ?;
-- name: user_comment_tweets_count_by_self@tweet
-- prepare: stmt
SELECT count(*)
FROM @post_by_comment
WHERE is_del=0 AND comment_user_id=?;
-- name: user_star_tweets_by_guest@tweet
-- prepare: stmt
SELECT
star.*,
post.ID "post.id",
post.created_on "post.created_on",
post.modified_on "post.modified_on",
post.deleted_on "post.deleted_on",
post.is_del "post.is_del",
post.user_id "post.user_id",
post.comment_count "post.comment_count",
post.collection_count "post.collection_count",
post.share_count "post.share_count",
post.upvote_count "post.upvote_count",
post.visibility "post.visibility",
post.is_top "post.is_top",
post.is_essence "post.is_essence",
post.is_lock "post.is_lock",
post.latest_replied_on "post.latest_replied_on",
post.tags "post.tags",
post.attachment_price "post.attachment_price",
post.ip "post.ip",
post.ip_loc "post.ip_loc"
FROM
@post_star star
JOIN @post post ON star.post_id = post.ID
WHERE
star.is_del = 0
AND star.user_id =?
AND post.visibility = 0
ORDER BY post.latest_replied_on DESC
LIMIT ? OFFSET ?;
-- name: user_star_tweets_count_by_guest@tweet
-- prepare: stmt
SELECT count(*)
FROM
@post_star star
JOIN @post post ON star.post_id = post.ID
WHERE star.is_del=0 AND star.user_id=? AND post.visibility=0;
-- name: user_star_tweets_by_friend@tweet
-- prepare: stmt
SELECT
star.*,
post.ID "post.id",
post.created_on "post.created_on",
post.modified_on "post.modified_on",
post.deleted_on "post.deleted_on",
post.is_del "post.is_del",
post.user_id "post.user_id",
post.comment_count "post.comment_count",
post.collection_count "post.collection_count",
post.share_count "post.share_count",
post.upvote_count "post.upvote_count",
post.visibility "post.visibility",
post.is_top "post.is_top",
post.is_essence "post.is_essence",
post.is_lock "post.is_lock",
post.latest_replied_on "post.latest_replied_on",
post.tags "post.tags",
post.attachment_price "post.attachment_price",
post.ip "post.ip",
post.ip_loc "post.ip_loc"
FROM
@post_star star
JOIN @post post ON star.post_id = post.ID
WHERE star.is_del=0 AND star.user_id=? AND (post.visibility=0 OR post.visibility=2)
ORDER BY post.latest_replied_on DESC
LIMIT ? OFFSET ?;
-- name: user_star_tweets_count_by_friend@tweet
-- prepare: stmt
SELECT count(*)
FROM
@post_star star
JOIN @post post ON star.post_id = post.ID
WHERE star.is_del=0 AND star.user_id=? AND (post.visibility=0 OR post.visibility=2);
-- name: user_star_tweets_by_self@tweet
-- prepare: stmt
SELECT
star.*,
post.ID "post.id",
post.created_on "post.created_on",
post.modified_on "post.modified_on",
post.deleted_on "post.deleted_on",
post.is_del "post.is_del",
post.user_id "post.user_id",
post.comment_count "post.comment_count",
post.collection_count "post.collection_count",
post.share_count "post.share_count",
post.upvote_count "post.upvote_count",
post.visibility "post.visibility",
post.is_top "post.is_top",
post.is_essence "post.is_essence",
post.is_lock "post.is_lock",
post.latest_replied_on "post.latest_replied_on",
post.tags "post.tags",
post.attachment_price "post.attachment_price",
post.ip "post.ip",
post.ip_loc "post.ip_loc"
FROM
@post_star star
JOIN @post post ON star.post_id = post.ID
WHERE star.is_del=0 AND star.user_id=? AND (post.visibility<>0 (post.visibility=0 AND post.user_id=?))
ORDER BY post.latest_replied_on DESC;
LIMIT ? OFFSET ?;
-- name: user_star_tweets_count_by_self@tweet
-- prepare: stmt
SELECT count(*)
FROM
@post_star star
JOIN @post post ON star.post_id = post.ID
WHERE star.is_del=0 AND star.user_id=? AND (post.visibility<>0 (post.visibility=0 AND post.user_id=?));
-- name: user_star_tweets_by_admin@tweet
-- prepare: stmt
SELECT
star.*,
post.ID "post.id",
post.created_on "post.created_on",
post.modified_on "post.modified_on",
post.deleted_on "post.deleted_on",
post.is_del "post.is_del",
post.user_id "post.user_id",
post.comment_count "post.comment_count",
post.collection_count "post.collection_count",
post.share_count "post.share_count",
post.upvote_count "post.upvote_count",
post.visibility "post.visibility",
post.is_top "post.is_top",
post.is_essence "post.is_essence",
post.is_lock "post.is_lock",
post.latest_replied_on "post.latest_replied_on",
post.tags "post.tags",
post.attachment_price "post.attachment_price",
post.ip "post.ip",
post.ip_loc "post.ip_loc"
FROM
@post_star star
JOIN @post post ON star.post_id = post.ID
WHERE star.is_del=0 AND star.user_id=?
ORDER BY post.latest_replied_on DESC;
LIMIT ? OFFSET ?;
-- name: user_star_tweets_count_by_admin@tweet
-- prepare: stmt
SELECT count(*)
FROM
@post_star star
JOIN @post post ON star.post_id = post.ID
WHERE star.is_del=0 AND star.user_id=?;
--------------------------------------------------------------------------------
-- tweet_manage sql dml
--------------------------------------------------------------------------------
@ -570,6 +873,14 @@ UPDATE @post SET is_top=1-is_top, modified_on=? WHERE id=? AND is_del=0;
-- prepare: stmt
UPDATE @post SET visibility=?, is_top=?, modified_on=? WHERE id=? AND is_del=0;
-- name: highlight_post@tweet_manage
-- prepare: stmt
UPDATE @post SET is_essence=1-is_essence WHERE id=? AND is_del=0;
-- name: post_highlight_status@tweet_manage
-- prepare: stmt
SELECT user_id, is_essence FROM @post WHERE id=? AND is_del=0;
-- name: update_post@tweet_manage
-- prepare: named_stmt
UPDATE @post SET comment_count=:comment_count,
@ -653,51 +964,51 @@ WHERE id IN (?) AND is_del=0;
--------------------------------------------------------------------------------
-- name: user_info@tweet_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
-- name: tweet_info_by_id@tweet_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
-- name: tweet_item_by_id@tweet_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
-- name: user_tweets_by_admin@tweet_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
-- name: user_tweets_by_self@tweet_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
-- name: user_tweets_by_friend@tweet_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
-- name: user_tweets_by_guest@tweet_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
-- name: reaction_by_tweet_id@tweet_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
-- name: user_reactions@tweet_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
-- name: favorite_by_tweet_id@tweet_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
-- name: user_favorites@tweet_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
-- name: attachment_by_tweet_id@tweet_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
--------------------------------------------------------------------------------
@ -705,7 +1016,7 @@ SELECT * FROM @user WHERE username=?
--------------------------------------------------------------------------------
-- name: user_info@tweet_manage_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
--------------------------------------------------------------------------------
@ -713,7 +1024,7 @@ SELECT * FROM @user WHERE username=?
--------------------------------------------------------------------------------
-- name: user_info@tweet_help_a
-- prepare: stmt
-- prepare: raw
SELECT * FROM @user WHERE username=?
--------------------------------------------------------------------------------

@ -32,19 +32,13 @@ func RouteWeb(e *gin.Engine) {
api.RegisterLooseServant(e, newLooseSrv(ds))
api.RegisterPrivServant(e, newPrivSrv(ds, oss))
api.RegisterPubServant(e, newPubSrv(ds))
api.RegisterFollowshipServant(e, newFollowshipSrv(ds))
api.RegisterFriendshipServant(e, newFriendshipSrv(ds))
// regster servants if needed by configure
cfg.In(cfg.Actions{
"Alipay": func() {
client := conf.MustAlipayClient()
api.RegisterAlipayPubServant(e, newAlipayPubSrv(ds))
api.RegisterAlipayPrivServant(e, newAlipayPrivSrv(ds, client))
},
"Followship": func() {
api.RegisterFollowshipServant(e, newFollowshipSrv(ds))
},
"Friendship": func() {
api.RegisterFriendshipServant(e, newFriendshipSrv(ds))
},
cfg.Be("Alipay", func() {
client := conf.MustAlipayClient()
api.RegisterAlipayPubServant(e, newAlipayPubSrv(ds))
api.RegisterAlipayPrivServant(e, newAlipayPrivSrv(ds, client))
})
}

@ -1,4 +1,4 @@
FROM golang:1.20-alpine
FROM golang:1.21-alpine
RUN apk --no-cache --no-progress add --virtual \
build-deps \
build-base \

@ -1,3 +1,3 @@
FROM alpine:3.17
FROM alpine:3.18
ENV TZ=Asia/Shanghai
RUN apk update && apk add --no-cache ca-certificates && update-ca-certificates

@ -1,5 +1,5 @@
# build frontend
FROM node:18-alpine as frontend
FROM node:19-alpine as frontend
ARG API_HOST
ARG USE_DIST=no
WORKDIR /web

@ -1 +1 @@
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-db217db0.js";import{u as a}from"./vue-router-b8e3382f.js";import{F as i,e as c,a2 as u}from"./naive-ui-62663ad7.js";import{d as l,c as d,V as t,a1 as o,o as f,e as x}from"./@vue-e0e89260.js";import{_ as g}from"./index-479e9ef6.js";import"./vuex-473b3783.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-0524c43e.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const v=l({__name:"404",setup(h){const e=a(),_=()=>{e.push({path:"/"})};return(k,w)=>{const n=s,p=c,r=u,m=i;return f(),d("div",null,[t(n,{title:"404"}),t(m,{class:"main-content-wrap wrap404",bordered:""},{default:o(()=>[t(r,{status:"404",title:"404 资源不存在",description:"再看看其他的吧"},{footer:o(()=>[t(p,{onClick:_},{default:o(()=>[x("回主页")]),_:1})]),_:1})]),_:1})])}}});const M=g(v,[["__scopeId","data-v-e62daa85"]]);export{M as default};
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-32d416c3.js";import{u as a}from"./vue-router-b8e3382f.js";import{F as i,e as c,a2 as u}from"./naive-ui-62663ad7.js";import{d as l,c as d,V as t,a1 as o,o as f,e as x}from"./@vue-e0e89260.js";import{_ as g}from"./index-152c5794.js";import"./vuex-473b3783.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-0524c43e.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const v=l({__name:"404",setup(h){const e=a(),_=()=>{e.push({path:"/"})};return(k,w)=>{const n=s,p=c,r=u,m=i;return f(),d("div",null,[t(n,{title:"404"}),t(m,{class:"main-content-wrap wrap404",bordered:""},{default:o(()=>[t(r,{status:"404",title:"404 资源不存在",description:"再看看其他的吧"},{footer:o(()=>[t(p,{onClick:_},{default:o(()=>[x("回主页")]),_:1})]),_:1})]),_:1})])}}});const M=g(v,[["__scopeId","data-v-e62daa85"]]);export{M as default};

@ -1 +1 @@
import{_ as F}from"./post-skeleton-c0397381.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-db217db0.js";import{u as V}from"./vuex-473b3783.js";import{b as z}from"./vue-router-b8e3382f.js";import{a as A}from"./formatTime-4210fcd1.js";import{d as R,r as n,j as S,c as o,V as a,a1 as p,o as e,_ as u,O as l,F as I,a4 as L,Q as M,a as s,M as _,L as O}from"./@vue-e0e89260.js";import{F as P,G as j,I as q,H as D}from"./naive-ui-62663ad7.js";import{_ as E}from"./index-479e9ef6.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-0524c43e.js";import"./moment-2ab8298d.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const G={key:0,class:"pagination-wrap"},H={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={class:"bill-line"},$=R({__name:"Anouncement",setup(J){const d=V(),g=z(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{i.value=m};return S(()=>{}),(m,K)=>{const y=N,k=j,x=F,w=q,B=D,C=P;return e(),o("div",null,[a(y,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[c.value>1?(e(),o("div",G,[a(k,{page:i.value,"onUpdate:page":h,"page-slot":u(d).state.collapsedRight?5:8,"page-count":c.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:p(()=>[v.value?(e(),o("div",H,[a(x,{num:f.value},null,8,["num"])])):(e(),o("div",Q,[r.value.length===0?(e(),o("div",T,[a(w,{size:"large",description:"暂无数据"})])):l("",!0),(e(!0),o(I,null,L(r.value,t=>(e(),M(B,{key:t.id},{default:p(()=>[s("div",U,[s("div",null,"NO."+_(t.id),1),s("div",null,_(t.reason),1),s("div",{class:O({income:t.change_amount>=0,out:t.change_amount<0})},_((t.change_amount>0?"+":"")+(t.change_amount/100).toFixed(2)),3),s("div",null,_(u(A)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const kt=E($,[["__scopeId","data-v-d4d04859"]]);export{kt as default};
import{_ as F}from"./post-skeleton-d2e839d6.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-32d416c3.js";import{u as V}from"./vuex-473b3783.js";import{b as z}from"./vue-router-b8e3382f.js";import{a as A}from"./formatTime-4210fcd1.js";import{d as R,r as n,j as S,c as o,V as a,a1 as p,o as e,_ as u,O as l,F as I,a4 as L,Q as M,a as s,M as _,L as O}from"./@vue-e0e89260.js";import{F as P,G as j,I as q,H as D}from"./naive-ui-62663ad7.js";import{_ as E}from"./index-152c5794.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-0524c43e.js";import"./moment-2ab8298d.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const G={key:0,class:"pagination-wrap"},H={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={class:"bill-line"},$=R({__name:"Anouncement",setup(J){const d=V(),g=z(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{i.value=m};return S(()=>{}),(m,K)=>{const y=N,k=j,x=F,w=q,B=D,C=P;return e(),o("div",null,[a(y,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[c.value>1?(e(),o("div",G,[a(k,{page:i.value,"onUpdate:page":h,"page-slot":u(d).state.collapsedRight?5:8,"page-count":c.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:p(()=>[v.value?(e(),o("div",H,[a(x,{num:f.value},null,8,["num"])])):(e(),o("div",Q,[r.value.length===0?(e(),o("div",T,[a(w,{size:"large",description:"暂无数据"})])):l("",!0),(e(!0),o(I,null,L(r.value,t=>(e(),M(B,{key:t.id},{default:p(()=>[s("div",U,[s("div",null,"NO."+_(t.id),1),s("div",null,_(t.reason),1),s("div",{class:O({income:t.change_amount>=0,out:t.change_amount<0})},_((t.change_amount>0?"+":"")+(t.change_amount/100).toFixed(2)),3),s("div",null,_(u(A)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const kt=E($,[["__scopeId","data-v-d4d04859"]]);export{kt as default};

@ -1 +1 @@
import{_ as N,a as P}from"./post-item.vue_vue_type_style_index_0_lang-724e3b2f.js";import{_ as S}from"./post-skeleton-c0397381.js";import{_ as V}from"./main-nav.vue_vue_type_style_index_0_lang-db217db0.js";import{u as $}from"./vuex-473b3783.js";import{b as I}from"./vue-router-b8e3382f.js";import{N as R,_ as j}from"./index-479e9ef6.js";import{d as q,r as s,j as E,c as o,V as e,a1 as c,_ as g,O as v,o as t,F as f,a4 as h,Q as k}from"./@vue-e0e89260.js";import{F as G,G as H,I as L,H as O}from"./naive-ui-62663ad7.js";import"./content-ffcf943b.js";import"./@vicons-0524c43e.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-4210fcd1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const Q={key:0,class:"skeleton-wrap"},T={key:1},U={key:0,class:"empty-wrap"},A={key:1},D={key:2},J={key:0,class:"pagination-wrap"},K=q({__name:"Collection",setup(W){const m=$(),y=I(),_=s(!1),i=s([]),p=s(+y.query.p||1),l=s(20),r=s(0),u=()=>{_.value=!0,R({page:p.value,page_size:l.value}).then(n=>{_.value=!1,i.value=n.list,r.value=Math.ceil(n.pager.total_rows/l.value),window.scrollTo(0,0)}).catch(n=>{_.value=!1})},w=n=>{p.value=n,u()};return E(()=>{u()}),(n,X)=>{const C=V,b=S,x=L,z=N,d=O,B=P,F=G,M=H;return t(),o("div",null,[e(C,{title:"收藏"}),e(F,{class:"main-content-wrap",bordered:""},{default:c(()=>[_.value?(t(),o("div",Q,[e(b,{num:l.value},null,8,["num"])])):(t(),o("div",T,[i.value.length===0?(t(),o("div",U,[e(x,{size:"large",description:"暂无数据"})])):v("",!0),g(m).state.desktopModelShow?(t(),o("div",A,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(z,{post:a},null,8,["post"])]),_:2},1024))),128))])):(t(),o("div",D,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(B,{post:a},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),r.value>0?(t(),o("div",J,[e(M,{page:p.value,"onUpdate:page":w,"page-slot":g(m).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):v("",!0)])}}});const Mt=j(K,[["__scopeId","data-v-a5302c9b"]]);export{Mt as default};
import{_ as N,a as P}from"./post-item.vue_vue_type_style_index_0_lang-25504051.js";import{_ as S}from"./post-skeleton-d2e839d6.js";import{_ as V}from"./main-nav.vue_vue_type_style_index_0_lang-32d416c3.js";import{u as $}from"./vuex-473b3783.js";import{b as I}from"./vue-router-b8e3382f.js";import{N as R,_ as j}from"./index-152c5794.js";import{d as q,r as s,j as E,c as o,V as e,a1 as c,_ as g,O as v,o as t,F as f,a4 as h,Q as k}from"./@vue-e0e89260.js";import{F as G,G as H,I as L,H as O}from"./naive-ui-62663ad7.js";import"./content-ff44e340.js";import"./@vicons-0524c43e.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-4210fcd1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const Q={key:0,class:"skeleton-wrap"},T={key:1},U={key:0,class:"empty-wrap"},A={key:1},D={key:2},J={key:0,class:"pagination-wrap"},K=q({__name:"Collection",setup(W){const m=$(),y=I(),_=s(!1),i=s([]),p=s(+y.query.p||1),l=s(20),r=s(0),u=()=>{_.value=!0,R({page:p.value,page_size:l.value}).then(n=>{_.value=!1,i.value=n.list,r.value=Math.ceil(n.pager.total_rows/l.value),window.scrollTo(0,0)}).catch(n=>{_.value=!1})},w=n=>{p.value=n,u()};return E(()=>{u()}),(n,X)=>{const C=V,b=S,x=L,z=N,d=O,B=P,F=G,M=H;return t(),o("div",null,[e(C,{title:"收藏"}),e(F,{class:"main-content-wrap",bordered:""},{default:c(()=>[_.value?(t(),o("div",Q,[e(b,{num:l.value},null,8,["num"])])):(t(),o("div",T,[i.value.length===0?(t(),o("div",U,[e(x,{size:"large",description:"暂无数据"})])):v("",!0),g(m).state.desktopModelShow?(t(),o("div",A,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(z,{post:a},null,8,["post"])]),_:2},1024))),128))])):(t(),o("div",D,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(B,{post:a},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),r.value>0?(t(),o("div",J,[e(M,{page:p.value,"onUpdate:page":w,"page-slot":g(m).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):v("",!0)])}}});const Mt=j(K,[["__scopeId","data-v-a5302c9b"]]);export{Mt as default};

@ -1 +1 @@
import{u as N,b as P}from"./vue-router-b8e3382f.js";import{d as k,o as e,c as n,a as s,V as a,M as d,r as c,j as R,a1 as f,_ as S,O as h,F as y,a4 as U,Q as q}from"./@vue-e0e89260.js";import{o as x,F as D,G as Q,I as T,H as j}from"./naive-ui-62663ad7.js";import{_ as b,Q as E}from"./index-479e9ef6.js";import{_ as G}from"./post-skeleton-c0397381.js";import{_ as H}from"./main-nav.vue_vue_type_style_index_0_lang-db217db0.js";import{u as L}from"./vuex-473b3783.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";import"./@vicons-0524c43e.js";/* empty css */const O={class:"avatar"},A={class:"base-info"},J={class:"username"},K={class:"uid"},W=k({__name:"contact-item",props:{contact:{}},setup(C){const l=N(),u=t=>{l.push({name:"user",query:{s:t}})};return(t,o)=>{const _=x;return e(),n("div",{class:"contact-item",onClick:o[0]||(o[0]=r=>u(t.contact.username))},[s("div",O,[a(_,{size:"large",src:t.contact.avatar},null,8,["src"])]),s("div",A,[s("div",J,[s("strong",null,d(t.contact.nickname),1),s("span",null," @"+d(t.contact.username),1)]),s("div",K,"UID. "+d(t.contact.user_id),1)])])}}});const X=b(W,[["__scopeId","data-v-0f1bf4ae"]]),Y={key:0,class:"skeleton-wrap"},Z={key:1},tt={key:0,class:"empty-wrap"},et={key:0,class:"pagination-wrap"},ot=k({__name:"Contacts",setup(C){const l=L(),u=P(),t=c(!1),o=c([]),_=c(+u.query.p||1),r=c(20),m=c(0),w=i=>{_.value=i,v()};R(()=>{v()});const v=(i=!1)=>{o.value.length===0&&(t.value=!0),E({page:_.value,page_size:r.value}).then(p=>{t.value=!1,o.value=p.list,m.value=Math.ceil(p.pager.total_rows/r.value),i&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(p=>{t.value=!1})};return(i,p)=>{const $=H,I=G,z=T,B=X,V=j,F=D,M=Q;return e(),n(y,null,[s("div",null,[a($,{title:"好友"}),a(F,{class:"main-content-wrap",bordered:""},{default:f(()=>[t.value?(e(),n("div",Y,[a(I,{num:r.value},null,8,["num"])])):(e(),n("div",Z,[o.value.length===0?(e(),n("div",tt,[a(z,{size:"large",description:"暂无数据"})])):h("",!0),(e(!0),n(y,null,U(o.value,g=>(e(),q(V,{key:g.user_id},{default:f(()=>[a(B,{contact:g},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),m.value>0?(e(),n("div",et,[a(M,{page:_.value,"onUpdate:page":w,"page-slot":S(l).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):h("",!0)],64)}}});const zt=b(ot,[["__scopeId","data-v-3b2bf978"]]);export{zt as default};
import{u as N,b as P}from"./vue-router-b8e3382f.js";import{d as k,o as e,c as n,a as s,V as a,M as d,r as c,j as R,a1 as f,_ as S,O as h,F as y,a4 as U,Q as q}from"./@vue-e0e89260.js";import{o as x,F as D,G as Q,I as T,H as j}from"./naive-ui-62663ad7.js";import{_ as b,Q as E}from"./index-152c5794.js";import{_ as G}from"./post-skeleton-d2e839d6.js";import{_ as H}from"./main-nav.vue_vue_type_style_index_0_lang-32d416c3.js";import{u as L}from"./vuex-473b3783.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";import"./@vicons-0524c43e.js";/* empty css */const O={class:"avatar"},A={class:"base-info"},J={class:"username"},K={class:"uid"},W=k({__name:"contact-item",props:{contact:{}},setup(C){const l=N(),u=t=>{l.push({name:"user",query:{s:t}})};return(t,o)=>{const _=x;return e(),n("div",{class:"contact-item",onClick:o[0]||(o[0]=r=>u(t.contact.username))},[s("div",O,[a(_,{size:"large",src:t.contact.avatar},null,8,["src"])]),s("div",A,[s("div",J,[s("strong",null,d(t.contact.nickname),1),s("span",null," @"+d(t.contact.username),1)]),s("div",K,"UID. "+d(t.contact.user_id),1)])])}}});const X=b(W,[["__scopeId","data-v-0f1bf4ae"]]),Y={key:0,class:"skeleton-wrap"},Z={key:1},tt={key:0,class:"empty-wrap"},et={key:0,class:"pagination-wrap"},ot=k({__name:"Contacts",setup(C){const l=L(),u=P(),t=c(!1),o=c([]),_=c(+u.query.p||1),r=c(20),m=c(0),w=i=>{_.value=i,v()};R(()=>{v()});const v=(i=!1)=>{o.value.length===0&&(t.value=!0),E({page:_.value,page_size:r.value}).then(p=>{t.value=!1,o.value=p.list,m.value=Math.ceil(p.pager.total_rows/r.value),i&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(p=>{t.value=!1})};return(i,p)=>{const $=H,I=G,z=T,B=X,V=j,F=D,M=Q;return e(),n(y,null,[s("div",null,[a($,{title:"好友"}),a(F,{class:"main-content-wrap",bordered:""},{default:f(()=>[t.value?(e(),n("div",Y,[a(I,{num:r.value},null,8,["num"])])):(e(),n("div",Z,[o.value.length===0?(e(),n("div",tt,[a(z,{size:"large",description:"暂无数据"})])):h("",!0),(e(!0),n(y,null,U(o.value,g=>(e(),q(V,{key:g.user_id},{default:f(()=>[a(B,{contact:g},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),m.value>0?(e(),n("div",et,[a(M,{page:_.value,"onUpdate:page":w,"page-slot":S(l).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):h("",!0)],64)}}});const zt=b(ot,[["__scopeId","data-v-3b2bf978"]]);export{zt as default};

@ -1 +1 @@
import{u as j,b as E}from"./vue-router-b8e3382f.js";import{d as q,o as s,c as l,a as _,V as o,M as h,r as c,j as G,_ as F,a1 as y,O as $,F as U,a4 as H,Q as L}from"./@vue-e0e89260.js";import{o as O,F as Q,G as A,f as J,g as K,I as W,H as X}from"./naive-ui-62663ad7.js";import{_ as z,R as Y,S as Z}from"./index-479e9ef6.js";import{_ as ee}from"./post-skeleton-c0397381.js";import{_ as oe}from"./main-nav.vue_vue_type_style_index_0_lang-db217db0.js";import{u as te}from"./vuex-473b3783.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";import"./@vicons-0524c43e.js";/* empty css */const ne={class:"avatar"},ae={class:"base-info"},se={class:"username"},le={class:"uid"},_e=q({__name:"follow-item",props:{contact:{}},setup(I){const v=j(),u=e=>{v.push({name:"user",query:{s:e}})};return(e,t)=>{const g=O;return s(),l("div",{class:"follow-item",onClick:t[0]||(t[0]=f=>u(e.contact.username))},[_("div",ne,[o(g,{size:"large",src:e.contact.avatar},null,8,["src"])]),_("div",ae,[_("div",se,[_("strong",null,h(e.contact.nickname),1),_("span",null," @"+h(e.contact.username),1)]),_("div",le,"UID. "+h(e.contact.user_id),1)])])}}});const ue=z(_e,[["__scopeId","data-v-6e07cba3"]]),ce={key:0,class:"skeleton-wrap"},ie={key:1},re={key:0,class:"empty-wrap"},pe={key:0,class:"pagination-wrap"},me=q({__name:"Following",setup(I){const v=te(),u=E(),e=c(!1),t=c([]),g=u.query.n||"粉丝详情",f=u.query.s||"",r=c(u.query.t||"follows"),p=c(+u.query.p||1),i=c(20),m=c(0),T=a=>{p.value=a,w()},B=a=>{r.value=a,w()},w=()=>{r.value==="follows"?C(f):r.value==="followings"&&M(f)},C=(a,d=!1)=>{t.value.length===0&&(e.value=!0),Y({username:a,page:p.value,page_size:i.value}).then(n=>{e.value=!1,t.value=n.list||[],m.value=Math.ceil(n.pager.total_rows/i.value),d&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(n=>{e.value=!1})},M=(a,d=!1)=>{t.value.length===0&&(e.value=!0),Z({username:a,page:p.value,page_size:i.value}).then(n=>{e.value=!1,t.value=n.list||[],m.value=Math.ceil(n.pager.total_rows/i.value),d&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(n=>{e.value=!1})};return G(()=>{w()}),(a,d)=>{const n=oe,k=J,P=K,R=ee,S=W,V=ue,N=X,x=Q,D=A;return s(),l(U,null,[_("div",null,[o(n,{title:F(g),back:!0},null,8,["title"]),o(x,{class:"main-content-wrap",bordered:""},{default:y(()=>[o(P,{type:"line",animated:"","default-value":r.value,"onUpdate:value":B},{default:y(()=>[o(k,{name:"follows",tab:"正在关注"}),o(k,{name:"followings",tab:"我的粉丝"})]),_:1},8,["default-value"]),e.value?(s(),l("div",ce,[o(R,{num:i.value},null,8,["num"])])):(s(),l("div",ie,[t.value.length===0?(s(),l("div",re,[o(S,{size:"large",description:"暂无数据"})])):$("",!0),(s(!0),l(U,null,H(t.value,b=>(s(),L(N,{key:b.user_id},{default:y(()=>[o(V,{contact:b},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),m.value>0?(s(),l("div",pe,[o(D,{page:p.value,"onUpdate:page":T,"page-slot":F(v).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):$("",!0)],64)}}});const Ne=z(me,[["__scopeId","data-v-1f0f223d"]]);export{Ne as default};
import{u as j,b as E}from"./vue-router-b8e3382f.js";import{d as q,o as s,c as l,a as _,V as o,M as h,r as c,j as G,_ as F,a1 as y,O as $,F as U,a4 as H,Q as L}from"./@vue-e0e89260.js";import{o as O,F as Q,G as A,f as J,g as K,I as W,H as X}from"./naive-ui-62663ad7.js";import{_ as z,R as Y,S as Z}from"./index-152c5794.js";import{_ as ee}from"./post-skeleton-d2e839d6.js";import{_ as oe}from"./main-nav.vue_vue_type_style_index_0_lang-32d416c3.js";import{u as te}from"./vuex-473b3783.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";import"./@vicons-0524c43e.js";/* empty css */const ne={class:"avatar"},ae={class:"base-info"},se={class:"username"},le={class:"uid"},_e=q({__name:"follow-item",props:{contact:{}},setup(I){const v=j(),u=e=>{v.push({name:"user",query:{s:e}})};return(e,t)=>{const g=O;return s(),l("div",{class:"follow-item",onClick:t[0]||(t[0]=f=>u(e.contact.username))},[_("div",ne,[o(g,{size:"large",src:e.contact.avatar},null,8,["src"])]),_("div",ae,[_("div",se,[_("strong",null,h(e.contact.nickname),1),_("span",null," @"+h(e.contact.username),1)]),_("div",le,"UID. "+h(e.contact.user_id),1)])])}}});const ue=z(_e,[["__scopeId","data-v-6e07cba3"]]),ce={key:0,class:"skeleton-wrap"},ie={key:1},re={key:0,class:"empty-wrap"},pe={key:0,class:"pagination-wrap"},me=q({__name:"Following",setup(I){const v=te(),u=E(),e=c(!1),t=c([]),g=u.query.n||"粉丝详情",f=u.query.s||"",r=c(u.query.t||"follows"),p=c(+u.query.p||1),i=c(20),m=c(0),T=a=>{p.value=a,w()},B=a=>{r.value=a,w()},w=()=>{r.value==="follows"?C(f):r.value==="followings"&&M(f)},C=(a,d=!1)=>{t.value.length===0&&(e.value=!0),Y({username:a,page:p.value,page_size:i.value}).then(n=>{e.value=!1,t.value=n.list||[],m.value=Math.ceil(n.pager.total_rows/i.value),d&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(n=>{e.value=!1})},M=(a,d=!1)=>{t.value.length===0&&(e.value=!0),Z({username:a,page:p.value,page_size:i.value}).then(n=>{e.value=!1,t.value=n.list||[],m.value=Math.ceil(n.pager.total_rows/i.value),d&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(n=>{e.value=!1})};return G(()=>{w()}),(a,d)=>{const n=oe,k=J,P=K,R=ee,S=W,V=ue,N=X,x=Q,D=A;return s(),l(U,null,[_("div",null,[o(n,{title:F(g),back:!0},null,8,["title"]),o(x,{class:"main-content-wrap",bordered:""},{default:y(()=>[o(P,{type:"line",animated:"","default-value":r.value,"onUpdate:value":B},{default:y(()=>[o(k,{name:"follows",tab:"正在关注"}),o(k,{name:"followings",tab:"我的粉丝"})]),_:1},8,["default-value"]),e.value?(s(),l("div",ce,[o(R,{num:i.value},null,8,["num"])])):(s(),l("div",ie,[t.value.length===0?(s(),l("div",re,[o(S,{size:"large",description:"暂无数据"})])):$("",!0),(s(!0),l(U,null,H(t.value,b=>(s(),L(N,{key:b.user_id},{default:y(()=>[o(V,{contact:b},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),m.value>0?(s(),l("div",pe,[o(D,{page:p.value,"onUpdate:page":T,"page-slot":F(v).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):$("",!0)],64)}}});const Ne=z(me,[["__scopeId","data-v-1f0f223d"]]);export{Ne as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
.profile-baseinfo[data-v-8ca59137]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-8ca59137]{width:72px}.profile-baseinfo .base-info[data-v-8ca59137]{position:relative;margin-left:12px;width:calc(100% - 84px)}.profile-baseinfo .base-info .username[data-v-8ca59137]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .userinfo[data-v-8ca59137]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .userinfo .info-item[data-v-8ca59137]{margin-right:12px}.profile-baseinfo .base-info .top-tag[data-v-8ca59137]{transform:scale(.75)}.profile-tabs-wrap[data-v-8ca59137]{padding:0 16px}.pagination-wrap[data-v-8ca59137]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-baseinfo[data-v-8ca59137]{background-color:#18181c}.dark .profile-wrap[data-v-8ca59137],.dark .pagination-wrap[data-v-8ca59137]{background-color:#101014bf}

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
.profile-baseinfo[data-v-79a284ce]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-79a284ce]{width:72px}.profile-baseinfo .base-info[data-v-79a284ce]{position:relative;margin-left:12px;width:calc(100% - 84px)}.profile-baseinfo .base-info .username[data-v-79a284ce]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .userinfo[data-v-79a284ce]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .userinfo .info-item[data-v-79a284ce]{margin-right:12px}.profile-baseinfo .base-info .top-tag[data-v-79a284ce]{transform:scale(.75)}.profile-tabs-wrap[data-v-79a284ce]{padding:0 16px}.pagination-wrap[data-v-79a284ce]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-wrap[data-v-79a284ce],.dark .pagination-wrap[data-v-79a284ce]{background-color:#101014bf}

File diff suppressed because one or more lines are too long

@ -1 +1 @@
import{x as $,y as z,z as I,A as j,_ as E}from"./index-479e9ef6.js";import{v as U}from"./@vicons-0524c43e.js";import{d as F,r as i,n as A,j as q,a3 as x,o as c,c as _,V as n,a1 as s,Q as b,e as V,M as f,O as u,_ as h,w as D,a7 as P,F as Q,a4 as G}from"./@vue-e0e89260.js";import{o as H,O as B,j as J,e as K,P as R,M as W,F as X,f as Y,g as Z,a as ee,k as oe}from"./naive-ui-62663ad7.js";import{_ as te}from"./main-nav.vue_vue_type_style_index_0_lang-db217db0.js";import{u as ne}from"./vuex-473b3783.js";import"./vue-router-b8e3382f.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const se={key:0,class:"tag-item"},ae={key:0,class:"tag-quote"},ce={key:1,class:"tag-quote tag-follow"},le={key:0,class:"options"},ie=F({__name:"tag-item",props:{tag:{},showAction:{type:Boolean},checkFollowing:{type:Boolean}},setup(T){const t=T,r=i(!1),m=A(()=>{let e=[];return t.tag.is_following===0?e.push({label:"关注",key:"follow"}):(t.tag.is_top===0?e.push({label:"置顶",key:"stick"}):e.push({label:"取消置顶",key:"unstick"}),e.push({label:"取消关注",key:"unfollow"})),e}),l=e=>{switch(e){case"follow":I({topic_id:t.tag.id}).then(o=>{t.tag.is_following=1,window.$message.success("关注成功")}).catch(o=>{console.log(o)});break;case"unfollow":z({topic_id:t.tag.id}).then(o=>{t.tag.is_following=0,window.$message.success("取消关注")}).catch(o=>{console.log(o)});break;case"stick":$({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("置顶成功")}).catch(o=>{console.log(o)});break;case"unstick":$({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("取消置顶")}).catch(o=>{console.log(o)});break}};return q(()=>{r.value=!1}),(e,o)=>{const w=x("router-link"),g=H,k=B,a=J,d=K,v=R,p=W;return!e.checkFollowing||e.checkFollowing&&e.tag.is_following===1?(c(),_("div",se,[n(p,null,{header:s(()=>[(c(),b(k,{type:"success",size:"large",round:"",key:e.tag.id},{avatar:s(()=>[n(g,{src:e.tag.user.avatar},null,8,["src"])]),default:s(()=>[n(w,{class:"hash-link",to:{name:"home",query:{q:e.tag.tag,t:"tag"}}},{default:s(()=>[V(" #"+f(e.tag.tag),1)]),_:1},8,["to"]),e.showAction?u("",!0):(c(),_("span",ae,"("+f(e.tag.quote_num)+")",1)),e.showAction?(c(),_("span",ce,"("+f(e.tag.quote_num)+")",1)):u("",!0)]),_:1}))]),"header-extra":s(()=>[e.showAction?(c(),_("div",le,[n(v,{placement:"bottom-end",trigger:"click",size:"small",options:m.value,onSelect:l},{default:s(()=>[n(d,{type:"success",quaternary:"",circle:"",block:""},{icon:s(()=>[n(a,null,{default:s(()=>[n(h(U))]),_:1})]),_:1})]),_:1},8,["options"])])):u("",!0)]),_:1})])):u("",!0)}}});const _e=F({__name:"Topic",setup(T){const t=ne(),r=i([]),m=i("hot"),l=i(!1),e=i(!1),o=i(!1);D(e,()=>{e.value||(window.$message.success("保存成功"),t.commit("refreshTopicFollow"))});const w=A({get:()=>{let a="编辑";return e.value&&(a="保存"),a},set:a=>{}}),g=()=>{l.value=!0,j({type:m.value,num:50}).then(a=>{r.value=a.topics,l.value=!1}).catch(a=>{console.log(a),l.value=!1})},k=a=>{m.value=a,a=="follow"?o.value=!0:o.value=!1,g()};return q(()=>{g()}),(a,d)=>{const v=te,p=Y,C=B,L=Z,M=ie,N=ee,O=oe,S=X;return c(),_("div",null,[n(v,{title:"话题"}),n(S,{class:"main-content-wrap tags-wrap",bordered:""},{default:s(()=>[n(L,{type:"line",animated:"","onUpdate:value":k},P({default:s(()=>[n(p,{name:"hot",tab:"热门"}),n(p,{name:"new",tab:"最新"}),h(t).state.userLogined?(c(),b(p,{key:0,name:"follow",tab:"关注"})):u("",!0)]),_:2},[h(t).state.userLogined?{name:"suffix",fn:s(()=>[n(C,{checked:e.value,"onUpdate:checked":d[0]||(d[0]=y=>e.value=y),checkable:""},{default:s(()=>[V(f(w.value),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(O,{show:l.value},{default:s(()=>[n(N,null,{default:s(()=>[(c(!0),_(Q,null,G(r.value,y=>(c(),b(M,{tag:y,showAction:h(t).state.userLogined&&e.value,checkFollowing:o.value},null,8,["tag","showAction","checkFollowing"]))),256))]),_:1})]),_:1},8,["show"])]),_:1})])}}});const Me=E(_e,[["__scopeId","data-v-1fb31ecf"]]);export{Me as default};
import{x as $,y as z,z as I,A as j,_ as E}from"./index-152c5794.js";import{v as U}from"./@vicons-0524c43e.js";import{d as F,r as i,n as A,j as q,a3 as x,o as c,c as _,V as n,a1 as s,Q as b,e as V,M as f,O as u,_ as h,w as D,a7 as P,F as Q,a4 as G}from"./@vue-e0e89260.js";import{o as H,O as B,j as J,e as K,P as R,M as W,F as X,f as Y,g as Z,a as ee,k as oe}from"./naive-ui-62663ad7.js";import{_ as te}from"./main-nav.vue_vue_type_style_index_0_lang-32d416c3.js";import{u as ne}from"./vuex-473b3783.js";import"./vue-router-b8e3382f.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const se={key:0,class:"tag-item"},ae={key:0,class:"tag-quote"},ce={key:1,class:"tag-quote tag-follow"},le={key:0,class:"options"},ie=F({__name:"tag-item",props:{tag:{},showAction:{type:Boolean},checkFollowing:{type:Boolean}},setup(T){const t=T,r=i(!1),m=A(()=>{let e=[];return t.tag.is_following===0?e.push({label:"关注",key:"follow"}):(t.tag.is_top===0?e.push({label:"置顶",key:"stick"}):e.push({label:"取消置顶",key:"unstick"}),e.push({label:"取消关注",key:"unfollow"})),e}),l=e=>{switch(e){case"follow":I({topic_id:t.tag.id}).then(o=>{t.tag.is_following=1,window.$message.success("关注成功")}).catch(o=>{console.log(o)});break;case"unfollow":z({topic_id:t.tag.id}).then(o=>{t.tag.is_following=0,window.$message.success("取消关注")}).catch(o=>{console.log(o)});break;case"stick":$({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("置顶成功")}).catch(o=>{console.log(o)});break;case"unstick":$({topic_id:t.tag.id}).then(o=>{t.tag.is_top=o.top_status,window.$message.success("取消置顶")}).catch(o=>{console.log(o)});break}};return q(()=>{r.value=!1}),(e,o)=>{const w=x("router-link"),g=H,k=B,a=J,d=K,v=R,p=W;return!e.checkFollowing||e.checkFollowing&&e.tag.is_following===1?(c(),_("div",se,[n(p,null,{header:s(()=>[(c(),b(k,{type:"success",size:"large",round:"",key:e.tag.id},{avatar:s(()=>[n(g,{src:e.tag.user.avatar},null,8,["src"])]),default:s(()=>[n(w,{class:"hash-link",to:{name:"home",query:{q:e.tag.tag,t:"tag"}}},{default:s(()=>[V(" #"+f(e.tag.tag),1)]),_:1},8,["to"]),e.showAction?u("",!0):(c(),_("span",ae,"("+f(e.tag.quote_num)+")",1)),e.showAction?(c(),_("span",ce,"("+f(e.tag.quote_num)+")",1)):u("",!0)]),_:1}))]),"header-extra":s(()=>[e.showAction?(c(),_("div",le,[n(v,{placement:"bottom-end",trigger:"click",size:"small",options:m.value,onSelect:l},{default:s(()=>[n(d,{type:"success",quaternary:"",circle:"",block:""},{icon:s(()=>[n(a,null,{default:s(()=>[n(h(U))]),_:1})]),_:1})]),_:1},8,["options"])])):u("",!0)]),_:1})])):u("",!0)}}});const _e=F({__name:"Topic",setup(T){const t=ne(),r=i([]),m=i("hot"),l=i(!1),e=i(!1),o=i(!1);D(e,()=>{e.value||(window.$message.success("保存成功"),t.commit("refreshTopicFollow"))});const w=A({get:()=>{let a="编辑";return e.value&&(a="保存"),a},set:a=>{}}),g=()=>{l.value=!0,j({type:m.value,num:50}).then(a=>{r.value=a.topics,l.value=!1}).catch(a=>{console.log(a),l.value=!1})},k=a=>{m.value=a,a=="follow"?o.value=!0:o.value=!1,g()};return q(()=>{g()}),(a,d)=>{const v=te,p=Y,C=B,L=Z,M=ie,N=ee,O=oe,S=X;return c(),_("div",null,[n(v,{title:"话题"}),n(S,{class:"main-content-wrap tags-wrap",bordered:""},{default:s(()=>[n(L,{type:"line",animated:"","onUpdate:value":k},P({default:s(()=>[n(p,{name:"hot",tab:"热门"}),n(p,{name:"new",tab:"最新"}),h(t).state.userLogined?(c(),b(p,{key:0,name:"follow",tab:"关注"})):u("",!0)]),_:2},[h(t).state.userLogined?{name:"suffix",fn:s(()=>[n(C,{checked:e.value,"onUpdate:checked":d[0]||(d[0]=y=>e.value=y),checkable:""},{default:s(()=>[V(f(w.value),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(O,{show:l.value},{default:s(()=>[n(N,null,{default:s(()=>[(c(!0),_(Q,null,G(r.value,y=>(c(),b(M,{tag:y,showAction:h(t).state.userLogined&&e.value,checkFollowing:o.value},null,8,["tag","showAction","checkFollowing"]))),256))]),_:1})]),_:1},8,["show"])]),_:1})])}}});const Me=E(_e,[["__scopeId","data-v-1fb31ecf"]]);export{Me as default};

@ -0,0 +1 @@
.whisper-wrap .whisper-line[data-v-0cbfe47c]{margin-top:10px}.whisper-wrap .whisper-line.send-wrap .n-button[data-v-0cbfe47c]{width:100%}.dark .whisper-wrap[data-v-0cbfe47c]{background-color:#101014bf}.whisper-wrap .whisper-line[data-v-60be56a2]{margin-top:10px}.whisper-wrap .whisper-line.send-wrap .n-button[data-v-60be56a2]{width:100%}.dark .whisper-wrap[data-v-60be56a2]{background-color:#101014bf}.profile-tabs-wrap[data-v-42bb9831]{padding:0 16px}.profile-baseinfo[data-v-42bb9831]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-42bb9831]{width:72px}.profile-baseinfo .base-info[data-v-42bb9831]{position:relative;margin-left:12px;width:calc(100% - 84px)}.profile-baseinfo .base-info .username[data-v-42bb9831]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .userinfo[data-v-42bb9831]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .userinfo .info-item[data-v-42bb9831]{margin-right:12px}.profile-baseinfo .base-info .top-tag[data-v-42bb9831]{transform:scale(.75)}.profile-baseinfo .user-opts[data-v-42bb9831]{position:absolute;top:16px;right:16px;opacity:.75}.pagination-wrap[data-v-42bb9831]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-wrap[data-v-42bb9831],.dark .pagination-wrap[data-v-42bb9831]{background-color:#101014bf}

@ -1 +0,0 @@
.whisper-wrap .whisper-line[data-v-0cbfe47c]{margin-top:10px}.whisper-wrap .whisper-line.send-wrap .n-button[data-v-0cbfe47c]{width:100%}.dark .whisper-wrap[data-v-0cbfe47c]{background-color:#101014bf}.whisper-wrap .whisper-line[data-v-60be56a2]{margin-top:10px}.whisper-wrap .whisper-line.send-wrap .n-button[data-v-60be56a2]{width:100%}.dark .whisper-wrap[data-v-60be56a2]{background-color:#101014bf}.profile-tabs-wrap[data-v-5e39b9c4]{padding:0 16px}.profile-baseinfo[data-v-5e39b9c4]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-5e39b9c4]{width:72px}.profile-baseinfo .base-info[data-v-5e39b9c4]{position:relative;margin-left:12px;width:calc(100% - 84px)}.profile-baseinfo .base-info .username[data-v-5e39b9c4]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .userinfo[data-v-5e39b9c4]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .userinfo .info-item[data-v-5e39b9c4]{margin-right:12px}.profile-baseinfo .base-info .top-tag[data-v-5e39b9c4]{transform:scale(.75)}.profile-baseinfo .user-opts[data-v-5e39b9c4]{position:absolute;top:16px;right:16px;opacity:.75}.pagination-wrap[data-v-5e39b9c4]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-baseinfo[data-v-5e39b9c4]{background-color:#18181c}.dark .profile-wrap[data-v-5e39b9c4],.dark .pagination-wrap[data-v-5e39b9c4]{background-color:#101014bf}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
import{a3 as E}from"./index-479e9ef6.js";import{u as S}from"./vuex-473b3783.js";import{u as z}from"./vue-router-b8e3382f.js";import{j as A}from"./vooks-a50491fd.js";import{Y as C,Z as N,_ as P,$ as D}from"./@vicons-0524c43e.js";import{a3 as R,a4 as V,j as I,e as j,a5 as x,h as H}from"./naive-ui-62663ad7.js";import{d as $,r as h,j as q,o as a,c as f,_ as o,V as e,a1 as t,O as c,a as F,Q as _,e as L,M as U,F as Q}from"./@vue-e0e89260.js";const Y={key:0},Z={class:"navbar"},oe=$({__name:"main-nav",props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(g){const i=g,n=S(),m=z(),l=h(!1),k=h("left"),u=s=>{s?(localStorage.setItem("PAOPAO_THEME","dark"),n.commit("triggerTheme","dark")):(localStorage.setItem("PAOPAO_THEME","light"),n.commit("triggerTheme","light"))},w=()=>{window.history.length<=1?m.push({path:"/"}):m.go(-1)},v=()=>{l.value=!0};return q(()=>{localStorage.getItem("PAOPAO_THEME")||u(A()==="dark")}),(s,d)=>{const y=E,b=R,O=V,r=I,p=j,M=x,T=H;return a(),f(Q,null,[o(n).state.drawerModelShow?(a(),f("div",Y,[e(O,{show:l.value,"onUpdate:show":d[0]||(d[0]=B=>l.value=B),width:212,placement:k.value,resizable:""},{default:t(()=>[e(b,null,{default:t(()=>[e(y)]),_:1})]),_:1},8,["show","placement"])])):c("",!0),e(T,{size:"small",bordered:!0,class:"nav-title-card"},{header:t(()=>[F("div",Z,[o(n).state.drawerModelShow&&!s.back?(a(),_(p,{key:0,class:"drawer-btn",onClick:v,quaternary:"",circle:"",size:"medium"},{icon:t(()=>[e(r,null,{default:t(()=>[e(o(C))]),_:1})]),_:1})):c("",!0),s.back?(a(),_(p,{key:1,class:"back-btn",onClick:w,quaternary:"",circle:"",size:"small"},{icon:t(()=>[e(r,null,{default:t(()=>[e(o(N))]),_:1})]),_:1})):c("",!0),L(" "+U(i.title)+" ",1),i.theme?(a(),_(M,{key:2,value:o(n).state.theme==="dark","onUpdate:value":u,size:"small",class:"theme-switch-wrap"},{"checked-icon":t(()=>[e(r,{component:o(P)},null,8,["component"])]),"unchecked-icon":t(()=>[e(r,{component:o(D)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{oe as _};
import{a3 as E}from"./index-152c5794.js";import{u as S}from"./vuex-473b3783.js";import{u as z}from"./vue-router-b8e3382f.js";import{j as A}from"./vooks-a50491fd.js";import{Y as C,Z as N,_ as P,$ as D}from"./@vicons-0524c43e.js";import{a3 as R,a4 as V,j as I,e as j,a5 as x,h as H}from"./naive-ui-62663ad7.js";import{d as $,r as h,j as q,o as a,c as f,_ as o,V as e,a1 as t,O as c,a as F,Q as _,e as L,M as U,F as Q}from"./@vue-e0e89260.js";const Y={key:0},Z={class:"navbar"},oe=$({__name:"main-nav",props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(g){const i=g,n=S(),m=z(),l=h(!1),k=h("left"),u=s=>{s?(localStorage.setItem("PAOPAO_THEME","dark"),n.commit("triggerTheme","dark")):(localStorage.setItem("PAOPAO_THEME","light"),n.commit("triggerTheme","light"))},w=()=>{window.history.length<=1?m.push({path:"/"}):m.go(-1)},v=()=>{l.value=!0};return q(()=>{localStorage.getItem("PAOPAO_THEME")||u(A()==="dark")}),(s,d)=>{const y=E,b=R,O=V,r=I,p=j,M=x,T=H;return a(),f(Q,null,[o(n).state.drawerModelShow?(a(),f("div",Y,[e(O,{show:l.value,"onUpdate:show":d[0]||(d[0]=B=>l.value=B),width:212,placement:k.value,resizable:""},{default:t(()=>[e(b,null,{default:t(()=>[e(y)]),_:1})]),_:1},8,["show","placement"])])):c("",!0),e(T,{size:"small",bordered:!0,class:"nav-title-card"},{header:t(()=>[F("div",Z,[o(n).state.drawerModelShow&&!s.back?(a(),_(p,{key:0,class:"drawer-btn",onClick:v,quaternary:"",circle:"",size:"medium"},{icon:t(()=>[e(r,null,{default:t(()=>[e(o(C))]),_:1})]),_:1})):c("",!0),s.back?(a(),_(p,{key:1,class:"back-btn",onClick:w,quaternary:"",circle:"",size:"small"},{icon:t(()=>[e(r,null,{default:t(()=>[e(o(N))]),_:1})]),_:1})):c("",!0),L(" "+U(i.title)+" ",1),i.theme?(a(),_(M,{key:2,value:o(n).state.theme==="dark","onUpdate:value":u,size:"small",class:"theme-switch-wrap"},{"checked-icon":t(()=>[e(r,{component:o(P)},null,8,["component"])]),"unchecked-icon":t(()=>[e(r,{component:o(D)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{oe as _};

@ -1 +1 @@
import{U as r}from"./naive-ui-62663ad7.js";import{d as c,o as s,c as n,a4 as p,a as o,V as t,F as l}from"./@vue-e0e89260.js";import{_ as i}from"./index-479e9ef6.js";const m={class:"user"},d={class:"content"},u=c({__name:"post-skeleton",props:{num:{default:1}},setup(f){return(_,k)=>{const e=r;return s(!0),n(l,null,p(new Array(_.num),a=>(s(),n("div",{class:"skeleton-item",key:a},[o("div",m,[t(e,{circle:"",size:"small"})]),o("div",d,[t(e,{text:"",repeat:3}),t(e,{text:"",style:{width:"60%"}})])]))),128)}}});const b=i(u,[["__scopeId","data-v-ab0015b4"]]);export{b as _};
import{U as r}from"./naive-ui-62663ad7.js";import{d as c,o as s,c as n,a4 as p,a as o,V as t,F as l}from"./@vue-e0e89260.js";import{_ as i}from"./index-152c5794.js";const m={class:"user"},d={class:"content"},u=c({__name:"post-skeleton",props:{num:{default:1}},setup(f){return(_,k)=>{const e=r;return s(!0),n(l,null,p(new Array(_.num),a=>(s(),n("div",{class:"skeleton-item",key:a},[o("div",m,[t(e,{circle:"",size:"small"})]),o("div",d,[t(e,{text:"",repeat:3}),t(e,{text:"",style:{width:"60%"}})])]))),128)}}});const b=i(u,[["__scopeId","data-v-ab0015b4"]]);export{b as _};

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0" />
<link rel="manifest" href="/manifest.json" />
<title></title>
<script type="module" crossorigin src="/assets/index-479e9ef6.js"></script>
<script type="module" crossorigin src="/assets/index-152c5794.js"></script>
<link rel="modulepreload" crossorigin href="/assets/@vue-e0e89260.js">
<link rel="modulepreload" crossorigin href="/assets/vue-router-b8e3382f.js">
<link rel="modulepreload" crossorigin href="/assets/vuex-473b3783.js">

@ -357,9 +357,6 @@ watch(
overflow: hidden;
}
.dark {
.profile-baseinfo {
background-color: #18181c;
}
.profile-wrap, .pagination-wrap {
background-color: rgba(16, 16, 20, 0.75);
}

@ -18,6 +18,11 @@
class="top-tag" type="info" size="small" round>
</n-tag>
<n-tag
v-if="store.state.userInfo.id > 0 && store.state.userInfo.username != user.username && user.is_following"
class="top-tag" type="success" size="small" round>
</n-tag>
<n-tag v-if="user.is_admin" class="top-tag" type="error" size="small" round>
</n-tag>
@ -615,9 +620,6 @@ onMounted(() => {
overflow: hidden;
}
.dark {
.profile-baseinfo {
background-color: #18181c;
}
.profile-wrap, .pagination-wrap {
background-color: rgba(16, 16, 20, 0.75);
}

Loading…
Cancel
Save