merge from r/paopao-ce-plus branch

r/paopao-ce-xtra
Michael Li 1 year ago
commit 874c6434f6
No known key found for this signature in database

@ -7,6 +7,9 @@
"request": "launch",
"mode": "exec",
"program": "${workspaceFolder}/.vscode/__debug_bin",
"args":[
"serve"
],
"preLaunchTask": "go: build (debug)",
"cwd": "${workspaceFolder}"
}

@ -7,13 +7,29 @@ All notable changes to paopao-ce are documented in this file.
- use compiler profile-guided optimization (PGO) to further optimize builds. [#327](https://github.com/rocboss/paopao-ce/pull/327)
- frontend: re-add stars page embed to profile page. [#339](https://github.com/rocboss/paopao-ce/pull/339)
- simple support for user posts filter by style(post/comment/media/star). [#345](https://github.com/rocboss/paopao-ce/pull/345)
mirgration database first(sql ddl file in `scripts/migration/**/*_create_view_post_filter.up.sql`):
```sql
CREATE VIEW p_post_by_media AS SELECT post.*FROM (SELECT DISTINCT post_id FROM p_post_content WHERE (TYPE=3 OR TYPE=4 OR TYPE=7 OR TYPE=8) AND is_del=0) media JOIN p_post post ON media.post_id=post.ID WHERE post.is_del=0;
CREATE VIEW p_post_by_comment AS SELECT P.*,C.user_id comment_user_id FROM (SELECT post_id,user_id FROM p_comment WHERE is_del=0 UNION SELECT post_id,reply.user_id user_id FROM p_comment_reply reply JOIN p_comment COMMENT ON reply.comment_id=COMMENT.ID WHERE reply.is_del=0 AND COMMENT.is_del=0) C JOIN p_post P ON C.post_id=P.ID WHERE P.is_del=0;
```
migration database first(sql ddl file in `scripts/migration/**/*_create_view_post_filter.up.sql`):
```sql
CREATE VIEW p_post_by_media AS SELECT post.*FROM (SELECT DISTINCT post_id FROM p_post_content WHERE (TYPE=3 OR TYPE=4 OR TYPE=7 OR TYPE=8) AND is_del=0) media JOIN p_post post ON media.post_id=post.ID WHERE post.is_del=0;
CREATE VIEW p_post_by_comment AS SELECT P.*,C.user_id comment_user_id FROM (SELECT post_id,user_id FROM p_comment WHERE is_del=0 UNION SELECT post_id,reply.user_id user_id FROM p_comment_reply reply JOIN p_comment COMMENT ON reply.comment_id=COMMENT.ID WHERE reply.is_del=0 AND COMMENT.is_del=0) C JOIN p_post P ON C.post_id=P.ID WHERE P.is_del=0;
```
- add user highlight tweet support include custom tweet set to highlight and list in user/profile page.
- add cli subcommand to start paopao-ce serve or other task. [#354](https://github.com/rocboss/paopao-ce/pull/354)
- add `Friendship` feature . [#355](https://github.com/rocboss/paopao-ce/pull/355)
migration database first(sql ddl file in `scripts/migration/**/*_user_following.up.sql`):
```sql
DROP TABLE IF EXISTS p_following;
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)
@ -24,6 +40,7 @@ All notable changes to paopao-ce are documented in this file.
# use slim model to disable embed web ui to exectute 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
## 0.3.1
### Fixed

@ -1,4 +1,4 @@
.PHONY: all build run test clean fmt pre-commit help
.PHONY: all build build-web run test clean fmt pre-commit help
PROJECT = paopao-ce
TARGET = paopao
@ -35,6 +35,9 @@ build:
@echo Build paopao-ce
@go build -pgo=auto -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(RELEASE_ROOT)/$(TARGET)
build-web:
@cd web && rm -rf dist/* && yarn build && cd -
run:
@go run -pgo=auto -trimpath -gcflags "all=-N -l" -tags '$(TAGS)' -ldflags '$(LDFLAGS)' . serve

@ -3,18 +3,22 @@
## paopao-ce roadmap
#### dev+
* [ ] add `Followship` feature
* [ ] add `Auth:Bcrypt` feature
* [ ] add `Auth:MD5` feature (just for compatible)
* [x] add extend base ORM code for implement data logic base sqlx/sqlc
* [ ] optimize media tweet submit logic
* [ ] optimize search logic service
#### v0.4.0
* [x] add `Followship` feature.
* [x] add extend base ORM code for implement data logic base sqlx/sqlc.
* [x] user/profile page add comment/highlight/media/likes sub-page.
* [x] add tweet highlight feature to enable user set a tweet as highlight.
#### v0.3.0
* [x] remove `Deprecated:OldWeb` feature
* [x] add user topic follow feature support
* [x] add tweet link share support
* [ ] add comment thumbsUp/thumbsDown support
* [x] add comment thumbsUp/thumbsDown support
* [x] add `RedisCacheIndex` feature
* [x] add `Sentry` feature

@ -18,10 +18,10 @@ type Followship interface {
// Chain provide handlers chain for gin
Chain() gin.HandlersChain
ListFollowers(*web.ListFollowersReq) (*web.ListFollowersResp, mir.Error)
ListFollowings(*web.ListFollowingsReq) (*web.ListFollowingsResp, mir.Error)
DeleteFollowing(*web.DeleteFollowingReq) mir.Error
AddFollowing(*web.AddFollowingReq) mir.Error
ListFollows(*web.ListFollowsReq) (*web.ListFollowsResp, mir.Error)
UnfollowUser(*web.UnfollowUserReq) mir.Error
FollowUser(*web.FollowUserReq) mir.Error
mustEmbedUnimplementedFollowshipServant()
}
@ -34,59 +34,59 @@ func RegisterFollowshipServant(e *gin.Engine, s Followship) {
router.Use(middlewares...)
// register routes info to router
router.Handle("GET", "/follower/list", func(c *gin.Context) {
router.Handle("GET", "/user/followings", func(c *gin.Context) {
select {
case <-c.Request.Context().Done():
return
default:
}
req := new(web.ListFollowersReq)
req := new(web.ListFollowingsReq)
if err := s.Bind(c, req); err != nil {
s.Render(c, nil, err)
return
}
resp, err := s.ListFollowers(req)
resp, err := s.ListFollowings(req)
s.Render(c, resp, err)
})
router.Handle("GET", "/following/list", func(c *gin.Context) {
router.Handle("GET", "/user/follows", func(c *gin.Context) {
select {
case <-c.Request.Context().Done():
return
default:
}
req := new(web.ListFollowingsReq)
req := new(web.ListFollowsReq)
if err := s.Bind(c, req); err != nil {
s.Render(c, nil, err)
return
}
resp, err := s.ListFollowings(req)
resp, err := s.ListFollows(req)
s.Render(c, resp, err)
})
router.Handle("POST", "/following/delete", func(c *gin.Context) {
router.Handle("POST", "/user/unfollow", func(c *gin.Context) {
select {
case <-c.Request.Context().Done():
return
default:
}
req := new(web.DeleteFollowingReq)
req := new(web.UnfollowUserReq)
if err := s.Bind(c, req); err != nil {
s.Render(c, nil, err)
return
}
s.Render(c, nil, s.DeleteFollowing(req))
s.Render(c, nil, s.UnfollowUser(req))
})
router.Handle("POST", "/following/add", func(c *gin.Context) {
router.Handle("POST", "/user/follow", func(c *gin.Context) {
select {
case <-c.Request.Context().Done():
return
default:
}
req := new(web.AddFollowingReq)
req := new(web.FollowUserReq)
if err := s.Bind(c, req); err != nil {
s.Render(c, nil, err)
return
}
s.Render(c, nil, s.AddFollowing(req))
s.Render(c, nil, s.FollowUser(req))
})
}
@ -97,19 +97,19 @@ func (UnimplementedFollowshipServant) Chain() gin.HandlersChain {
return nil
}
func (UnimplementedFollowshipServant) ListFollowers(req *web.ListFollowersReq) (*web.ListFollowersResp, mir.Error) {
func (UnimplementedFollowshipServant) ListFollowings(req *web.ListFollowingsReq) (*web.ListFollowingsResp, mir.Error) {
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
}
func (UnimplementedFollowshipServant) ListFollowings(req *web.ListFollowingsReq) (*web.ListFollowingsResp, mir.Error) {
func (UnimplementedFollowshipServant) ListFollows(req *web.ListFollowsReq) (*web.ListFollowsResp, mir.Error) {
return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
}
func (UnimplementedFollowshipServant) DeleteFollowing(req *web.DeleteFollowingReq) mir.Error {
func (UnimplementedFollowshipServant) UnfollowUser(req *web.UnfollowUserReq) mir.Error {
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
}
func (UnimplementedFollowshipServant) AddFollowing(req *web.AddFollowingReq) mir.Error {
func (UnimplementedFollowshipServant) FollowUser(req *web.FollowUserReq) mir.Error {
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
}

@ -12,7 +12,7 @@ Server: # 服务设置
ReadTimeout: 60
WriteTimeout: 60
Features:
Default: ["Web", "Frontend:EmbedWeb", "Zinc", "LocalOSS", "MySQL", "BigCacheIndex", "LoggerZinc", "Friendship"]
Default: ["Web", "Frontend:EmbedWeb", "Zinc", "LocalOSS", "MySQL", "BigCacheIndex", "LoggerZinc", "Friendship", "Followship"]
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"]

@ -1,28 +0,0 @@
| 编号 | 作者 | 发表时间 | 变更时间 | 版本 | 状态 |
| ----- | ----- | ----- | ----- | ----- | ----- |
| 010| 北野 | 2022-12-10 | 2022-12-10 | v0.0 | 提议 |
### 关于Sqlx功能项的设计
---- 这里写简要介绍 ----
### 场景
---- 这里描述在什么使用场景下会需要本提按 ----
### 需求
TODO-TL;DR...
### 方案
TODO
### 疑问
1. 如何开启这个功能?
TODO
### 更新记录
#### v0.0(2022-12-10) - 北野
* 初始文档, 先占个位置

@ -1,6 +1,6 @@
| 编号 | 作者 | 发表时间 | 变更时间 | 版本 | 状态 |
| ----- | ----- | ----- | ----- | ----- | ----- |
| 22110409| 北野 | 2022-11-04 | 2022-11-21 | v0.1 | 提议 |
| 22110409| 北野 | 2022-11-04 | 2023-08-14 | v1.0 | 提议 |
### 关于Followship功能项的设计
Followship是实现类似Twitter Timeline模式**关注者模型**的时间线信息流广场推文列表的生成将主要与推文时间、用户的关注者相关。Twitter的推文消息流是非常智能的用户体验也非常好这得益于其背后的智能推荐算法以及完善的关注者模型体系当然还有很多其他机制共同作用下的结果。本提按作为一个总纲为paopao-ce引入类似的机制这将是一个持续完善的缓慢过程一切都是为了用户体验用户就是上帝用户需要什么paopao-ce就努力提供什么
@ -35,6 +35,9 @@
#### 方案二
在方案一的基础上通过引入 *图数据库* 实现可选需求。待研究、设计~
#### 设计细节
* 参考实现(PR):
[add Followship feature #355](https://github.com/rocboss/paopao-ce/pull/355)
### 疑问
@ -57,4 +60,7 @@
* 初始文档, 先占个位置;
#### v0.1(2022-11-21) - 北野
* 添加初始内容;
* 添加初始内容;
#### v1.0(2023-08-14) - 北野
* 添加参考实现;

@ -11,7 +11,7 @@ require (
github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible
github.com/allegro/bigcache/v3 v3.1.0
github.com/bufbuild/connect-go v1.10.0
github.com/bytedance/sonic v1.9.2
github.com/bytedance/sonic v1.10.0
github.com/cockroachdb/errors v1.10.0
github.com/disintegration/imaging v1.6.2
github.com/fatih/color v1.15.0
@ -31,8 +31,8 @@ require (
github.com/minio/minio-go/v7 v7.0.61
github.com/onsi/ginkgo/v2 v2.11.0
github.com/onsi/gomega v1.27.10
github.com/pyroscope-io/client v0.7.2-0.20230804044655-36760e422a95
github.com/redis/rueidis v1.0.14
github.com/pyroscope-io/client v0.7.2
github.com/redis/rueidis v1.0.15
github.com/sirupsen/logrus v1.9.3
github.com/smartwalle/alipay/v3 v3.2.15
github.com/sourcegraph/conc v0.3.0
@ -49,20 +49,19 @@ require (
gorm.io/driver/mysql v1.5.1
gorm.io/driver/postgres v1.5.2
gorm.io/driver/sqlite v1.5.2
gorm.io/gorm v1.25.2
gorm.io/plugin/dbresolver v1.4.2
gorm.io/gorm v1.25.3
gorm.io/plugin/dbresolver v1.4.4
gorm.io/plugin/soft_delete v1.2.1
modernc.org/sqlite v1.25.0
)
replace github.com/jmoiron/sqlx => github.com/bitbus/sqlx v1.4.0
require (
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230321174746-8dcc6526cfb1 // indirect
github.com/benbjohnson/clock v1.1.0 // indirect
github.com/bytecodealliance/wasmtime-go/v8 v8.0.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/clbanning/mxj v1.8.4 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
@ -130,7 +129,6 @@ require (
github.com/smartwalle/nsign v1.0.8 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
@ -167,3 +165,5 @@ require (
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.0.1 // indirect
)
replace github.com/jmoiron/sqlx => github.com/bitbus/sqlx v1.4.0

@ -204,8 +204,9 @@ github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3k
github.com/bytecodealliance/wasmtime-go/v8 v8.0.0 h1:jP4sqm2PHgm3+eQ50zCoCdIyQFkIL/Rtkw6TT8OYPFI=
github.com/bytecodealliance/wasmtime-go/v8 v8.0.0/go.mod h1:tgazNLU7xSC2gfRAM8L4WyE+dgs5yp9FF5/tGebEQyM=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.9.2 h1:GDaNjuWSGu09guE9Oql0MSTNhNCLlWwO8y/xM5BzcbM=
github.com/bytedance/sonic v1.9.2/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
github.com/bytedance/sonic v1.10.0 h1:qtNZduETEIWJVIyDl01BeNxur2rW9OwTQ/yBqFRkKEk=
github.com/bytedance/sonic v1.10.0/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4=
github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@ -219,8 +220,11 @@ github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOo
github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M=
github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E=
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams=
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0=
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA=
github.com/chenzhuoyu/iasm v0.9.0 h1:9fhXjVzq5hUy2gkhhgHl95zG2cEAhw9OSGs8toWWAwo=
github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
@ -866,6 +870,7 @@ github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
@ -1130,12 +1135,12 @@ github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/pyroscope-io/client v0.7.2-0.20230804044655-36760e422a95 h1:ZpE0l+tD3ykwYWQh/UVdIpxHmr9B6DTtOUBiGw3lB2E=
github.com/pyroscope-io/client v0.7.2-0.20230804044655-36760e422a95/go.mod h1:FEocnjn+Ngzxy6EtU9ZxXWRvQ0+pffkrBxHLnPpxwi8=
github.com/pyroscope-io/client v0.7.2 h1:OX2qdUQsS8RSkn/3C8isD7f/P0YiZQlRbAlecAaj/R8=
github.com/pyroscope-io/client v0.7.2/go.mod h1:FEocnjn+Ngzxy6EtU9ZxXWRvQ0+pffkrBxHLnPpxwi8=
github.com/pyroscope-io/godeltaprof v0.1.2 h1:MdlEmYELd5w+lvIzmZvXGNMVzW2Qc9jDMuJaPOR75g4=
github.com/pyroscope-io/godeltaprof v0.1.2/go.mod h1:psMITXp90+8pFenXkKIpNhrfmI9saQnPbba27VIaiQE=
github.com/redis/rueidis v1.0.14 h1:qdFZahk1F/2L+sZeOECx5E2N5J4Qc51b7ezSUpQXJfs=
github.com/redis/rueidis v1.0.14/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo=
github.com/redis/rueidis v1.0.15 h1:KjTaoP4ab6lpxyCwgIEZ3/rqvKfKnbICe83tVaaItxQ=
github.com/redis/rueidis v1.0.15/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo=
github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
@ -2050,10 +2055,11 @@ gorm.io/gorm v1.21.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
gorm.io/gorm v1.23.0/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
gorm.io/gorm v1.25.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/gorm v1.25.2 h1:gs1o6Vsa+oVKG/a9ElL3XgyGfghFfkKA2SInQaCyMho=
gorm.io/gorm v1.25.2/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/plugin/dbresolver v1.4.2 h1:IeLSH20ayxbo4rN6HMIQ0ccdsh/fkLK23pp6ivZrqBI=
gorm.io/plugin/dbresolver v1.4.2/go.mod h1:l4Cn87EHLEYuqUncpEeTC2tTJQkjngPSD+lo8hIvcT0=
gorm.io/gorm v1.25.3 h1:zi4rHZj1anhZS2EuEODMhDisGy+Daq9jtPrNGgbQYD8=
gorm.io/gorm v1.25.3/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/plugin/dbresolver v1.4.4 h1:Dtpr/jSVy48f+BnkPwdoHTLaxcE977wJ7QPt7fxI5Hs=
gorm.io/plugin/dbresolver v1.4.4/go.mod h1:l4Cn87EHLEYuqUncpEeTC2tTJQkjngPSD+lo8hIvcT0=
gorm.io/plugin/soft_delete v1.2.1 h1:qx9D/c4Xu6w5KT8LviX8DgLcB9hkKl6JC9f44Tj7cGU=
gorm.io/plugin/soft_delete v1.2.1/go.mod h1:Zv7vQctOJTGOsJ/bWgrN1n3od0GBAZgnLjEx+cApLGk=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
@ -2160,6 +2166,7 @@ modernc.org/z v1.0.1-0.20210308123920-1f282aa71362/go.mod h1:8/SRk5C/HgiQWCgXdfp
modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA=
modernc.org/z v1.7.3 h1:zDJf6iHjrnB+WRD88stbXokugjyc0/pB91ri1gO6LZY=
modernc.org/zappy v1.0.0/go.mod h1:hHe+oGahLVII/aTTyWK/b53VDHMAGCBYYeZ9sn83HC4=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=

@ -25,6 +25,7 @@ const (
TableComment = "comment"
TableCommentContent = "comment_content"
TableCommentReply = "comment_reply"
TableFollowing = "following"
TableContact = "contact"
TableContactGroup = "contact_group"
TableMessage = "message"

@ -305,6 +305,7 @@ func (s *databaseConf) TableNames() (res TableNameMap) {
TableComment,
TableCommentContent,
TableCommentReply,
TableFollowing,
TableContact,
TableContactGroup,
TableMessage,

@ -30,6 +30,7 @@ type DataService interface {
// 用户服务
UserManageService
ContactManageService
FollowingManageService
// 安全服务
SecurityService

@ -7,10 +7,11 @@ package ms
type (
ContactItem struct {
UserId int64 `json:"user_id"`
UserName string `db:"username" json:"username"`
Username string `db:"username" json:"username"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Phone string `json:"phone"`
Phone string `json:"phone,omitempty"`
IsFollow bool `json:"is_follow,omitempty"`
}
ContactList struct {

@ -26,3 +26,13 @@ type ContactManageService interface {
GetContacts(userId int64, offset int, limit int) (*ms.ContactList, error)
IsFriend(userID int64, friendID int64) bool
}
// FollowingManageService 关注管理服务
type FollowingManageService interface {
FollowUser(userId int64, followId int64) error
UnfollowUser(userId int64, followId int64) error
ListFollows(userId int64, limit, offset int) (*ms.ContactList, error)
ListFollowings(userId int64, limit, offset int) (*ms.ContactList, error)
GetFollowCount(userId int64) (int64, int64, error)
IsFollow(userId int64, followId int64) bool
}

@ -249,7 +249,7 @@ func (s *contactManageSrv) GetContacts(userId int64, offset int, limit int) (*ms
if c.User != nil {
resp.Contacts = append(resp.Contacts, ms.ContactItem{
UserId: c.FriendId,
UserName: c.User.Username,
Username: c.User.Username,
Nickname: c.User.Nickname,
Avatar: c.User.Avatar,
Phone: c.User.Phone,

@ -0,0 +1,87 @@
// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package dbr
import (
"github.com/sirupsen/logrus"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
type Following struct {
*Model
User *User `json:"-" gorm:"foreignKey:ID;references:FollowId"`
UserId int64 `json:"user_id"`
FollowId int64 `json:"friend_id"`
}
func (f *Following) GetFollowing(db *gorm.DB, userId, followId int64) (*Following, error) {
var following Following
err := db.Omit("User").Unscoped().Where("user_id = ? AND follow_id = ?", userId, followId).First(&following).Error
if err != nil {
logrus.Debugf("Following.GetFollowing get following error:%s", err)
return nil, err
}
return &following, nil
}
func (f *Following) DelFollowing(db *gorm.DB, userId, followId int64) error {
return db.Omit("User").Unscoped().Where("user_id = ? AND follow_id = ?", userId, followId).Delete(f).Error
}
func (f *Following) ListFollows(db *gorm.DB, userId int64, limit int, offset int) (res []*Following, total int64, err error) {
db = db.Model(f).Where("user_id=?", userId)
if err = db.Count(&total).Error; err != nil {
return
}
if offset >= 0 && limit > 0 {
db = db.Offset(offset).Limit(limit)
}
db.Joins("User").Order(clause.OrderByColumn{Column: clause.Column{Table: "User", Name: "nickname"}, Desc: false})
if err = db.Find(&res).Error; err != nil {
return
}
return
}
func (f *Following) ListFollowingIds(db *gorm.DB, userId int64, limit, offset int) (ids []int64, total int64, err error) {
db = db.Model(f).Where("follow_id=?", userId)
if err = db.Count(&total).Error; err != nil {
return
}
if offset >= 0 && limit > 0 {
db = db.Offset(offset).Limit(limit)
}
if err = db.Omit("User").Select("user_id").Find(&ids).Error; err != nil {
return
}
return
}
func (f *Following) FollowCount(db *gorm.DB, userId int64) (follows int64, followings int64, err error) {
if err = db.Model(f).Where("user_id=?", userId).Count(&follows).Error; err != nil {
return
}
if err = db.Model(f).Where("follow_id=?", userId).Count(&followings).Error; err != nil {
return
}
return
}
func (s *Following) IsFollow(db *gorm.DB, userId int64, followId int64) bool {
if _, err := s.GetFollowing(db, userId, followId); err == nil {
return true
}
return false
}
func (f *Following) Create(db *gorm.DB) (*Following, error) {
err := db.Omit("User").Create(f).Error
return f, err
}
func (c *Following) UpdateInUnscoped(db *gorm.DB) error {
return db.Unscoped().Omit("User").Save(c).Error
}

@ -0,0 +1,104 @@
// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package jinzhu
import (
"github.com/rocboss/paopao-ce/internal/core"
"github.com/rocboss/paopao-ce/internal/core/ms"
"github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr"
"github.com/sirupsen/logrus"
"gorm.io/gorm"
)
var (
_ core.FollowingManageService = (*followingManageSrv)(nil)
)
type followingManageSrv struct {
db *gorm.DB
f *dbr.Following
u *dbr.User
}
func newFollowingManageService(db *gorm.DB) core.FollowingManageService {
return &followingManageSrv{
db: db,
f: &dbr.Following{},
u: &dbr.User{},
}
}
func (s *followingManageSrv) FollowUser(userId int64, followId int64) error {
if _, err := s.f.GetFollowing(s.db, userId, followId); err != nil {
following := &dbr.Following{
UserId: userId,
FollowId: followId,
}
if _, err = following.Create(s.db); err != nil {
logrus.Errorf("contactManageSrv.fetchOrNewContact create new contact err:%s", err)
return err
}
}
return nil
}
func (s *followingManageSrv) UnfollowUser(userId int64, followId int64) error {
return s.f.DelFollowing(s.db, userId, followId)
}
func (s *followingManageSrv) ListFollows(userId int64, limit, offset int) (*ms.ContactList, error) {
follows, totoal, err := s.f.ListFollows(s.db, userId, limit, offset)
if err != nil {
return nil, err
}
res := &ms.ContactList{
Total: totoal,
}
for _, f := range follows {
res.Contacts = append(res.Contacts, ms.ContactItem{
UserId: f.User.ID,
Username: f.User.Username,
Nickname: f.User.Nickname,
Avatar: f.User.Avatar,
IsFollow: true,
})
}
return res, nil
}
func (s *followingManageSrv) ListFollowings(userId int64, limit, offset int) (*ms.ContactList, error) {
followingIds, totoal, err := s.f.ListFollowingIds(s.db, userId, limit, offset)
if err != nil {
return nil, err
}
followings, err := s.u.ListUserInfoById(s.db, followingIds)
if err != nil {
return nil, err
}
res := &ms.ContactList{
Total: totoal,
}
for _, user := range followings {
res.Contacts = append(res.Contacts, ms.ContactItem{
UserId: user.ID,
Username: user.Username,
Nickname: user.Nickname,
Avatar: user.Avatar,
IsFollow: s.IsFollow(userId, user.ID),
})
}
return res, nil
}
func (s *followingManageSrv) GetFollowCount(userId int64) (int64, int64, error) {
return s.f.FollowCount(s.db, userId)
}
func (s *followingManageSrv) IsFollow(userId int64, followId int64) bool {
if _, err := s.f.GetFollowing(s.db, userId, followId); err == nil {
return true
}
return false
}

@ -17,6 +17,7 @@ var (
_comment_ string
_commentContent_ string
_commentReply_ string
_following_ string
_contact_ string
_contactGroup_ string
_message_ string
@ -42,6 +43,7 @@ func initTableName() {
_comment_ = m[conf.TableComment]
_commentContent_ = m[conf.TableCommentContent]
_commentReply_ = m[conf.TableCommentReply]
_following_ = m[conf.TableFollowing]
_contact_ = m[conf.TableContact]
_contactGroup_ = m[conf.TableContactGroup]
_message_ = m[conf.TableMessage]

@ -42,6 +42,7 @@ type dataSrv struct {
core.CommentManageService
core.UserManageService
core.ContactManageService
core.FollowingManageService
core.SecurityService
core.AttachmentCheckService
}
@ -110,6 +111,7 @@ func NewDataService() (core.DataService, core.VersionInfo) {
CommentManageService: newCommentManageService(db),
UserManageService: newUserManageService(db),
ContactManageService: newContactManageService(db),
FollowingManageService: newFollowingManageService(db),
SecurityService: newSecurityService(db, pvs),
AttachmentCheckService: security.NewAttachmentCheckService(),
}

@ -0,0 +1,59 @@
// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package sakila
import (
"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"
)
var (
_ core.FollowingManageService = (*followingManageSrv)(nil)
)
type followingManageSrv struct {
*sqlxSrv
q *cc.FollowingManager
}
func (s *followingManageSrv) FollowUser(userId int64, followId int64) error {
// TODO
return cs.ErrNotImplemented
}
func (s *followingManageSrv) UnfollowUser(userId int64, followId int64) error {
// TDOO
return cs.ErrNotImplemented
}
func (s *followingManageSrv) ListFollows(userId int64, limit, offset int) (*ms.ContactList, error) {
// TODO
return nil, cs.ErrNotImplemented
}
func (s *followingManageSrv) ListFollowings(userId int64, limit, offset int) (*ms.ContactList, error) {
// TODO
return nil, cs.ErrNotImplemented
}
func (s *followingManageSrv) GetFollowCount(userId int64) (int64, int64, error) {
// TODO
return 0, 0, cs.ErrNotImplemented
}
func (s *followingManageSrv) IsFollow(userId int64, followId int64) bool {
// TODO
return false
}
func newFollowingManageService(db *sqlx.DB) core.FollowingManageService {
return &followingManageSrv{
sqlxSrv: newSqlxSrv(db),
q: mustBuild(db, cc.BuildFollowingManager),
}
}

@ -38,6 +38,7 @@ type dataSrv struct {
core.CommentManageService
core.UserManageService
core.ContactManageService
core.FollowingManageService
core.SecurityService
core.AttachmentCheckService
}
@ -105,6 +106,7 @@ func NewDataService() (core.DataService, core.VersionInfo) {
CommentManageService: newCommentManageService(_db),
UserManageService: newUserManageService(_db),
ContactManageService: newContactManageService(_db),
FollowingManageService: newFollowingManageService(_db),
SecurityService: newSecurityService(_db, pvs),
AttachmentCheckService: security.NewAttachmentCheckService(),
}

@ -52,6 +52,7 @@ const (
_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_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=?`
@ -214,6 +215,11 @@ type FollowIndexA struct {
UserInfo *sqlx.Stmt `yesql:"user_info"`
}
type FollowingManager struct {
yesql.Namespace `yesql:"following_manager"`
CreateFollowing *sqlx.Stmt `yesql:"create_following"`
}
type FriendIndex struct {
yesql.Namespace `yesql:"friend_index"`
UserInfo *sqlx.Stmt `yesql:"user_info"`
@ -564,6 +570,20 @@ func BuildFollowIndexA(p yesql.PreparexBuilder, ctx ...context.Context) (obj *Fo
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 {

@ -141,6 +141,14 @@ UPDATE @comment_reply
SET thumbs_up_count=?, thumbs_down_count=?, modified_on=?
WHERE id=? AND is_del=0;
--------------------------------------------------------------------------------
-- following_manager sql dml
--------------------------------------------------------------------------------
-- name: create_following@following_manager
-- prepare: stmt
INSERT INTO @following (user_id, follow_id, created_on) VALUES (?, ?, ?);
--------------------------------------------------------------------------------
-- contact_manager sql dml
--------------------------------------------------------------------------------

@ -0,0 +1,16 @@
// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
// Package joint provider some common base type or logic for model define.
package joint
type BasePageInfo struct {
Page int `form:"-" binding:"-"`
PageSize int `form:"-" binding:"-"`
}
func (r *BasePageInfo) SetPageInfo(page int, pageSize int) {
r.Page, r.PageSize = page, pageSize
}

@ -27,14 +27,17 @@ type UserInfoReq struct {
}
type UserInfoResp struct {
Id int64 `json:"id"`
Nickname string `json:"nickname"`
Username string `json:"username"`
Status int `json:"status"`
Avatar string `json:"avatar"`
Balance int64 `json:"balance"`
Phone string `json:"phone"`
IsAdmin bool `json:"is_admin"`
Id int64 `json:"id"`
Nickname string `json:"nickname"`
Username string `json:"username"`
Status int `json:"status"`
Avatar string `json:"avatar"`
Balance int64 `json:"balance"`
Phone string `json:"phone"`
IsAdmin bool `json:"is_admin"`
CreatedOn int64 `json:"created_on"`
Follows int64 `json:"follows"`
Followings int64 `json:"followings"`
}
type GetUnreadMsgCountReq struct {

@ -4,24 +4,33 @@
package web
import "github.com/rocboss/paopao-ce/internal/servants/base"
import (
"github.com/rocboss/paopao-ce/internal/model/joint"
"github.com/rocboss/paopao-ce/internal/servants/base"
)
type AddFollowingReq struct {
type FollowUserReq struct {
BaseInfo `json:"-" binding:"-"`
UserId int64 `json:"user_id" binding:"required"`
}
type DeleteFollowingReq struct {
type UnfollowUserReq struct {
BaseInfo `json:"-" binding:"-"`
UserId int64 `json:"user_id" binding:"required"`
}
type ListFollowingsReq struct {
type ListFollowsReq struct {
BaseInfo `json:"-" binding:"-"`
joint.BasePageInfo
Username string `form:"username" binding:"required"`
}
type ListFollowingsResp base.PageResp
type ListFollowsResp base.PageResp
type ListFollowersReq struct {
type ListFollowingsReq struct {
BaseInfo `form:"-" binding:"-"`
joint.BasePageInfo
Username string `form:"username" binding:"required"`
}
type ListFollowersResp base.PageResp
type ListFollowingsResp base.PageResp

@ -67,13 +67,17 @@ type GetUserProfileReq struct {
}
type GetUserProfileResp struct {
ID int64 `json:"id"`
Nickname string `json:"nickname"`
Username string `json:"username"`
Status int `json:"status"`
Avatar string `json:"avatar"`
IsAdmin bool `json:"is_admin"`
IsFriend bool `json:"is_friend"`
ID int64 `json:"id"`
Nickname string `json:"nickname"`
Username string `json:"username"`
Status int `json:"status"`
Avatar string `json:"avatar"`
IsAdmin bool `json:"is_admin"`
IsFriend bool `json:"is_friend"`
IsFollowing bool `json:"is_following"`
CreatedOn int64 `json:"created_on"`
Follows int64 `json:"follows"`
Followings int64 `json:"followings"`
}
type TopicListReq struct {

@ -79,6 +79,11 @@ var (
ErrDeleteFriendFailed = xerror.NewError(80006, "删除好友失败")
ErrGetContactsFailed = xerror.NewError(80007, "获取联系人列表失败")
ErrNoActionToSelf = xerror.NewError(80008, "不允许对自己操作")
ErrFolloUserFailed = xerror.NewError(80100, "关注失败")
ErrUnfollowUserFailed = xerror.NewError(80101, "取消关注失败")
ErrListFollowsFailed = xerror.NewError(80102, "获取关注列表失败")
ErrListFollowingsFailed = xerror.NewError(80103, "获取粉丝列表列表失败")
ErrGetFollowCountFailed = xerror.NewError(80104, "获取关注计数信息失败")
ErrFollowTopicFailed = xerror.NewError(90001, "关注话题失败")
ErrUnfollowTopicFailed = xerror.NewError(90002, "取消关注话题失败")

@ -60,14 +60,21 @@ func (s *coreSrv) GetUserInfo(req *web.UserInfoReq) (*web.UserInfoResp, mir.Erro
if user.Model == nil || user.ID < 0 {
return nil, xerror.UnauthorizedAuthNotExist
}
follows, followings, err := s.Ds.GetFollowCount(user.ID)
if err != nil {
return nil, web.ErrGetFollowCountFailed
}
resp := &web.UserInfoResp{
Id: user.ID,
Nickname: user.Nickname,
Username: user.Username,
Status: user.Status,
Avatar: user.Avatar,
Balance: user.Balance,
IsAdmin: user.IsAdmin,
Id: user.ID,
Nickname: user.Nickname,
Username: user.Username,
Status: user.Status,
Avatar: user.Avatar,
Balance: user.Balance,
IsAdmin: user.IsAdmin,
CreatedOn: user.CreatedOn,
Follows: follows,
Followings: followings,
}
if user.Phone != "" && len(user.Phone) == 11 {
resp.Phone = user.Phone[0:3] + "****" + user.Phone[7:]

@ -5,10 +5,13 @@
package web
import (
"github.com/alimy/mir/v4"
"github.com/gin-gonic/gin"
api "github.com/rocboss/paopao-ce/auto/api/v1"
"github.com/rocboss/paopao-ce/internal/model/web"
"github.com/rocboss/paopao-ce/internal/servants/base"
"github.com/rocboss/paopao-ce/internal/servants/chain"
"github.com/sirupsen/logrus"
)
var (
@ -24,6 +27,54 @@ func (s *followshipSrv) Chain() gin.HandlersChain {
return gin.HandlersChain{chain.JWT()}
}
func (s *followshipSrv) ListFollowings(r *web.ListFollowingsReq) (*web.ListFollowingsResp, mir.Error) {
he, err := s.Ds.GetUserByUsername(r.Username)
if err != nil {
logrus.Errorf("Ds.GetUserByUsername err: %s", err)
return nil, web.ErrNoExistUsername
}
res, err := s.Ds.ListFollowings(he.ID, r.PageSize, r.Page-1)
if err != nil {
logrus.Errorf("Ds.ListFollowings err: %s", err)
return nil, web.ErrListFollowingsFailed
}
resp := base.PageRespFrom(res.Contacts, r.Page, r.PageSize, res.Total)
return (*web.ListFollowingsResp)(resp), nil
}
func (s *followshipSrv) ListFollows(r *web.ListFollowsReq) (*web.ListFollowsResp, mir.Error) {
he, err := s.Ds.GetUserByUsername(r.Username)
if err != nil {
logrus.Errorf("Ds.GetUserByUsername err: %s", err)
return nil, web.ErrNoExistUsername
}
res, err := s.Ds.ListFollows(he.ID, r.PageSize, r.Page-1)
if err != nil {
logrus.Errorf("Ds.ListFollows err: %s", err)
return nil, web.ErrListFollowsFailed
}
resp := base.PageRespFrom(res.Contacts, r.Page, r.PageSize, res.Total)
return (*web.ListFollowsResp)(resp), nil
}
func (s *followshipSrv) UnfollowUser(r *web.UnfollowUserReq) mir.Error {
if err := s.Ds.UnfollowUser(r.User.ID, r.UserId); err != nil {
logrus.Errorf("Ds.UnfollowUser err: %s userId: %d followId: %d", err, r.User.ID, r.UserId)
return web.ErrUnfollowUserFailed
}
return nil
}
func (s *followshipSrv) FollowUser(r *web.FollowUserReq) mir.Error {
if err := s.Ds.FollowUser(r.User.ID, r.UserId); err != nil {
logrus.Errorf("Ds.FollowUser err: %s userId: %d followId: %d", err, r.User.ID, r.UserId)
return web.ErrUnfollowUserFailed
}
return nil
}
func newFollowshipSrv(s *base.DaoServant) api.Followship {
return &followshipSrv{}
return &followshipSrv{
DaoServant: s,
}
}

@ -177,14 +177,26 @@ func (s *looseSrv) GetUserProfile(req *web.GetUserProfileReq) (*web.GetUserProfi
if req.User != nil && req.User.ID != he.ID {
isFriend = s.Ds.IsFriend(req.User.ID, he.ID)
}
isFollowing := false
if req.User != nil {
isFollowing = s.Ds.IsFollow(req.User.ID, he.ID)
}
follows, followings, err := s.Ds.GetFollowCount(he.ID)
if err != nil {
return nil, web.ErrGetPostsFailed
}
return &web.GetUserProfileResp{
ID: he.ID,
Nickname: he.Nickname,
Username: he.Username,
Status: he.Status,
Avatar: he.Avatar,
IsAdmin: he.IsAdmin,
IsFriend: isFriend,
ID: he.ID,
Nickname: he.Nickname,
Username: he.Username,
Status: he.Status,
Avatar: he.Avatar,
IsAdmin: he.IsAdmin,
IsFriend: isFriend,
IsFollowing: isFollowing,
CreatedOn: he.CreatedOn,
Follows: follows,
Followings: followings,
}, nil
}

@ -15,15 +15,15 @@ type Followship struct {
Chain `mir:"-"`
Group `mir:"v1"`
// AddFollowing 添加关注
AddFollowing func(Post, web.AddFollowingReq) `mir:"/following/add"`
// FollowUser 关注用户
FollowUser func(Post, web.FollowUserReq) `mir:"/user/follow"`
// DeleteFollowing 取消关注
DeleteFollowing func(Post, web.DeleteFollowingReq) `mir:"/following/delete"`
// UnfollowUser 取消关注用户
UnfollowUser func(Post, web.UnfollowUserReq) `mir:"/user/unfollow"`
// ListFollowings 获取用户的关注列表
ListFollowings func(Get, web.ListFollowingsReq) web.ListFollowingsResp `mir:"/following/list"`
// ListFollows 获取用户的关注列表
ListFollows func(Get, web.ListFollowsReq) web.ListFollowsResp `mir:"/user/follows"`
// ListFollowers 获取用户的追随者列表
ListFollowers func(Get, web.ListFollowersReq) web.ListFollowersResp `mir:"/follower/list"`
// ListFollowings 获取用户的追随者列表
ListFollowings func(Get, web.ListFollowingsReq) web.ListFollowingsResp `mir:"/user/followings"`
}

@ -0,0 +1 @@
DROP TABLE IF EXISTS `p_following`;

@ -0,0 +1,11 @@
CREATE TABLE `p_following` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint unsigned NOT NULL,
`follow_id` bigint unsigned NOT NULL,
`is_del` tinyint NOT NULL DEFAULT 0, -- 是否删除, 0否, 1是
`created_on` bigint unsigned NOT NULL DEFAULT '0',
`modified_on` bigint unsigned NOT NULL DEFAULT '0',
`deleted_on` bigint unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_following_user_follow` (`user_id`,`follow_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

@ -0,0 +1 @@
DROP TABLE IF EXISTS p_following;

@ -0,0 +1,10 @@
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, -- 是否删除, 0否, 1是
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);

@ -0,0 +1 @@
DROP TABLE IF EXISTS "p_following";

@ -0,0 +1,15 @@
CREATE TABLE "p_following" (
"id" integer NOT NULL,
"user_id" integer NOT NULL,
"follow_id" integer NOT NULL,
"is_del" integer NOT NULL,
"created_on" integer NOT NULL,
"modified_on" integer NOT NULL,
"deleted_on" integer NOT NULL,
PRIMARY KEY ("id")
);
CREATE INDEX "idx_following_user_follow"
ON "p_following" (
"user_id" ASC,
"follow_id" ASC
);

@ -318,6 +318,22 @@ CREATE TABLE `p_user` (
KEY `idx_user_phone` (`phone`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=100058 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户';
-- ----------------------------
-- Table structure for p_following
-- ----------------------------
DROP TABLE IF EXISTS `p_following`;
CREATE TABLE `p_following` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint unsigned NOT NULL,
`follow_id` bigint unsigned NOT NULL,
`is_del` tinyint NOT NULL DEFAULT 0, -- 是否删除, 0否, 1是
`created_on` bigint unsigned NOT NULL DEFAULT '0',
`modified_on` bigint unsigned NOT NULL DEFAULT '0',
`deleted_on` bigint unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_following_user_follow` (`user_id`,`follow_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Table structure for p_contact
-- ----------------------------

@ -287,6 +287,18 @@ CREATE TABLE p_user (
CREATE UNIQUE INDEX idx_user_username ON p_user USING btree (username);
CREATE INDEX idx_user_phone ON p_user USING btree (phone);
DROP TABLE IF EXISTS p_following;
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, -- 是否删除, 0否, 1是
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);
DROP TABLE IF EXISTS p_contact;
CREATE TABLE p_contact (
id BIGSERIAL PRIMARY KEY,

@ -113,6 +113,21 @@ CREATE TABLE "p_tweet_comment_thumbs" (
"is_del" integer NOT NULL DEFAULT 0 -- 是否删除 0 为未删除、1 为已删除
);
-- ----------------------------
-- Table structure for p_following
-- ----------------------------
DROP TABLE IF EXISTS "p_following";
CREATE TABLE "p_following" (
"id" integer NOT NULL,
"user_id" integer NOT NULL,
"follow_id" integer NOT NULL,
"is_del" integer NOT NULL,
"created_on" integer NOT NULL,
"modified_on" integer NOT NULL,
"deleted_on" integer NOT NULL,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for p_contact
-- ----------------------------
@ -464,6 +479,15 @@ ON "p_tweet_comment_thumbs"(
"tweet_id" ASC
);
-- ----------------------------
-- Indexes structure for table p_following
-- ----------------------------
CREATE INDEX "idx_following_user_follow"
ON "p_following" (
"user_id" ASC,
"follow_id" ASC
);
-- ----------------------------
-- Indexes structure for table p_contact
-- ----------------------------

@ -1 +1 @@
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-be35896a.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-347d1d96.js";import"./vuex-473b3783.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-8f91201d.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-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};

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{_ as F}from"./post-skeleton-ffa76165.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-be35896a.js";import{u as V}from"./vuex-473b3783.js";import{b as z}from"./vue-router-b8e3382f.js";import{a as A}from"./formatTime-cdf4e6f1.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-347d1d96.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-8f91201d.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-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};

@ -0,0 +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};

@ -1 +0,0 @@
import{_ as P,a as S}from"./post-item.vue_vue_type_style_index_0_lang-e2c8dabf.js";import{_ as V}from"./post-skeleton-ffa76165.js";import{_ as $}from"./main-nav.vue_vue_type_style_index_0_lang-be35896a.js";import{u as I}from"./vuex-473b3783.js";import{b as L}from"./vue-router-b8e3382f.js";import{L as N,_ as R}from"./index-347d1d96.js";import{d as j,r as s,j as q,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 E,G,I as H,H as O}from"./naive-ui-62663ad7.js";import"./content-72d615e5.js";import"./@vicons-8f91201d.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.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=j({__name:"Collection",setup(W){const m=I(),y=L(),_=s(!1),i=s([]),p=s(+y.query.p||1),l=s(20),r=s(0),u=()=>{_.value=!0,N({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 q(()=>{u()}),(n,X)=>{const C=$,b=V,x=H,z=P,d=O,B=S,F=E,M=G;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=R(K,[["__scopeId","data-v-a5302c9b"]]);export{Mt as default};

@ -0,0 +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};

@ -1 +0,0 @@
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 O,I as T,H as j}from"./naive-ui-62663ad7.js";import{_ as b,O as E}from"./index-347d1d96.js";import{_ as G}from"./post-skeleton-ffa76165.js";import{_ as H}from"./main-nav.vue_vue_type_style_index_0_lang-be35896a.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-8f91201d.js";/* empty css */const Q={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:{username: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",Q,[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-08ee9b2e"]]),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=O;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};

@ -0,0 +1 @@
.contact-item[data-v-0f1bf4ae]{display:flex;width:100%;padding:12px 16px}.contact-item[data-v-0f1bf4ae]:hover{background:#f7f9f9;cursor:pointer}.contact-item .avatar[data-v-0f1bf4ae]{width:55px}.contact-item .base-info[data-v-0f1bf4ae]{position:relative;width:calc(100% - 55px)}.contact-item .base-info .username[data-v-0f1bf4ae]{line-height:16px;font-size:16px}.contact-item .base-info .uid[data-v-0f1bf4ae]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.dark .contact-item[data-v-0f1bf4ae]{background-color:#101014bf}.dark .contact-item[data-v-0f1bf4ae]:hover{background:#18181c}.pagination-wrap[data-v-3b2bf978]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .main-content-wrap[data-v-3b2bf978],.dark .empty-wrap[data-v-3b2bf978],.dark .skeleton-wrap[data-v-3b2bf978]{background-color:#101014bf}

@ -1 +0,0 @@
.contact-item[data-v-08ee9b2e]{display:flex;width:100%;padding:12px 16px}.contact-item[data-v-08ee9b2e]:hover{background:#f7f9f9;cursor:pointer}.contact-item .avatar[data-v-08ee9b2e]{width:55px}.contact-item .base-info[data-v-08ee9b2e]{position:relative;width:calc(100% - 55px)}.contact-item .base-info .username[data-v-08ee9b2e]{line-height:16px;font-size:16px}.contact-item .base-info .uid[data-v-08ee9b2e]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.dark .contact-item[data-v-08ee9b2e]{background-color:#101014bf}.dark .contact-item[data-v-08ee9b2e]:hover{background:#18181c}.pagination-wrap[data-v-3b2bf978]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .main-content-wrap[data-v-3b2bf978],.dark .empty-wrap[data-v-3b2bf978],.dark .skeleton-wrap[data-v-3b2bf978]{background-color:#101014bf}

@ -0,0 +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};

@ -0,0 +1 @@
.follow-item[data-v-6e07cba3]{display:flex;width:100%;padding:12px 16px}.follow-item[data-v-6e07cba3]:hover{background:#f7f9f9;cursor:pointer}.follow-item .avatar[data-v-6e07cba3]{width:55px}.follow-item .base-info[data-v-6e07cba3]{position:relative;width:calc(100% - 55px)}.follow-item .base-info .username[data-v-6e07cba3]{line-height:16px;font-size:16px}.follow-item .base-info .uid[data-v-6e07cba3]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.dark .follow-item[data-v-6e07cba3]{background-color:#101014bf}.dark .follow-item[data-v-6e07cba3]:hover{background:#18181c}.main-content-wrap[data-v-1f0f223d]{padding:20px}.pagination-wrap[data-v-1f0f223d]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .main-content-wrap[data-v-1f0f223d],.dark .empty-wrap[data-v-1f0f223d],.dark .skeleton-wrap[data-v-1f0f223d]{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

@ -0,0 +1 @@
.message-item[data-v-07fc447f]{padding:16px}.message-item.unread[data-v-07fc447f]{background:#fcfffc}.message-item .sender-wrap[data-v-07fc447f]{display:flex;align-items:center}.message-item .sender-wrap .username[data-v-07fc447f]{opacity:.75;font-size:14px}.message-item .timestamp[data-v-07fc447f]{opacity:.75;font-size:12px;display:flex;align-items:center}.message-item .timestamp .timestamp-txt[data-v-07fc447f]{margin-left:6px}.message-item .brief-wrap[data-v-07fc447f]{margin-top:10px}.message-item .brief-wrap .brief-content[data-v-07fc447f],.message-item .brief-wrap .whisper-content-wrap[data-v-07fc447f],.message-item .brief-wrap .requesting-friend-wrap[data-v-07fc447f]{display:flex;width:100%}.message-item .view-link[data-v-07fc447f]{margin-left:8px;display:flex;align-items:center}.message-item .status-info[data-v-07fc447f]{margin-left:8px;align-items:center}.dark .message-item[data-v-07fc447f]{background-color:#101014bf}.dark .message-item.unread[data-v-07fc447f]{background:#0f180b}.dark .message-item .brief-wrap[data-v-07fc447f]{background-color:#18181c}.skeleton-item[data-v-01d2e871]{padding:12px;display:flex}.skeleton-item .content[data-v-01d2e871]{width:100%}.dark .skeleton-item[data-v-01d2e871]{background-color:#101014bf}.pagination-wrap[data-v-4e7b1342]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .empty-wrap[data-v-4e7b1342],.dark .messages-wrap[data-v-4e7b1342],.dark .pagination-wrap[data-v-4e7b1342]{background-color:#101014bf}

@ -1 +0,0 @@
.message-item[data-v-4a0e27fa]{padding:16px}.message-item.unread[data-v-4a0e27fa]{background:#fcfffc}.message-item .sender-wrap[data-v-4a0e27fa]{display:flex;align-items:center}.message-item .sender-wrap .username[data-v-4a0e27fa]{opacity:.75;font-size:14px}.message-item .timestamp[data-v-4a0e27fa]{opacity:.75;font-size:12px;display:flex;align-items:center}.message-item .timestamp .timestamp-txt[data-v-4a0e27fa]{margin-left:6px}.message-item .brief-wrap[data-v-4a0e27fa]{margin-top:10px}.message-item .brief-wrap .brief-content[data-v-4a0e27fa],.message-item .brief-wrap .whisper-content-wrap[data-v-4a0e27fa],.message-item .brief-wrap .requesting-friend-wrap[data-v-4a0e27fa]{display:flex;width:100%}.message-item .view-link[data-v-4a0e27fa]{margin-left:8px;display:flex;align-items:center}.message-item .status-info[data-v-4a0e27fa]{margin-left:8px;align-items:center}.dark .message-item[data-v-4a0e27fa]{background-color:#101014bf}.dark .message-item.unread[data-v-4a0e27fa]{background:#0f180b}.dark .message-item .brief-wrap[data-v-4a0e27fa]{background-color:#18181c}.skeleton-item[data-v-01d2e871]{padding:12px;display:flex}.skeleton-item .content[data-v-01d2e871]{width:100%}.dark .skeleton-item[data-v-01d2e871]{background-color:#101014bf}.pagination-wrap[data-v-4e7b1342]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .empty-wrap[data-v-4e7b1342],.dark .messages-wrap[data-v-4e7b1342],.dark .pagination-wrap[data-v-4e7b1342]{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

@ -0,0 +1 @@
.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

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
.profile-baseinfo[data-v-08661398]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-08661398]{width:55px}.profile-baseinfo .base-info[data-v-08661398]{position:relative;width:calc(100% - 55px)}.profile-baseinfo .base-info .username[data-v-08661398]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .uid[data-v-08661398]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-tabs-wrap[data-v-08661398]{padding:0 16px}.pagination-wrap[data-v-08661398]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-baseinfo[data-v-08661398]{background-color:#18181c}.dark .profile-wrap[data-v-08661398],.dark .pagination-wrap[data-v-08661398]{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

@ -1 +1 @@
.tag-item .tag-quote{margin-left:12px;font-size:14px;opacity:.75}.tag-item .tag-follow{margin-right:22px}.tag-item .options{margin-left:-32px;margin-bottom:4px;opacity:.55}.tag-item .n-thing .n-thing-header{margin-bottom:0}.tag-item .n-thing .n-thing-avatar-header-wrapper{align-items:center}.tags-wrap[data-v-15794a53]{padding:20px}.dark .tags-wrap[data-v-15794a53]{background-color:#101014bf}
.tag-item .tag-quote{margin-left:12px;font-size:14px;opacity:.75}.tag-item .tag-follow{margin-right:22px}.tag-item .options{margin-left:-32px;margin-bottom:4px;opacity:.55}.tag-item .n-thing .n-thing-header{margin-bottom:0}.tag-item .n-thing .n-thing-avatar-header-wrapper{align-items:center}.tags-wrap[data-v-1fb31ecf]{padding:20px}.dark .tags-wrap[data-v-1fb31ecf]{background-color:#101014bf}

@ -1 +1 @@
import{x as F,y as z,z as I,A as j,_ as E}from"./index-347d1d96.js";import{v as U}from"./@vicons-8f91201d.js";import{d as $,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-be35896a.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=$({__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":F({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":F({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=$({__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-15794a53"]]);export{Me as default};
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};

File diff suppressed because one or more lines are too long

@ -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-0bc7883f]{padding:0 16px}.profile-baseinfo[data-v-0bc7883f]{display:flex;padding:16px}.profile-baseinfo .avatar[data-v-0bc7883f]{width:55px}.profile-baseinfo .base-info[data-v-0bc7883f]{position:relative;width:calc(100% - 55px)}.profile-baseinfo .base-info .username[data-v-0bc7883f]{line-height:16px;font-size:16px}.profile-baseinfo .base-info .uid[data-v-0bc7883f]{font-size:14px;line-height:14px;margin-top:10px;opacity:.75}.profile-baseinfo .base-info .top-tag[data-v-0bc7883f]{transform:scale(.75)}.profile-baseinfo .user-opts[data-v-0bc7883f]{position:absolute;top:16px;right:16px;opacity:.75}.pagination-wrap[data-v-0bc7883f]{padding:10px;display:flex;justify-content:center;overflow:hidden}.dark .profile-baseinfo[data-v-0bc7883f]{background-color:#18181c}.dark .profile-wrap[data-v-0bc7883f],.dark .pagination-wrap[data-v-0bc7883f]{background-color:#101014bf}

File diff suppressed because one or more lines are too long

@ -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-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{h as r}from"./moment-2ab8298d.js";r.locale("zh-cn");const f=e=>r.unix(e).fromNow(),a=e=>{let t=r.unix(e),o=r();return t.year()!=o.year()?t.utc(!0).format("YYYY-MM-DD HH:mm"):r().diff(t,"month")>3?t.utc(!0).format("MM-DD HH:mm"):t.fromNow()},n=e=>{let t=r.unix(e),o=r();return t.year()!=o.year()?t.utc(!0).format("YYYY-MM-DD"):r().diff(t,"month")>3?t.utc(!0).format("MM-DD"):t.fromNow()};export{f as a,n as b,a as f};
import{h as r}from"./moment-2ab8298d.js";r.locale("zh-cn");const a=e=>r.unix(e).fromNow(),f=e=>{let t=r.unix(e),o=r();return t.year()!=o.year()?t.utc(!0).format("YYYY-MM-DD HH:mm"):r().diff(t,"month")>3?t.utc(!0).format("MM-DD HH:mm"):t.fromNow()},u=e=>{let t=r.unix(e),o=r();return t.year()!=o.year()?t.utc(!0).format("YYYY-MM-DD"):r().diff(t,"month")>3?t.utc(!0).format("MM-DD"):t.fromNow()},n=e=>r.unix(e).utc(!0).format("YYYY年MM月");export{a,n as b,u as c,f};

@ -1 +1 @@
.auth-wrap[data-v-053dfa44]{margin-top:-30px}.dark .auth-wrap[data-v-053dfa44]{background-color:#101014bf}.rightbar-wrap[data-v-f4a84024]{width:240px;position:fixed;left:calc(50% + var(--content-main) / 2 + 10px)}.rightbar-wrap .search-wrap[data-v-f4a84024]{margin:12px 0}.rightbar-wrap .hot-tag-item[data-v-f4a84024]{line-height:2;position:relative}.rightbar-wrap .hot-tag-item .hash-link[data-v-f4a84024]{width:calc(100% - 60px);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block}.rightbar-wrap .hot-tag-item .post-num[data-v-f4a84024]{position:absolute;right:0;top:0;width:60px;text-align:right;line-height:2;opacity:.5}.rightbar-wrap .hottopic-wrap[data-v-f4a84024]{margin-bottom:10px}.rightbar-wrap .copyright-wrap .copyright[data-v-f4a84024]{font-size:12px;opacity:.75}.rightbar-wrap .copyright-wrap .hash-link[data-v-f4a84024]{font-size:12px}.dark .hottopic-wrap[data-v-f4a84024],.dark .copyright-wrap[data-v-f4a84024]{background-color:#18181c}.sidebar-wrap{z-index:99;width:200px;height:100vh;position:fixed;right:calc(50% + var(--content-main) / 2 + 10px);padding:12px 0;box-sizing:border-box}.sidebar-wrap .n-menu .n-menu-item-content:before{border-radius:21px}.logo-wrap{display:flex;justify-content:flex-start;margin-bottom:12px}.logo-wrap .logo-img{margin-left:24px}.logo-wrap .logo-img:hover{cursor:pointer}.user-wrap{display:flex;align-items:center;position:absolute;bottom:12px;left:12px;right:12px}.user-wrap .user-mini-wrap{display:none}.user-wrap .user-avatar{margin-right:8px}.user-wrap .user-info{display:flex;flex-direction:column}.user-wrap .user-info .nickname{font-size:16px;font-weight:700;line-height:16px;height:16px;margin-bottom:2px;display:flex;align-items:center}.user-wrap .user-info .nickname .nickname-txt{max-width:90px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.user-wrap .user-info .nickname .logout{margin-left:6px}.user-wrap .user-info .username{font-size:14px;line-height:16px;height:16px;width:120px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;opacity:.75}.user-wrap .login-only-wrap{display:flex;justify-content:center;width:100%}.user-wrap .login-only-wrap button{margin:0 4px;width:80%}.user-wrap .login-wrap{display:flex;justify-content:center;width:100%}.user-wrap .login-wrap button{margin:0 4px}.auth-card .n-card-header{z-index:999}@media screen and (max-width: 821px){.sidebar-wrap{width:200px;right:calc(100% - 200px)}.logo-wrap .logo-img{margin-left:12px!important}.user-wrap .user-avatar,.user-wrap .user-info,.user-wrap .login-only-wrap,.user-wrap .login-wrap{margin-bottom:32px}}:root{--content-main: 600px}.app-container{margin:0}.app-container .app-wrap{width:100%;margin:0 auto}.main-wrap{min-height:100vh;display:flex;flex-direction:row;justify-content:center}.main-wrap .content-wrap{width:100%;max-width:var(--content-main);position:relative}.main-wrap .main-content-wrap{margin:0;border-top:none;border-radius:0}.main-wrap .main-content-wrap .n-list-item{padding:0}.empty-wrap{min-height:300px;display:flex;align-items:center;justify-content:center}.hash-link,.user-link{color:#18a058;text-decoration:none;cursor:pointer}.hash-link:hover,.user-link:hover{opacity:.8}.beian-link{color:#333;text-decoration:none}.beian-link:hover{opacity:.75}.username-link{color:#000;color:none;text-decoration:none;cursor:pointer}.username-link:hover{text-decoration:underline}.dark .hash-link,.dark .user-link{color:#63e2b7}.dark .username-link{color:#eee}.dark .beian-link{color:#ddd}@media screen and (max-width: 821px){.content-wrap{top:0;position:absolute!important}}
.auth-wrap[data-v-053dfa44]{margin-top:-30px}.dark .auth-wrap[data-v-053dfa44]{background-color:#101014bf}.rightbar-wrap[data-v-f4a84024]{width:240px;position:fixed;left:calc(50% + var(--content-main) / 2 + 10px)}.rightbar-wrap .search-wrap[data-v-f4a84024]{margin:12px 0}.rightbar-wrap .hot-tag-item[data-v-f4a84024]{line-height:2;position:relative}.rightbar-wrap .hot-tag-item .hash-link[data-v-f4a84024]{width:calc(100% - 60px);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block}.rightbar-wrap .hot-tag-item .post-num[data-v-f4a84024]{position:absolute;right:0;top:0;width:60px;text-align:right;line-height:2;opacity:.5}.rightbar-wrap .hottopic-wrap[data-v-f4a84024]{margin-bottom:10px}.rightbar-wrap .copyright-wrap .copyright[data-v-f4a84024]{font-size:12px;opacity:.75}.rightbar-wrap .copyright-wrap .hash-link[data-v-f4a84024]{font-size:12px}.dark .hottopic-wrap[data-v-f4a84024],.dark .copyright-wrap[data-v-f4a84024]{background-color:#18181c}.sidebar-wrap{z-index:99;width:200px;height:100vh;position:fixed;right:calc(50% + var(--content-main) / 2 + 10px);padding:12px 0;box-sizing:border-box}.sidebar-wrap .n-menu .n-menu-item-content:before{border-radius:21px}.logo-wrap{display:flex;justify-content:flex-start;margin-bottom:12px}.logo-wrap .logo-img{margin-left:24px}.logo-wrap .logo-img:hover{cursor:pointer}.user-wrap{display:flex;align-items:center;position:absolute;bottom:12px;left:12px;right:12px}.user-wrap .user-mini-wrap{display:none}.user-wrap .user-avatar{margin-right:8px}.user-wrap .user-info{display:flex;flex-direction:column}.user-wrap .user-info .nickname{font-size:16px;font-weight:700;line-height:16px;height:16px;margin-bottom:2px;display:flex;align-items:center}.user-wrap .user-info .nickname .nickname-txt{max-width:90px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.user-wrap .user-info .nickname .logout{margin-left:6px}.user-wrap .user-info .username{font-size:14px;line-height:16px;height:16px;width:120px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;opacity:.75}.user-wrap .login-only-wrap{display:flex;justify-content:center;width:100%}.user-wrap .login-only-wrap button{margin:0 4px;width:80%}.user-wrap .login-wrap{display:flex;justify-content:center;width:100%}.user-wrap .login-wrap button{margin:0 4px}.auth-card .n-card-header{z-index:999}@media screen and (max-width: 821px){.sidebar-wrap{width:200px;right:calc(100% - 200px)}.logo-wrap .logo-img{margin-left:12px!important}.user-wrap .user-avatar,.user-wrap .user-info,.user-wrap .login-only-wrap,.user-wrap .login-wrap{margin-bottom:32px}}:root{--content-main: 600px}.app-container{margin:0}.app-container .app-wrap{width:100%;margin:0 auto}.main-wrap{min-height:100vh;display:flex;flex-direction:row;justify-content:center}.main-wrap .content-wrap{width:100%;max-width:var(--content-main);position:relative}.main-wrap .main-content-wrap{margin:0;border-top:none;border-radius:0}.main-wrap .main-content-wrap .n-list-item{padding:0}.empty-wrap{min-height:300px;display:flex;align-items:center;justify-content:center}.following-link{color:#000;color:none;text-decoration:none;cursor:pointer;opacity:.75}.following-link:hover{opacity:.8}.hash-link,.user-link{color:#18a058;text-decoration:none;cursor:pointer}.hash-link:hover,.user-link:hover{opacity:.8}.beian-link{color:#333;text-decoration:none}.beian-link:hover{opacity:.75}.username-link{color:#000;color:none;text-decoration:none;cursor:pointer}.username-link:hover{text-decoration:underline}.dark .hash-link,.dark .user-link{color:#63e2b7}.dark .following-link,.dark .username-link{color:#eee}.dark .beian-link{color:#ddd}@media screen and (max-width: 821px){.content-wrap{top:0;position:absolute!important}}

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 @@
import{$ as E}from"./index-347d1d96.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{U as C,X as N,Y as P,Z as D}from"./@vicons-8f91201d.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 U,r as h,j as $,o as a,c as f,_ as o,V as e,a1 as t,O as c,a as q,Q as _,e as F,M as L,F as Q}from"./@vue-e0e89260.js";const X={key:0},Y={class:"navbar"},oe=U({__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 $(()=>{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",X,[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(()=>[q("div",Y,[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),F(" "+L(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 _};

@ -0,0 +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 _};

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{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-347d1d96.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-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 _};

@ -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-347d1d96.js"></script>
<script type="module" crossorigin src="/assets/index-479e9ef6.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">
@ -27,8 +27,8 @@
<link rel="modulepreload" crossorigin href="/assets/async-validator-dee29e8b.js">
<link rel="modulepreload" crossorigin href="/assets/date-fns-975a2d8f.js">
<link rel="modulepreload" crossorigin href="/assets/naive-ui-62663ad7.js">
<link rel="modulepreload" crossorigin href="/assets/@vicons-8f91201d.js">
<link rel="stylesheet" href="/assets/index-c5cff9e7.css">
<link rel="modulepreload" crossorigin href="/assets/@vicons-0524c43e.js">
<link rel="stylesheet" href="/assets/index-274d7c87.css">
<link rel="stylesheet" href="/assets/vfonts-7afd136d.css">
</head>

@ -69,6 +69,58 @@ export const addFriend = (
});
};
// 关注 用户
export const followUser = (
data: NetParams.FollowUserReq
): Promise<NetReq.FollowUserResp> => {
return request({
method: "post",
url: "/v1/user/follow",
data,
});
};
// 取消关注 用户
export const unfollowUser = (
data: NetParams.UnfollowUserReq
): Promise<NetReq.UnfollowUserResp> => {
return request({
method: "post",
url: "/v1/user/unfollow",
data,
});
};
/**
*
* @param {Object} params
* @returns Promise
*/
export const getUserFollows = (
params: NetParams.GetUserFollows
): Promise<NetReq.GetContacts> => {
return request({
method: "get",
url: "/v1/user/follows",
params,
});
};
/**
*
* @param {Object} params
* @returns Promise
*/
export const getUserFollowings = (
params: NetParams.GetUserFollowings
): Promise<NetReq.GetContacts> => {
return request({
method: "get",
url: "/v1/user/followings",
params,
});
};
/**
*
* @param {Object} data

@ -43,6 +43,18 @@
justify-content: center;
}
.following-link {
color: #000;
color: none;
text-decoration: none;
cursor: pointer;
opacity: 0.75;
&:hover {
opacity: 0.8;
}
}
.hash-link,
.user-link {
color: #18a058;
@ -81,6 +93,7 @@
color: #63e2b7;
}
.following-link,
.username-link {
color: #eee;
}

@ -11,7 +11,7 @@
class="username-link"
:to="{
name: 'user',
query: { username: comment.user.username },
query: { s: comment.user.username },
}"
>
{{ comment.user.nickname }}
@ -145,7 +145,7 @@ const doClickText = (e: MouseEvent, id: number | string) => {
router.push({
name: 'user',
query: {
username: d[1],
s: d[1],
},
});
}

@ -23,7 +23,7 @@ const props = withDefaults(defineProps<{
const goUserProfile = (username: string) => {
router.push({
name: 'user',
query: { username: username },
query: { s: username },
});
};
</script>

@ -0,0 +1,75 @@
<template>
<div class="follow-item" @click="goUserProfile(contact.username)">
<div class="avatar">
<n-avatar size="large" :src="contact.avatar" />
</div>
<div class="base-info">
<div class="username">
<strong>{{ contact.nickname }}</strong>
<span> @{{ contact.username }} </span>
</div>
<div class="uid">UID. {{ contact.user_id }}</div>
</div>
</div>
</template>
<script setup lang="ts">
import { useRouter } from 'vue-router';
const router = useRouter();
const props = withDefaults(defineProps<{
contact: Item.ContactItemProps
}>(), {})
const goUserProfile = (username: string) => {
router.push({
name: 'user',
query: { s: username },
});
};
</script>
<style lang="less" scoped>
.follow-item {
display: flex;
width: 100%;
padding-left: 16px;
padding-right: 16px;
padding-top: 12px;
padding-bottom: 12px;
&:hover {
background: #f7f9f9;
cursor: pointer;
}
.avatar {
width: 55px;
}
.base-info {
position: relative;
width: calc(100% - 55px);
.username {
line-height: 16px;
font-size: 16px;
}
.uid {
font-size: 14px;
line-height: 14px;
margin-top: 10px;
opacity: 0.75;
}
}
}
.dark {
.follow-item {
&:hover {
background: #18181c;
}
background-color: rgba(16, 16, 20, 0.75);
}
}
</style>

@ -14,7 +14,7 @@
<router-link @click.stop class="username-link" :to="{
name: 'user',
query: {
username: message.sender_user.username,
s: message.sender_user.username,
},
}">
{{ message.sender_user.nickname }}

@ -11,7 +11,7 @@
class="username-link"
:to="{
name: 'user',
query: { username: post.user.username },
query: { s: post.user.username },
}"
>
{{ post.user.nickname }}
@ -241,7 +241,7 @@ const doClickText = (e: MouseEvent, id: number) => {
router.push({
name: 'user',
query: {
username: d[1],
s: d[1],
},
});
}

@ -10,7 +10,7 @@
class="username-link"
:to="{
name: 'user',
query: { username: post.user.username },
query: { s: post.user.username },
}"
>
{{ post.user.nickname }}
@ -439,7 +439,7 @@ const doClickText = (e: MouseEvent, id: number) => {
router.push({
name: 'user',
query: {
username: d[1],
s: d[1],
},
});
}

@ -11,7 +11,7 @@
class="username-link"
:to="{
name: 'user',
query: { username: post.user.username },
query: { s: post.user.username },
}"
>
{{ post.user.nickname }}
@ -186,7 +186,7 @@ const doClickText = (e: MouseEvent, id: number) => {
router.push({
name: 'user',
query: {
username: d[1],
s: d[1],
},
});
}

@ -4,7 +4,7 @@
<div class="username">
<router-link class="user-link" :to="{
name: 'user',
query: { username: props.reply.user.username },
query: { s: props.reply.user.username },
}">
{{ props.reply.user.username }}
</router-link>
@ -14,7 +14,7 @@
<router-link class="user-link" :to="{
name: 'user',
query: { username: props.reply.at_user.username },
query: { s: props.reply.at_user.username },
}" v-if="props.reply.at_user_id > 0">
{{ props.reply.at_user.username }}
</router-link>

@ -1,117 +1,125 @@
import { createRouter, createWebHashHistory } from 'vue-router';
import { createRouter, createWebHashHistory } from "vue-router";
const routes = [
{
path: '/',
name: 'home',
meta: {
title: '广场',
keepAlive: true,
},
component: () => import('@/views/Home.vue'),
{
path: "/",
name: "home",
meta: {
title: "广场",
keepAlive: true,
},
{
path: '/post',
name: 'post',
meta: {
title: '话题详情',
},
component: () => import('@/views/Post.vue'),
component: () => import("@/views/Home.vue"),
},
{
path: "/post",
name: "post",
meta: {
title: "泡泡详情",
},
{
path: '/topic',
name: 'topic',
meta: {
title: '话题',
},
component: () => import('@/views/Topic.vue'),
component: () => import("@/views/Post.vue"),
},
{
path: "/topic",
name: "topic",
meta: {
title: "话题",
},
{
path: '/anouncement',
name: 'anouncement',
meta: {
title: '公告',
},
component: () => import('@/views/Anouncement.vue'),
component: () => import("@/views/Topic.vue"),
},
{
path: "/anouncement",
name: "anouncement",
meta: {
title: "公告",
},
{
path: '/profile',
name: 'profile',
meta: {
title: '主页',
},
component: () => import('@/views/Profile.vue'),
component: () => import("@/views/Anouncement.vue"),
},
{
path: "/profile",
name: "profile",
meta: {
title: "主页",
},
{
path: '/user',
name: 'user',
meta: {
title: '用户详情',
},
component: () => import('@/views/User.vue'),
component: () => import("@/views/Profile.vue"),
},
{
path: "/u",
name: "user",
meta: {
title: "用户详情",
},
{
path: '/messages',
name: 'messages',
meta: {
title: '消息',
},
component: () => import('@/views/Messages.vue'),
component: () => import("@/views/User.vue"),
},
{
path: "/messages",
name: "messages",
meta: {
title: "消息",
},
{
path: '/collection',
name: 'collection',
meta: {
title: '收藏',
},
component: () => import('@/views/Collection.vue'),
component: () => import("@/views/Messages.vue"),
},
{
path: "/collection",
name: "collection",
meta: {
title: "收藏",
},
{
path: '/contacts',
name: 'contacts',
meta: {
title: '好友',
},
component: () => import('@/views/Contacts.vue'),
component: () => import("@/views/Collection.vue"),
},
{
path: "/contacts",
name: "contacts",
meta: {
title: "好友",
},
{
path: '/wallet',
name: 'wallet',
meta: {
title: '钱包',
},
component: () => import('@/views/Wallet.vue'),
component: () => import("@/views/Contacts.vue"),
},
{
path: "/following",
name: "following",
meta: {
title: "关注",
},
{
path: '/setting',
name: 'setting',
meta: {
title: '设置',
},
component: () => import('@/views/Setting.vue'),
component: () => import("@/views/Following.vue"),
},
{
path: "/wallet",
name: "wallet",
meta: {
title: "钱包",
},
{
path: '/404',
name: '404',
meta: {
title: '404',
},
component: () => import('@/views/404.vue'),
component: () => import("@/views/Wallet.vue"),
},
{
path: "/setting",
name: "setting",
meta: {
title: "设置",
},
{
path: '/:pathMatch(.*)',
redirect: '/404',
component: () => import("@/views/Setting.vue"),
},
{
path: "/404",
name: "404",
meta: {
title: "404",
},
component: () => import("@/views/404.vue"),
},
{
path: "/:pathMatch(.*)",
redirect: "/404",
},
];
const router = createRouter({
history: createWebHashHistory(),
routes,
history: createWebHashHistory(),
routes,
});
router.beforeEach((to, from, next) => {
document.title = `${to.meta.title} | 泡泡 - 一个清新文艺的微社区`;
next();
document.title = `${to.meta.title} | 泡泡 - 一个清新文艺的微社区`;
next();
});
export default router;

@ -17,6 +17,9 @@ export default createStore({
id: 0,
username: "",
nickname: "",
created_on: 0,
follows: 0,
followings: 0,
},
},
mutations: {
@ -51,7 +54,14 @@ export default createStore({
},
userLogout(state) {
localStorage.removeItem("PAOPAO_TOKEN");
state.userInfo = { id: 0, nickname: "", username: "" };
state.userInfo = {
id: 0,
nickname: "",
username: "",
created_on: 0,
follows: 0,
followings: 0,
};
state.userLogined = false;
},
},

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save