作者 tangxvhui
@@ -52,7 +52,7 @@ type ( @@ -52,7 +52,7 @@ type (
52 MessageBusinessItem { 52 MessageBusinessItem {
53 Id int64 `json:"id"` 53 Id int64 `json:"id"`
54 Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳) 54 Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳)
55 - OptType int `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌) 55 + OptType int `json:"optType"` // 操作类型(1针对文章、2针对评论、3针对圆桌)
56 CompanyId int64 `json:"companyId"` // 操作人公司ID 56 CompanyId int64 `json:"companyId"` // 操作人公司ID
57 UserId int64 `json:"userId"` // 操作人用户ID 57 UserId int64 `json:"userId"` // 操作人用户ID
58 RecipientId int64 `json:"recipientId"` // 接收者ID 58 RecipientId int64 `json:"recipientId"` // 接收者ID
@@ -101,6 +101,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma @@ -101,6 +101,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
101 if len(companyIds) > 0 { 101 if len(companyIds) > 0 {
102 _, companyList, err := l.svcCtx.CompanyRepository.Find(l.ctx, conn, domain.NewQueryOptions(). 102 _, companyList, err := l.svcCtx.CompanyRepository.Find(l.ctx, conn, domain.NewQueryOptions().
103 WithFindOnly(). 103 WithFindOnly().
  104 + WithKV("companyId", userToken.CompanyId).
104 WithKV("ids", companyIds). 105 WithKV("ids", companyIds).
105 WithKV("limit", len(companyIds))) 106 WithKV("limit", len(companyIds)))
106 if err != nil { 107 if err != nil {
@@ -115,6 +116,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma @@ -115,6 +116,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
115 if len(userIds) > 0 { 116 if len(userIds) > 0 {
116 _, userList, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions(). 117 _, userList, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().
117 WithFindOnly(). 118 WithFindOnly().
  119 + WithKV("companyId", userToken.CompanyId).
118 WithKV("ids", userIds). 120 WithKV("ids", userIds).
119 WithKV("limit", len(userIds))) 121 WithKV("limit", len(userIds)))
120 if err != nil { 122 if err != nil {
@@ -129,6 +131,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma @@ -129,6 +131,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
129 if len(commentIds) > 0 { 131 if len(commentIds) > 0 {
130 _, commentList, err := l.svcCtx.ArticleCommentRepository.Find(l.ctx, conn, domain.NewQueryOptions(). 132 _, commentList, err := l.svcCtx.ArticleCommentRepository.Find(l.ctx, conn, domain.NewQueryOptions().
131 WithFindOnly(). 133 WithFindOnly().
  134 + WithKV("companyId", userToken.CompanyId).
132 WithKV("ids", commentIds). 135 WithKV("ids", commentIds).
133 WithKV("limit", len(commentIds))) 136 WithKV("limit", len(commentIds)))
134 if err != nil { 137 if err != nil {
@@ -143,6 +146,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma @@ -143,6 +146,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
143 if len(articleIds) > 0 { 146 if len(articleIds) > 0 {
144 _, articleList, err := l.svcCtx.ArticleRepository.Find(l.ctx, conn, userToken.CompanyId, domain.NewQueryOptions(). 147 _, articleList, err := l.svcCtx.ArticleRepository.Find(l.ctx, conn, userToken.CompanyId, domain.NewQueryOptions().
145 WithFindOnly(). 148 WithFindOnly().
  149 + WithKV("companyId", userToken.CompanyId).
146 WithKV("ids", articleIds). 150 WithKV("ids", articleIds).
147 WithKV("limit", len(articleIds))) 151 WithKV("limit", len(articleIds)))
148 if err != nil { 152 if err != nil {
@@ -169,7 +173,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma @@ -169,7 +173,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
169 CreatedAt: item.CreatedAt, 173 CreatedAt: item.CreatedAt,
170 } 174 }
171 175
172 - if v, ok := userIdMap[item.UserId]; ok { 176 + if v, ok := userIdMap[item.UserId]; ok && v != nil {
173 to.User = &types.SimpleUser{ 177 to.User = &types.SimpleUser{
174 Id: v.Id, 178 Id: v.Id,
175 CompanyId: v.CompanyId, 179 CompanyId: v.CompanyId,
@@ -178,12 +182,12 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma @@ -178,12 +182,12 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
178 Avatar: v.Avatar, 182 Avatar: v.Avatar,
179 } 183 }
180 184
181 - if v, ok := companyIdMap[item.CompanyId]; ok { 185 + if v, ok := companyIdMap[item.CompanyId]; ok && v != nil {
182 to.User.CompanyName = v.Name 186 to.User.CompanyName = v.Name
183 } 187 }
184 } 188 }
185 189
186 - if v, ok := articleIdMap[item.ArticleId]; ok { 190 + if v, ok := articleIdMap[item.ArticleId]; ok && v != nil {
187 to.Article = &types.SimpleArticle{ 191 to.Article = &types.SimpleArticle{
188 Id: v.Id, 192 Id: v.Id,
189 Title: v.Title, 193 Title: v.Title,
@@ -193,7 +197,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma @@ -193,7 +197,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
193 } 197 }
194 } 198 }
195 199
196 - if v, ok := commentIdMap[item.CommentId]; ok { 200 + if v, ok := commentIdMap[item.CommentId]; ok && v != nil {
197 to.Comment = &types.SimpleComment{ 201 to.Comment = &types.SimpleComment{
198 Id: v.Id, 202 Id: v.Id,
199 Content: v.Content, 203 Content: v.Content,
@@ -30,6 +30,7 @@ func (l *MiniSystemLogic) MiniSystem(req *types.MessageRequest) (resp *types.Mes @@ -30,6 +30,7 @@ func (l *MiniSystemLogic) MiniSystem(req *types.MessageRequest) (resp *types.Mes
30 30
31 total, list, err := l.svcCtx.MessageSystemRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(), domain.NewQueryOptions(). 31 total, list, err := l.svcCtx.MessageSystemRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(), domain.NewQueryOptions().
32 WithOffsetLimit(req.Page, req.Size). 32 WithOffsetLimit(req.Page, req.Size).
  33 + WithKV("companyId", userToken.CompanyId).
33 WithKV("recipientId", userToken.UserId)) 34 WithKV("recipientId", userToken.UserId))
34 if err != nil { 35 if err != nil {
35 return nil, err 36 return nil, err
@@ -32,7 +32,7 @@ func (l *MiniMyBeLikedLogic) MiniMyBeLiked(req *types.MiniBeLikedRequest) (resp @@ -32,7 +32,7 @@ func (l *MiniMyBeLikedLogic) MiniMyBeLiked(req *types.MiniBeLikedRequest) (resp
32 32
33 total, list, err := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, domain.NewQueryOptions(). 33 total, list, err := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, domain.NewQueryOptions().
34 WithOffsetLimit(req.Page, req.Size). 34 WithOffsetLimit(req.Page, req.Size).
35 - WithKV("commentId", userToken.CompanyId). 35 + //WithKV("companyId", userToken.CompanyId). 不存在字段
36 WithKV("toUserId", userToken.UserId)) 36 WithKV("toUserId", userToken.UserId))
37 if err != nil { 37 if err != nil {
38 return nil, err 38 return nil, err
@@ -32,7 +32,7 @@ func (l *MiniMyLikeLogic) MiniMyLike(req *types.MiniMyLikeRequest) (resp *types. @@ -32,7 +32,7 @@ func (l *MiniMyLikeLogic) MiniMyLike(req *types.MiniMyLikeRequest) (resp *types.
32 32
33 total, list, err := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, domain.NewQueryOptions(). 33 total, list, err := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, domain.NewQueryOptions().
34 WithOffsetLimit(req.Page, req.Size). 34 WithOffsetLimit(req.Page, req.Size).
35 - WithKV("commentId", userToken.CompanyId). 35 + //WithKV("companyId", userToken.CompanyId). 不存在公司id
36 WithKV("userId", userToken.UserId)) 36 WithKV("userId", userToken.UserId))
37 if err != nil { 37 if err != nil {
38 return nil, err 38 return nil, err
@@ -278,7 +278,7 @@ type MessageBusinessResponse struct { @@ -278,7 +278,7 @@ type MessageBusinessResponse struct {
278 type MessageBusinessItem struct { 278 type MessageBusinessItem struct {
279 Id int64 `json:"id"` 279 Id int64 `json:"id"`
280 Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳) 280 Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳)
281 - OptType int `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌) 281 + OptType int `json:"optType"` // 操作类型(1针对文章、2针对评论、3针对圆桌)
282 CompanyId int64 `json:"companyId"` // 操作人公司ID 282 CompanyId int64 `json:"companyId"` // 操作人公司ID
283 UserId int64 `json:"userId"` // 操作人用户ID 283 UserId int64 `json:"userId"` // 操作人用户ID
284 RecipientId int64 `json:"recipientId"` // 接收者ID 284 RecipientId int64 `json:"recipientId"` // 接收者ID
@@ -12,7 +12,7 @@ import ( @@ -12,7 +12,7 @@ import (
12 type MessageBusiness struct { 12 type MessageBusiness struct {
13 Id int64 // 唯一标识 13 Id int64 // 唯一标识
14 Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳) 14 Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳)
15 - OptType int `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌) 15 + OptType int `json:"optType"` // 操作类型(1针对文章、2针对评论、3针对圆桌)
16 CompanyId int64 `json:"companyId"` // 操作人公司ID 16 CompanyId int64 `json:"companyId"` // 操作人公司ID
17 UserId int64 `json:"userId"` // 操作人用户ID 17 UserId int64 `json:"userId"` // 操作人用户ID
18 RecipientId int64 `json:"recipientId"` // 接收人用户ID 18 RecipientId int64 `json:"recipientId"` // 接收人用户ID
@@ -127,6 +127,9 @@ func (repository *ArticleCommentRepository) Find(ctx context.Context, conn trans @@ -127,6 +127,9 @@ func (repository *ArticleCommentRepository) Find(ctx context.Context, conn trans
127 if v, ok := queryOptions["topId"]; ok { 127 if v, ok := queryOptions["topId"]; ok {
128 tx = tx.Where("top_id=?", v) 128 tx = tx.Where("top_id=?", v)
129 } 129 }
  130 + if v, ok := queryOptions["ids"]; ok {
  131 + tx = tx.Where("id in (?)", v)
  132 + }
130 if v, ok := queryOptions["show"]; ok { 133 if v, ok := queryOptions["show"]; ok {
131 tx = tx.Where("show=?", v) 134 tx = tx.Where("show=?", v)
132 } 135 }
@@ -8,7 +8,7 @@ import ( @@ -8,7 +8,7 @@ import (
8 type MessageBusiness struct { 8 type MessageBusiness struct {
9 Id int64 // 唯一标识 9 Id int64 // 唯一标识
10 Type MsgBusinessType `json:"type"` // 分类 (1回复 2点赞 3被采纳) 10 Type MsgBusinessType `json:"type"` // 分类 (1回复 2点赞 3被采纳)
11 - OptType MsgBusinessOpt `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌) 11 + OptType MsgBusinessOpt `json:"optType"` // 操作类型(1针对文章、2针对评论、3针对圆桌)
12 CompanyId int64 `json:"companyId"` // 操作人公司ID 12 CompanyId int64 `json:"companyId"` // 操作人公司ID
13 UserId int64 `json:"userId"` // 操作人用户ID 13 UserId int64 `json:"userId"` // 操作人用户ID
14 RecipientId int64 `json:"recipientId"` // 接收人用户ID 14 RecipientId int64 `json:"recipientId"` // 接收人用户ID