作者 yangfu
@@ -262,7 +262,7 @@ type ( @@ -262,7 +262,7 @@ type (
262 Page int `json:"page"` 262 Page int `json:"page"`
263 Size int `json:"size"` 263 Size int `json:"size"`
264 CompanyId int64 `json:",optional"` // 264 CompanyId int64 `json:",optional"` //
265 - TopId int64 `json:"topId"` // 评论的顶层ID 265 + TopId int64 `json:"topId,optional"` // 评论的顶层ID
266 FromUser string `json:"fromUser,optional"` // 用户 266 FromUser string `json:"fromUser,optional"` // 用户
267 Show int `json:"show,optional"` // 显示状态 267 Show int `json:"show,optional"` // 显示状态
268 BeginTime int64 `json:"beginTime,optional"` // 填写评论的开始时间 268 BeginTime int64 `json:"beginTime,optional"` // 填写评论的开始时间
@@ -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)
@@ -151,6 +151,18 @@ func (l *SystemUserInfoLogic) initSystemData(companyId int64) error { @@ -151,6 +151,18 @@ func (l *SystemUserInfoLogic) initSystemData(companyId int64) error {
151 Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0}, 151 Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
152 Name: "中机会低风险", Category: "机会风险", Remark: "解决问题多手准备", SortBy: 10, 152 Name: "中机会低风险", Category: "机会风险", Remark: "解决问题多手准备", SortBy: 10,
153 }, 153 },
  154 + {
  155 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  156 + Name: "小机会高风险", Category: "机会风险", Remark: "有空看看", SortBy: 11,
  157 + },
  158 + {
  159 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  160 + Name: "小机会中风险", Category: "机会风险", Remark: "持续监控做好控制", SortBy: 12,
  161 + },
  162 + {
  163 + Id: 0, CompanyId: companyId, Image: domain.Image{Url: "", Width: 0, Height: 0},
  164 + Name: "小机会低风险", Category: "机会风险", Remark: "全员警戒马上解决", SortBy: 13,
  165 + },
154 } 166 }
155 err = l.svcCtx.ArticleTagRepository.CreateInBatches(l.ctx, conn, articleTags) 167 err = l.svcCtx.ArticleTagRepository.CreateInBatches(l.ctx, conn, articleTags)
156 if err != nil { 168 if err != nil {
@@ -179,7 +179,7 @@ type SystemListCommentRequest struct { @@ -179,7 +179,7 @@ type SystemListCommentRequest struct {
179 Page int `json:"page"` 179 Page int `json:"page"`
180 Size int `json:"size"` 180 Size int `json:"size"`
181 CompanyId int64 `json:",optional"` // 181 CompanyId int64 `json:",optional"` //
182 - TopId int64 `json:"topId"` // 评论的顶层ID 182 + TopId int64 `json:"topId,optional"` // 评论的顶层ID
183 FromUser string `json:"fromUser,optional"` // 用户 183 FromUser string `json:"fromUser,optional"` // 用户
184 Show int `json:"show,optional"` // 显示状态 184 Show int `json:"show,optional"` // 显示状态
185 BeginTime int64 `json:"beginTime,optional"` // 填写评论的开始时间 185 BeginTime int64 `json:"beginTime,optional"` // 填写评论的开始时间
@@ -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 }