diff --git a/api/consts/status.go b/api/consts/status.go index 6e780f28..9d7bd5a1 100644 --- a/api/consts/status.go +++ b/api/consts/status.go @@ -236,3 +236,8 @@ const ( const ( DaysElapsedSinceTheLastZonesUpdate_Never = -1 ) + +const ( + IsCreatingPaidText_No = 0 //否 + IsCreatingPaidText_Yes = 1 //是 +) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index ddb6aaf0..f3d7e800 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2490,6 +2490,12 @@ func (s *Service) ApiCreateZoneMoment(ctx *gin.Context, req *zonemomentproto.Api req.ZoneMoment.Zid = zones[0].Id } + // 拼接付费文案 + if req.ZoneMoment.GetIsCreatingPaidText() == consts.IsCreatingPaidText_Yes { + req.ZoneMoment.PaidText = goproto.String("\n" + req.ZoneMoment.GetPaidText()) + req.ZoneMoment.Text = goproto.String(req.ZoneMoment.GetText() + req.ZoneMoment.GetPaidText()) + } + req.ZoneMoment.Status = goproto.Int64(consts.ZoneMoment_Auditing) // 默认正在审核中 if req.ZoneMoment.MediaComp != nil && len(req.ZoneMoment.MediaComp.GetImageIds()) > 0 { req.ZoneMoment.ImageAuditStatus = goproto.Int64(consts.ImageAudit_Created) // 创建 @@ -2553,6 +2559,12 @@ func (s *Service) ApiUpdateZoneMoment(ctx *gin.Context, req *zonemomentproto.Api return } + // 拼接付费文案 + if req.ZoneMoment.GetIsCreatingPaidText() == consts.IsCreatingPaidText_Yes { + req.ZoneMoment.PaidText = goproto.String("\n" + req.ZoneMoment.GetPaidText()) + req.ZoneMoment.Text = goproto.String(req.ZoneMoment.GetText() + req.ZoneMoment.GetPaidText()) + } + zmStatus := zonemoment.GetStatus() // 抹消审核信息,回退到初始 diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 69bf61e0..e60c713e 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -3333,6 +3333,12 @@ func (s *Service) OpGetZoneListByUserId(ctx *gin.Context, req *zoneproto.OpListB func (s *Service) OpCreateZoneMoment(ctx *gin.Context, req *zonemomentproto.OpCreateReq) (ec errcode.ErrCode) { ec = errcode.ErrCodeZoneMomentSrvOk + // 拼接付费文案 + if req.ZoneMoment.GetIsCreatingPaidText() == consts.IsCreatingPaidText_Yes { + req.ZoneMoment.PaidText = goproto.String("\n" + req.ZoneMoment.GetPaidText()) + req.ZoneMoment.Text = goproto.String(req.ZoneMoment.GetText() + req.ZoneMoment.GetPaidText()) + } + req.ZoneMoment.Status = goproto.Int64(consts.ZoneMoment_Auditing) // 默认正在审核中 if req.ZoneMoment.MediaComp != nil && len(req.ZoneMoment.MediaComp.GetImageIds()) > 0 { req.ZoneMoment.ImageAuditStatus = goproto.Int64(consts.ImageAudit_Created) // 创建 @@ -3381,6 +3387,12 @@ func (s *Service) OpCreateZoneMoment(ctx *gin.Context, req *zonemomentproto.OpCr func (s *Service) OpUpdateZoneMoment(ctx *gin.Context, req *zonemomentproto.OpUpdateReq) (ec errcode.ErrCode) { ec = errcode.ErrCodeZoneMomentSrvOk + // 拼接付费文案 + if req.ZoneMoment.GetIsCreatingPaidText() == consts.IsCreatingPaidText_Yes { + req.ZoneMoment.PaidText = goproto.String("\n" + req.ZoneMoment.GetPaidText()) + req.ZoneMoment.Text = goproto.String(req.ZoneMoment.GetText() + req.ZoneMoment.GetPaidText()) + } + zonemoment, err := _DefaultZoneMoment.GetById(ctx, req.ZoneMoment.GetId()) if err != nil { logger.Error("_DefaultZoneMoment GetById fail, req: %v, err: %v", util.ToJson(req), err) diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index ba56252c..6cdfa407 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -944,6 +944,9 @@ func (s *Service) utilEncryptInaccessibleZoneMoment(vo *zonemomentproto.ApiZoneM imageIds = imageIds[:mediaVisibleRange] vo.MediaComp.ImageIds = util.Int64Slice(imageIds) } + if vo.GetIsCreatingPaidText() == consts.IsCreatingPaidText_Yes { + vo.Text = goproto.String(vo.GetText()[:len(vo.GetText())-len(vo.GetPaidText())]) + } } // 填充动态是否解锁 diff --git a/dbstruct/zonemoment.go b/dbstruct/zonemoment.go index 3f498c39..428b172a 100644 --- a/dbstruct/zonemoment.go +++ b/dbstruct/zonemoment.go @@ -103,3 +103,17 @@ func (p *ZoneMoment) GetIsCreatingPaidText() int64 { } return 0 } + +func (p *ZoneMoment) GetText() string { + if p != nil && p.Text != nil { + return *p.Text + } + return "" +} + +func (p *ZoneMoment) GetPaidText() string { + if p != nil && p.PaidText != nil { + return *p.PaidText + } + return "" +}