Merge pull request 'feat-IRONFANS-70' (#397) from feat-IRONFANS-70 into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/397
This commit is contained in:
chenhao 2024-05-01 04:09:53 +08:00
commit 8e53a7ec84
5 changed files with 52 additions and 39 deletions

View File

@ -61,7 +61,7 @@ type OpListReq struct {
} }
type OpListData struct { type OpListData struct {
List []*dbstruct.Zone `json:"list"` List []*OpZoneVO `json:"list"`
Offset int `json:"offset"` Offset int `json:"offset"`
More int `json:"more"` More int `json:"more"`
} }

View File

@ -80,6 +80,7 @@ func (p *OpSetPrivateReq) ProvideNotNullValue() (params []*validator.JsonParam)
params = make([]*validator.JsonParam, 0) params = make([]*validator.JsonParam, 0)
params = append(params, validator.NewInt64PtrParam("请确认待审批动态的id", p.ZoneMomentId)) params = append(params, validator.NewInt64PtrParam("请确认待审批动态的id", p.ZoneMomentId))
params = append(params, validator.NewStringParam("请确认人工审批意见!", p.ManuallyReviewOpinion))
return return
} }

View File

@ -214,6 +214,7 @@ type OpHeadResp struct {
type OpSetPrivateReq struct { type OpSetPrivateReq struct {
base.BaseRequest base.BaseRequest
ZoneMomentId *int64 `json:"zone_moment_id"` ZoneMomentId *int64 `json:"zone_moment_id"`
ManuallyReviewOpinion string `json:"manually_review_opinion"`
} }
type OpSetPrivateData struct { type OpSetPrivateData struct {

View File

@ -2653,6 +2653,26 @@ func (s *Service) ApiDeleteZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
return 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
}
}
// 回退每日发帖次数
totalIncr := int64(-1)
_, err = _DefaultZoneMomentCreateTimes.OpGetAndUpdate(ctx, zone.GetMid(), totalIncr)
if err != nil {
logger.Error("OpGetAndUpdate fail, err: %v", err)
ec = errcode.ErrCodeZoneMomentSrvFail
}
// 查看空间最后更新时间是否需要回退 // 查看空间最后更新时间是否需要回退
if zonemoment.GetStatus() == consts.ZoneMoment_Public { if zonemoment.GetStatus() == consts.ZoneMoment_Public {
list, err := _DefaultZoneMoment.OpListByMid(ctx, &zonemomentproto.OpListByMidReq{ list, err := _DefaultZoneMoment.OpListByMid(ctx, &zonemomentproto.OpListByMidReq{
@ -2699,26 +2719,6 @@ func (s *Service) ApiDeleteZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
} }
} }
// 回退空间内统计总数,只回退公开的情况
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
}
}
// 回退每日发帖次数
totalIncr := int64(-1)
_, err = _DefaultZoneMomentCreateTimes.OpGetAndUpdate(ctx, zone.GetMid(), totalIncr)
if err != nil {
logger.Error("OpGetAndUpdate fail, err: %v", err)
ec = errcode.ErrCodeZoneMomentSrvFail
}
return return
} }

View File

@ -3215,7 +3215,7 @@ func (s *Service) OpDeleteZone(ctx *gin.Context, id int64) (ec errcode.ErrCode)
return return
} }
func (s *Service) OpGetZoneList(ctx *gin.Context, req *zoneproto.OpListReq) (list []*dbstruct.Zone, ec errcode.ErrCode) { func (s *Service) OpGetZoneList(ctx *gin.Context, req *zoneproto.OpListReq) (volist []*zoneproto.OpZoneVO, ec errcode.ErrCode) {
ec = errcode.ErrCodeZoneSrvOk ec = errcode.ErrCodeZoneSrvOk
list, err := _DefaultZone.OpList(ctx, req) list, err := _DefaultZone.OpList(ctx, req)
if err != nil { if err != nil {
@ -3223,6 +3223,15 @@ func (s *Service) OpGetZoneList(ctx *gin.Context, req *zoneproto.OpListReq) (lis
ec = errcode.ErrCodeZoneSrvFail ec = errcode.ErrCodeZoneSrvFail
return return
} }
// 填充必要信息
volist, err = s.utilFillZonesWithOpVOInfo(ctx, list)
if err != nil {
logger.Error("utilFillZonesWithOpVOInfo fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneSrvFail
return
}
return return
} }
@ -3416,6 +3425,18 @@ func (s *Service) OpDeleteZoneMoment(ctx *gin.Context, req *zonemomentproto.OpDe
return 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
}
}
// 查看空间最后更新时间是否需要回退 // 查看空间最后更新时间是否需要回退
if zonemoment.GetStatus() == consts.ZoneMoment_Public { if zonemoment.GetStatus() == consts.ZoneMoment_Public {
list, err := _DefaultZoneMoment.OpListByMid(ctx, &zonemomentproto.OpListByMidReq{ list, err := _DefaultZoneMoment.OpListByMid(ctx, &zonemomentproto.OpListByMidReq{
@ -3462,18 +3483,6 @@ func (s *Service) OpDeleteZoneMoment(ctx *gin.Context, req *zonemomentproto.OpDe
} }
} }
// 回退空间内统计总数,只回退公开的情况
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
}
}
return return
} }
@ -3656,6 +3665,8 @@ func (s *Service) OpSetPrivateZoneMoment(ctx *gin.Context, req *zonemomentproto.
ZoneMoment: &dbstruct.ZoneMoment{ ZoneMoment: &dbstruct.ZoneMoment{
Id: req.ZoneMomentId, Id: req.ZoneMomentId,
Status: goproto.Int64(consts.ZoneMoment_Private), Status: goproto.Int64(consts.ZoneMoment_Private),
ManuallyReviewStatus: goproto.Int64(consts.ZoneMomentManuallyReview_Rejected),
ManuallyReviewOpinion: goproto.String(req.ManuallyReviewOpinion),
}, },
}) })
if err != nil { if err != nil {