Merge pull request 'by Robin at 20240427' (#359) from feat-IRONFANS-70 into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/359
This commit is contained in:
chenhao 2024-04-27 00:47:36 +08:00
commit 6376fc0d48
2 changed files with 21 additions and 10 deletions

View File

@ -2517,6 +2517,8 @@ func (s *Service) ApiUpdateZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
return
}
zmStatus := zonemoment.GetStatus()
// 抹消审核信息,回退到初始
isReauditRequired := false
if req.ZoneMoment.MediaComp != nil && req.ZoneMoment.GetMType() == consts.MediaTypeImg {
@ -2556,8 +2558,8 @@ func (s *Service) ApiUpdateZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
return
}
// 回退空间内统计总数
if isReauditRequired {
// 回退空间内统计总数,只回退公开的情况
if zmStatus == consts.ZoneMoment_Public && isReauditRequired {
mediaCountInc := len(zonemoment.MediaComp.GetImageIds())
videoCountInc := len(zonemoment.MediaComp.GetVideoIds())
err := _DefaultZone.RecordStatisticsById(ctx, zonemoment.GetZid(), -1, -int64(mediaCountInc), -int64(videoCountInc))
@ -2645,14 +2647,16 @@ func (s *Service) ApiDeleteZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
}
}
// 回退空间内统计总数
mediaCountInc := len(zonemoment.MediaComp.GetImageIds())
videoCountInc := len(zonemoment.MediaComp.GetVideoIds())
err = _DefaultZone.RecordStatisticsById(ctx, zonemoment.GetZid(), -1, -int64(mediaCountInc), -int64(videoCountInc))
if err != nil {
logger.Error("RecordStatisticsById fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneSrvFail
return
// 回退空间内统计总数,只回退公开的情况
if zonemoment.GetStatus() == consts.ZoneMoment_Public {
mediaCountInc := len(zonemoment.MediaComp.GetImageIds())
videoCountInc := len(zonemoment.MediaComp.GetVideoIds())
err = _DefaultZone.RecordStatisticsById(ctx, zonemoment.GetZid(), -1, -int64(mediaCountInc), -int64(videoCountInc))
if err != nil {
logger.Error("RecordStatisticsById fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneSrvFail
return
}
}
// 回退每日发帖次数

View File

@ -87,3 +87,10 @@ func (p *ZoneMoment) GetUt() int64 {
}
return 0
}
func (p *ZoneMoment) GetStatus() int64 {
if p != nil && p.Status != nil {
return *p.Status
}
return 0
}