作者 tangxvhui

Merge branch 'dev' into test

@@ -29,7 +29,7 @@ func (l *SystemListAticleCommentLogic) SystemListAticleComment(req *types.System @@ -29,7 +29,7 @@ func (l *SystemListAticleCommentLogic) SystemListAticleComment(req *types.System
29 var conn = l.svcCtx.DefaultDBConn() 29 var conn = l.svcCtx.DefaultDBConn()
30 30
31 cnt, commentList, err := l.svcCtx.ArticleCommentRepository.CustomSearchBy(l.ctx, conn, req.CompanyId, req.Page, req.Size, 31 cnt, commentList, err := l.svcCtx.ArticleCommentRepository.CustomSearchBy(l.ctx, conn, req.CompanyId, req.Page, req.Size,
32 - req.TopId, req.ArticleTitle, req.Content, req.FromUser, req.Show, 32 + req.TopId, req.ArticleTitle, req.Content, req.FromUser, req.Show, [2]int64{req.BeginTime, req.EndTime},
33 ) 33 )
34 if err != nil { 34 if err != nil {
35 return nil, xerr.NewErrMsgErr("获取评论列表失败", err) 35 return nil, xerr.NewErrMsgErr("获取评论列表失败", err)
@@ -330,7 +330,7 @@ func (repository *ArticleCommentRepository) Top5Comment(ctx context.Context, con @@ -330,7 +330,7 @@ func (repository *ArticleCommentRepository) Top5Comment(ctx context.Context, con
330 } 330 }
331 331
332 func (repository *ArticleCommentRepository) CustomSearchBy(ctx context.Context, conn transaction.Conn, companyId int64, page int, size int, 332 func (repository *ArticleCommentRepository) CustomSearchBy(ctx context.Context, conn transaction.Conn, companyId int64, page int, size int,
333 - topId int64, articleTitle string, contentLike string, fromUserName string, show int) (int, []*domain.ArticleCommentShow, error) { 333 + topId int64, articleTitle string, contentLike string, fromUserName string, show int, createdAtRange [2]int64) (int, []*domain.ArticleCommentShow, error) {
334 334
335 if size <= 0 { 335 if size <= 0 {
336 size = 20 336 size = 20
@@ -364,6 +364,17 @@ func (repository *ArticleCommentRepository) CustomSearchBy(ctx context.Context, @@ -364,6 +364,17 @@ func (repository *ArticleCommentRepository) CustomSearchBy(ctx context.Context,
364 where += ` and article_comment."top_id"= ? ` 364 where += ` and article_comment."top_id"= ? `
365 condition = append(condition, topId) 365 condition = append(condition, topId)
366 } 366 }
  367 +
  368 + if createdAtRange[0] > 0 {
  369 + where += ` and article_comment.created_at >=? `
  370 + condition = append(condition, createdAtRange[0])
  371 + }
  372 +
  373 + if createdAtRange[1] > 0 {
  374 + where += ` and article_comment.created_at <=? `
  375 + condition = append(condition, createdAtRange[1])
  376 + }
  377 +
367 countSql := `select 378 countSql := `select
368 count(*) 379 count(*)
369 from article_comment 380 from article_comment
@@ -77,5 +77,5 @@ type ArticleCommentRepository interface { @@ -77,5 +77,5 @@ type ArticleCommentRepository interface {
77 Top5Comment(ctx context.Context, conn transaction.Conn, companyId int64, articleId int64) ([]*ArticleComment, error) 77 Top5Comment(ctx context.Context, conn transaction.Conn, companyId int64, articleId int64) ([]*ArticleComment, error)
78 // 特定的查询 78 // 特定的查询
79 CustomSearchBy(ctx context.Context, conn transaction.Conn, companyId int64, page int, size int, 79 CustomSearchBy(ctx context.Context, conn transaction.Conn, companyId int64, page int, size int,
80 - topId int64, articleTitle string, contentLike string, fromUserName string, show int) (int, []*ArticleCommentShow, error) 80 + topId int64, articleTitle string, contentLike string, fromUserName string, show int, createdAtRange [2]int64) (int, []*ArticleCommentShow, error)
81 } 81 }