作者 tangxvhui

修复bug 4526

... ... @@ -106,6 +106,7 @@ type (
CommentAtWho {
Id int64 `json:"id"`
Avatar string `json:"avatar,optional"` // 人员头像URL
Name string `json:"name,optional"`
FirstLetter string `json:"firstLetter,optional"`
}
... ...
... ... @@ -11,6 +11,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"github.com/samber/lo"
"github.com/zeromicro/go-zero/core/logx"
)
... ... @@ -61,6 +62,7 @@ func (l *MiniArticleSetTagLogic) MiniArticleSetTag(req *types.MiniArticleSetTagR
}
articleAndTagList = append(articleAndTagList, articleAndTag)
}
tagIdList = lo.Union(tagIdList)
//更新article中的tags
articleInfo.Tags = tagIdList
// 查询可能存在的 ArticleAndTag
... ...
... ... @@ -40,7 +40,7 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr
}
var userList []*domain.User
if len(articleInfo.WhoRead) == 0 {
if articleInfo.TargetUser == domain.ArticleTargetAll {
//获取所有人
queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("companyId", articleInfo.CompanyId)
_, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
... ... @@ -49,20 +49,21 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr
return resp, nil
}
} else {
queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("ids", articleInfo.WhoRead)
_, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
if err != nil {
resp = &types.MiniArticleCommentAtWhoResponse{}
return resp, nil
if len(articleInfo.WhoRead) > 0 {
queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("ids", articleInfo.WhoRead)
_, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
if err != nil {
resp = &types.MiniArticleCommentAtWhoResponse{}
return resp, nil
}
}
}
uList := make([]types.CommentAtWho, len(userList))
for i := range userList {
uList[i] = types.CommentAtWho{
Id: userList[i].Id,
Name: userList[i].Name,
Avatar: userList[i].Avatar,
FirstLetter: "",
}
for _, val := range userList[i].PinYinName {
... ...
... ... @@ -34,6 +34,7 @@ type MiniCreateArticleCommentRequest struct {
type CommentAtWho struct {
Id int64 `json:"id"`
Avatar string `json:"avatar,optional"` // 人员头像URL
Name string `json:"name,optional"`
FirstLetter string `json:"firstLetter,optional"`
}
... ...