...
|
...
|
@@ -35,6 +35,7 @@ func (l *SystemUserStatisticsLogic) SystemUserStatistics(req *types.UserStatisti |
|
|
TotalArticle: s.TotalArticle,
|
|
|
TotalComment: s.TotalComment,
|
|
|
TotalLoved: s.TotalLoved,
|
|
|
TotalBeLoved: s.TotalBeLoved,
|
|
|
}
|
|
|
return
|
|
|
}
|
...
|
...
|
@@ -57,8 +58,13 @@ func StatisticsItems(ctx context.Context, svcCtx *svc.ServiceContext, companyId, |
|
|
}
|
|
|
if (itemFlag & TotalLoved) > 0 {
|
|
|
var total int64
|
|
|
total, _, _ = svcCtx.UserLoveFlagRepository.Find(ctx, conn, domain.IndexCompanyId(companyId)().WithCountOnly().MustWithKV("userId", userId))
|
|
|
s.TotalComment = int(total)
|
|
|
total, _, _ = svcCtx.UserLoveFlagRepository.Find(ctx, conn, domain.IndexCompanyId(0)().WithCountOnly().MustWithKV("userId", userId))
|
|
|
s.TotalLoved = int(total)
|
|
|
}
|
|
|
if (itemFlag & TotalBeLoved) > 0 {
|
|
|
var total int64
|
|
|
total, _, _ = svcCtx.UserLoveFlagRepository.Find(ctx, conn, domain.IndexCompanyId(0)().WithCountOnly().MustWithKV("toUserId", userId))
|
|
|
s.TotalBeLoved = int(total)
|
|
|
}
|
|
|
return
|
|
|
}
|
...
|
...
|
@@ -67,12 +73,14 @@ type Statistics struct { |
|
|
TotalArticle int `json:"totalArticle"`
|
|
|
TotalComment int `json:"totalComment"`
|
|
|
TotalLoved int `json:"totalLoved"`
|
|
|
TotalBeLoved int `json:"totalBeLoved"`
|
|
|
}
|
|
|
|
|
|
const (
|
|
|
TotalArticle = 1
|
|
|
TotalComment = 2
|
|
|
TotalLoved = 4
|
|
|
TotalArticle = 1 // 累计发布文章
|
|
|
TotalComment = 2 // 累计发布评论
|
|
|
TotalLoved = 4 // 累计赞别人
|
|
|
TotalBeLoved = 8 // 累计收到的赞
|
|
|
)
|
|
|
|
|
|
func NewStatisticsItem(itemFlag int, value float64) types.StatisticsItem {
|
...
|
...
|
|