|
@@ -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 {
|