作者 tangxvhui
@@ -352,9 +352,10 @@ type( @@ -352,9 +352,10 @@ type(
352 ItemFlag int `json:"itemFlag"` //0:默认查询所有 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳 352 ItemFlag int `json:"itemFlag"` //0:默认查询所有 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳
353 } 353 }
354 UserStatisticsResponse{ 354 UserStatisticsResponse{
355 - TotalArticle int `json:"totalArticle"`  
356 - TotalComment int `json:"totalComment"`  
357 - TotalLoved int `json:"totalLoved"` 355 + TotalArticle int `json:"totalArticle"` // 累计发布文章
  356 + TotalComment int `json:"totalComment"` // 累计发布评论
  357 + TotalLoved int `json:"totalLoved"` // 累计赞别人
  358 + TotalBeLoved int `json:"totalBeLoved"` // 累计收到的赞
358 } 359 }
359 StatisticsItem{ 360 StatisticsItem{
360 ItemFlag int `json:"itemFlag"` // 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳 361 ItemFlag int `json:"itemFlag"` // 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳
@@ -35,6 +35,7 @@ func (l *SystemUserStatisticsLogic) SystemUserStatistics(req *types.UserStatisti @@ -35,6 +35,7 @@ func (l *SystemUserStatisticsLogic) SystemUserStatistics(req *types.UserStatisti
35 TotalArticle: s.TotalArticle, 35 TotalArticle: s.TotalArticle,
36 TotalComment: s.TotalComment, 36 TotalComment: s.TotalComment,
37 TotalLoved: s.TotalLoved, 37 TotalLoved: s.TotalLoved,
  38 + TotalBeLoved: s.TotalBeLoved,
38 } 39 }
39 return 40 return
40 } 41 }
@@ -57,8 +58,13 @@ func StatisticsItems(ctx context.Context, svcCtx *svc.ServiceContext, companyId, @@ -57,8 +58,13 @@ func StatisticsItems(ctx context.Context, svcCtx *svc.ServiceContext, companyId,
57 } 58 }
58 if (itemFlag & TotalLoved) > 0 { 59 if (itemFlag & TotalLoved) > 0 {
59 var total int64 60 var total int64
60 - total, _, _ = svcCtx.UserLoveFlagRepository.Find(ctx, conn, domain.IndexCompanyId(companyId)().WithCountOnly().MustWithKV("userId", userId))  
61 - s.TotalComment = int(total) 61 + total, _, _ = svcCtx.UserLoveFlagRepository.Find(ctx, conn, domain.IndexCompanyId(0)().WithCountOnly().MustWithKV("userId", userId))
  62 + s.TotalLoved = int(total)
  63 + }
  64 + if (itemFlag & TotalBeLoved) > 0 {
  65 + var total int64
  66 + total, _, _ = svcCtx.UserLoveFlagRepository.Find(ctx, conn, domain.IndexCompanyId(0)().WithCountOnly().MustWithKV("toUserId", userId))
  67 + s.TotalBeLoved = int(total)
62 } 68 }
63 return 69 return
64 } 70 }
@@ -67,12 +73,14 @@ type Statistics struct { @@ -67,12 +73,14 @@ type Statistics struct {
67 TotalArticle int `json:"totalArticle"` 73 TotalArticle int `json:"totalArticle"`
68 TotalComment int `json:"totalComment"` 74 TotalComment int `json:"totalComment"`
69 TotalLoved int `json:"totalLoved"` 75 TotalLoved int `json:"totalLoved"`
  76 + TotalBeLoved int `json:"totalBeLoved"`
70 } 77 }
71 78
72 const ( 79 const (
73 - TotalArticle = 1  
74 - TotalComment = 2  
75 - TotalLoved = 4 80 + TotalArticle = 1 // 累计发布文章
  81 + TotalComment = 2 // 累计发布评论
  82 + TotalLoved = 4 // 累计赞别人
  83 + TotalBeLoved = 8 // 累计收到的赞
76 ) 84 )
77 85
78 func NewStatisticsItem(itemFlag int, value float64) types.StatisticsItem { 86 func NewStatisticsItem(itemFlag int, value float64) types.StatisticsItem {
@@ -642,9 +642,10 @@ type UserStatisticsRequest struct { @@ -642,9 +642,10 @@ type UserStatisticsRequest struct {
642 } 642 }
643 643
644 type UserStatisticsResponse struct { 644 type UserStatisticsResponse struct {
645 - TotalArticle int `json:"totalArticle"`  
646 - TotalComment int `json:"totalComment"`  
647 - TotalLoved int `json:"totalLoved"` 645 + TotalArticle int `json:"totalArticle"` // 累计发布文章
  646 + TotalComment int `json:"totalComment"` // 累计发布评论
  647 + TotalLoved int `json:"totalLoved"` // 累计赞别人
  648 + TotalBeLoved int `json:"totalBeLoved"` // 累计收到的赞
648 } 649 }
649 650
650 type StatisticsItem struct { 651 type StatisticsItem struct {