...
|
...
|
@@ -370,70 +370,78 @@ func UserStatistics(header *protocol.RequestHeader, request *protocol.UserStatis |
|
|
rsp = &protocol.UserStatisticsResponse{}
|
|
|
//buf :=bytes.NewBuffer(nil)
|
|
|
//buf.WriteString(fmt.Sprintf("用户中心-统计信息 user:%v type_total:%v \n",header.UserId,request.TypeTotal))
|
|
|
for flag = 1; flag <= (protocol.MyAuditChanceReturn); flag = flag << 1 {
|
|
|
for flag = 1; flag <= (protocol.MyGraspAchievement); flag = flag << 1 {
|
|
|
total = 0
|
|
|
switch flag {
|
|
|
case protocol.CollectStatic: //收藏
|
|
|
if total, err = models.GetChanceCollect(header.UserId, 0, 0, nil); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.ZanStatic: //点赞
|
|
|
if total, err = models.GetChanceThumbUp(header.UserId, 0, 0, nil); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.CommentStatic: //评论
|
|
|
if total, err = models.GetChanceComment(header.UserId, 0, 0, nil); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyCommitChance:
|
|
|
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyCommitChanceWait:
|
|
|
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyCommitChancePass:
|
|
|
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusPass); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyCommitChanceReturn:
|
|
|
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusReturn); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyAuditChance:
|
|
|
var total1, total2 int
|
|
|
if total1, err = agg.MyApproveStatic(header, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
if total2, err = agg.MyApproveEnableStatic(header, protocol.ReviewStatusAuditging); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
total = total1 + total2
|
|
|
break
|
|
|
case protocol.MyAuditChanceWait:
|
|
|
if total, err = agg.MyApproveEnableStatic(header, protocol.ReviewStatusAuditging); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyAuditChancePass:
|
|
|
if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusPass); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyAuditChanceReturn:
|
|
|
if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusReturn); err != nil {
|
|
|
log.Error(err)
|
|
|
if flag&request.TypeTotal > 0 {
|
|
|
switch flag {
|
|
|
case protocol.CollectStatic: //收藏
|
|
|
if total, err = models.GetChanceCollect(header.UserId, 0, 0, nil); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.ZanStatic: //点赞
|
|
|
if total, err = models.GetChanceThumbUp(header.UserId, 0, 0, nil); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.CommentStatic: //评论
|
|
|
if total, err = models.GetChanceComment(header.UserId, 0, 0, nil); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyCommitChance:
|
|
|
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyCommitChanceWait:
|
|
|
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyCommitChancePass:
|
|
|
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusPass); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyCommitChanceReturn:
|
|
|
if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusReturn); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyAuditChance:
|
|
|
var total1, total2 int
|
|
|
if total1, err = agg.MyApproveStatic(header, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
if total2, err = agg.MyApproveEnableStatic(header, protocol.ReviewStatusAuditging); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
total = total1 + total2
|
|
|
break
|
|
|
case protocol.MyAuditChanceWait:
|
|
|
if total, err = agg.MyApproveEnableStatic(header, protocol.ReviewStatusAuditging); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyAuditChancePass:
|
|
|
if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusPass); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyAuditChanceReturn:
|
|
|
if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusReturn); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
case protocol.MyGraspAchievement:
|
|
|
if total, err = agg.MyGraspStatic(header); err != nil {
|
|
|
log.Error(err)
|
|
|
}
|
|
|
break
|
|
|
default:
|
|
|
break
|
|
|
}
|
|
|
break
|
|
|
|
|
|
}
|
|
|
if flag&request.TypeTotal > 0 {
|
|
|
rsp.Totals = append(rsp.Totals, protocol.TypeTotalItem{
|
...
|
...
|
|