作者 tangxvhui
... ... @@ -52,7 +52,7 @@ type (
MessageBusinessItem {
Id int64 `json:"id"`
Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳)
OptType int `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌)
OptType int `json:"optType"` // 操作类型(1针对文章、2针对评论、3针对圆桌)
CompanyId int64 `json:"companyId"` // 操作人公司ID
UserId int64 `json:"userId"` // 操作人用户ID
RecipientId int64 `json:"recipientId"` // 接收者ID
... ...
... ... @@ -101,6 +101,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
if len(companyIds) > 0 {
_, companyList, err := l.svcCtx.CompanyRepository.Find(l.ctx, conn, domain.NewQueryOptions().
WithFindOnly().
WithKV("companyId", userToken.CompanyId).
WithKV("ids", companyIds).
WithKV("limit", len(companyIds)))
if err != nil {
... ... @@ -115,6 +116,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
if len(userIds) > 0 {
_, userList, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().
WithFindOnly().
WithKV("companyId", userToken.CompanyId).
WithKV("ids", userIds).
WithKV("limit", len(userIds)))
if err != nil {
... ... @@ -129,6 +131,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
if len(commentIds) > 0 {
_, commentList, err := l.svcCtx.ArticleCommentRepository.Find(l.ctx, conn, domain.NewQueryOptions().
WithFindOnly().
WithKV("companyId", userToken.CompanyId).
WithKV("ids", commentIds).
WithKV("limit", len(commentIds)))
if err != nil {
... ... @@ -143,6 +146,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
if len(articleIds) > 0 {
_, articleList, err := l.svcCtx.ArticleRepository.Find(l.ctx, conn, userToken.CompanyId, domain.NewQueryOptions().
WithFindOnly().
WithKV("companyId", userToken.CompanyId).
WithKV("ids", articleIds).
WithKV("limit", len(articleIds)))
if err != nil {
... ... @@ -169,7 +173,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
CreatedAt: item.CreatedAt,
}
if v, ok := userIdMap[item.UserId]; ok {
if v, ok := userIdMap[item.UserId]; ok && v != nil {
to.User = &types.SimpleUser{
Id: v.Id,
CompanyId: v.CompanyId,
... ... @@ -178,12 +182,12 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
Avatar: v.Avatar,
}
if v, ok := companyIdMap[item.CompanyId]; ok {
if v, ok := companyIdMap[item.CompanyId]; ok && v != nil {
to.User.CompanyName = v.Name
}
}
if v, ok := articleIdMap[item.ArticleId]; ok {
if v, ok := articleIdMap[item.ArticleId]; ok && v != nil {
to.Article = &types.SimpleArticle{
Id: v.Id,
Title: v.Title,
... ... @@ -193,7 +197,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
}
}
if v, ok := commentIdMap[item.CommentId]; ok {
if v, ok := commentIdMap[item.CommentId]; ok && v != nil {
to.Comment = &types.SimpleComment{
Id: v.Id,
Content: v.Content,
... ...
... ... @@ -30,6 +30,7 @@ func (l *MiniSystemLogic) MiniSystem(req *types.MessageRequest) (resp *types.Mes
total, list, err := l.svcCtx.MessageSystemRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(), domain.NewQueryOptions().
WithOffsetLimit(req.Page, req.Size).
WithKV("companyId", userToken.CompanyId).
WithKV("recipientId", userToken.UserId))
if err != nil {
return nil, err
... ...
... ... @@ -32,7 +32,7 @@ func (l *MiniMyBeLikedLogic) MiniMyBeLiked(req *types.MiniBeLikedRequest) (resp
total, list, err := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, domain.NewQueryOptions().
WithOffsetLimit(req.Page, req.Size).
WithKV("commentId", userToken.CompanyId).
//WithKV("companyId", userToken.CompanyId). 不存在字段
WithKV("toUserId", userToken.UserId))
if err != nil {
return nil, err
... ...
... ... @@ -32,7 +32,7 @@ func (l *MiniMyLikeLogic) MiniMyLike(req *types.MiniMyLikeRequest) (resp *types.
total, list, err := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, domain.NewQueryOptions().
WithOffsetLimit(req.Page, req.Size).
WithKV("commentId", userToken.CompanyId).
//WithKV("companyId", userToken.CompanyId). 不存在公司id
WithKV("userId", userToken.UserId))
if err != nil {
return nil, err
... ...
... ... @@ -278,7 +278,7 @@ type MessageBusinessResponse struct {
type MessageBusinessItem struct {
Id int64 `json:"id"`
Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳)
OptType int `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌)
OptType int `json:"optType"` // 操作类型(1针对文章、2针对评论、3针对圆桌)
CompanyId int64 `json:"companyId"` // 操作人公司ID
UserId int64 `json:"userId"` // 操作人用户ID
RecipientId int64 `json:"recipientId"` // 接收者ID
... ...
... ... @@ -12,7 +12,7 @@ import (
type MessageBusiness struct {
Id int64 // 唯一标识
Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳)
OptType int `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌)
OptType int `json:"optType"` // 操作类型(1针对文章、2针对评论、3针对圆桌)
CompanyId int64 `json:"companyId"` // 操作人公司ID
UserId int64 `json:"userId"` // 操作人用户ID
RecipientId int64 `json:"recipientId"` // 接收人用户ID
... ...
... ... @@ -127,6 +127,9 @@ func (repository *ArticleCommentRepository) Find(ctx context.Context, conn trans
if v, ok := queryOptions["topId"]; ok {
tx = tx.Where("top_id=?", v)
}
if v, ok := queryOptions["ids"]; ok {
tx = tx.Where("id in (?)", v)
}
if v, ok := queryOptions["show"]; ok {
tx = tx.Where("show=?", v)
}
... ...
... ... @@ -8,7 +8,7 @@ import (
type MessageBusiness struct {
Id int64 // 唯一标识
Type MsgBusinessType `json:"type"` // 分类 (1回复 2点赞 3被采纳)
OptType MsgBusinessOpt `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌)
OptType MsgBusinessOpt `json:"optType"` // 操作类型(1针对文章、2针对评论、3针对圆桌)
CompanyId int64 `json:"companyId"` // 操作人公司ID
UserId int64 `json:"userId"` // 操作人用户ID
RecipientId int64 `json:"recipientId"` // 接收人用户ID
... ...