作者 tangxvhui

修复bug 4526

@@ -106,6 +106,7 @@ type ( @@ -106,6 +106,7 @@ type (
106 106
107 CommentAtWho { 107 CommentAtWho {
108 Id int64 `json:"id"` 108 Id int64 `json:"id"`
  109 + Avatar string `json:"avatar,optional"` // 人员头像URL
109 Name string `json:"name,optional"` 110 Name string `json:"name,optional"`
110 FirstLetter string `json:"firstLetter,optional"` 111 FirstLetter string `json:"firstLetter,optional"`
111 } 112 }
@@ -11,6 +11,7 @@ import ( @@ -11,6 +11,7 @@ import (
11 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" 11 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
12 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" 12 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
13 13
  14 + "github.com/samber/lo"
14 "github.com/zeromicro/go-zero/core/logx" 15 "github.com/zeromicro/go-zero/core/logx"
15 ) 16 )
16 17
@@ -61,6 +62,7 @@ func (l *MiniArticleSetTagLogic) MiniArticleSetTag(req *types.MiniArticleSetTagR @@ -61,6 +62,7 @@ func (l *MiniArticleSetTagLogic) MiniArticleSetTag(req *types.MiniArticleSetTagR
61 } 62 }
62 articleAndTagList = append(articleAndTagList, articleAndTag) 63 articleAndTagList = append(articleAndTagList, articleAndTag)
63 } 64 }
  65 + tagIdList = lo.Union(tagIdList)
64 //更新article中的tags 66 //更新article中的tags
65 articleInfo.Tags = tagIdList 67 articleInfo.Tags = tagIdList
66 // 查询可能存在的 ArticleAndTag 68 // 查询可能存在的 ArticleAndTag
@@ -40,7 +40,7 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr @@ -40,7 +40,7 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr
40 } 40 }
41 41
42 var userList []*domain.User 42 var userList []*domain.User
43 - if len(articleInfo.WhoRead) == 0 { 43 + if articleInfo.TargetUser == domain.ArticleTargetAll {
44 //获取所有人 44 //获取所有人
45 queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("companyId", articleInfo.CompanyId) 45 queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("companyId", articleInfo.CompanyId)
46 _, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) 46 _, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
@@ -49,6 +49,7 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr @@ -49,6 +49,7 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr
49 return resp, nil 49 return resp, nil
50 } 50 }
51 } else { 51 } else {
  52 + if len(articleInfo.WhoRead) > 0 {
52 queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("ids", articleInfo.WhoRead) 53 queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("ids", articleInfo.WhoRead)
53 _, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) 54 _, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
54 if err != nil { 55 if err != nil {
@@ -56,13 +57,13 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr @@ -56,13 +57,13 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr
56 return resp, nil 57 return resp, nil
57 } 58 }
58 } 59 }
59 - 60 + }
60 uList := make([]types.CommentAtWho, len(userList)) 61 uList := make([]types.CommentAtWho, len(userList))
61 -  
62 for i := range userList { 62 for i := range userList {
63 uList[i] = types.CommentAtWho{ 63 uList[i] = types.CommentAtWho{
64 Id: userList[i].Id, 64 Id: userList[i].Id,
65 Name: userList[i].Name, 65 Name: userList[i].Name,
  66 + Avatar: userList[i].Avatar,
66 FirstLetter: "", 67 FirstLetter: "",
67 } 68 }
68 for _, val := range userList[i].PinYinName { 69 for _, val := range userList[i].PinYinName {
@@ -34,6 +34,7 @@ type MiniCreateArticleCommentRequest struct { @@ -34,6 +34,7 @@ type MiniCreateArticleCommentRequest struct {
34 34
35 type CommentAtWho struct { 35 type CommentAtWho struct {
36 Id int64 `json:"id"` 36 Id int64 `json:"id"`
  37 + Avatar string `json:"avatar,optional"` // 人员头像URL
37 Name string `json:"name,optional"` 38 Name string `json:"name,optional"`
38 FirstLetter string `json:"firstLetter,optional"` 39 FirstLetter string `json:"firstLetter,optional"`
39 } 40 }