作者 庄敏学

评论查询参数

@@ -230,7 +230,7 @@ type ( @@ -230,7 +230,7 @@ type (
230 Size int `json:"size"` 230 Size int `json:"size"`
231 ArticleId int64 `json:"articleId"` // 文章ID 231 ArticleId int64 `json:"articleId"` // 文章ID
232 TopId int64 `json:"topId,optional"` // 文章顶层ID 232 TopId int64 `json:"topId,optional"` // 文章顶层ID
233 - AuthorId int64 `json:"authorId,optional"` // 用户 233 + Author string `json:"author,optional"` // 用户
234 Show int `json:"show,optional"` // 显示状态 234 Show int `json:"show,optional"` // 显示状态
235 BeginTime int64 `json:"beginTime,optional"` // 开始时间 235 BeginTime int64 `json:"beginTime,optional"` // 开始时间
236 EndTime int64 `json:"endTime,optional"` // 结束时间 236 EndTime int64 `json:"endTime,optional"` // 结束时间
@@ -32,7 +32,7 @@ func (l *SystemArticleCommentSearchLogic) SystemArticleCommentSearch(req *types. @@ -32,7 +32,7 @@ func (l *SystemArticleCommentSearchLogic) SystemArticleCommentSearch(req *types.
32 WithOffsetLimit(req.Page, req.Size). 32 WithOffsetLimit(req.Page, req.Size).
33 WithKV("articleId", req.ArticleId). 33 WithKV("articleId", req.ArticleId).
34 WithKV("topId", req.TopId). 34 WithKV("topId", req.TopId).
35 - WithKV("fromUserId", req.AuthorId). 35 + WithKV("fromUserName", req.Author).
36 WithKV("beginCreatedAt", req.BeginTime). 36 WithKV("beginCreatedAt", req.BeginTime).
37 WithKV("endCreatedAt", req.EndTime) 37 WithKV("endCreatedAt", req.EndTime)
38 total, comments, err := l.svcCtx.ArticleCommentRepository.Find(l.ctx, conn, queryOptions) 38 total, comments, err := l.svcCtx.ArticleCommentRepository.Find(l.ctx, conn, queryOptions)
@@ -141,7 +141,7 @@ type SystemArticleCommentSearchRequest struct { @@ -141,7 +141,7 @@ type SystemArticleCommentSearchRequest struct {
141 Size int `json:"size"` 141 Size int `json:"size"`
142 ArticleId int64 `json:"articleId"` // 文章ID 142 ArticleId int64 `json:"articleId"` // 文章ID
143 TopId int64 `json:"topId,optional"` // 文章顶层ID 143 TopId int64 `json:"topId,optional"` // 文章顶层ID
144 - AuthorId int64 `json:"authorId,optional"` // 用户 144 + Author string `json:"author,optional"` // 用户
145 Show int `json:"show,optional"` // 显示状态 145 Show int `json:"show,optional"` // 显示状态
146 BeginTime int64 `json:"beginTime,optional"` // 开始时间 146 BeginTime int64 `json:"beginTime,optional"` // 开始时间
147 EndTime int64 `json:"endTime,optional"` // 结束时间 147 EndTime int64 `json:"endTime,optional"` // 结束时间
@@ -149,6 +149,9 @@ func (repository *ArticleCommentRepository) Find(ctx context.Context, conn trans @@ -149,6 +149,9 @@ func (repository *ArticleCommentRepository) Find(ctx context.Context, conn trans
149 if v, ok := queryOptions["endCreatedAt"]; ok { 149 if v, ok := queryOptions["endCreatedAt"]; ok {
150 tx = tx.Where("created_at < ?", v) 150 tx = tx.Where("created_at < ?", v)
151 } 151 }
  152 + if v, ok := queryOptions["fromUserName"]; ok && v.(string) != "" {
  153 + tx = tx.Where(`from_user #>> '{"name"}' like ?`, "%"+v.(string)+"%")
  154 + }
152 155
153 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { 156 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
154 return dms, tx.Error 157 return dms, tx.Error