by Robin at 20240516

This commit is contained in:
Leufolium 2024-05-16 14:40:22 +08:00
parent 0d6097d174
commit 3a3c50f851
5 changed files with 46 additions and 0 deletions

View File

@ -236,3 +236,8 @@ const (
const ( const (
DaysElapsedSinceTheLastZonesUpdate_Never = -1 DaysElapsedSinceTheLastZonesUpdate_Never = -1
) )
const (
IsCreatingPaidText_No = 0 //否
IsCreatingPaidText_Yes = 1 //是
)

View File

@ -2490,6 +2490,12 @@ func (s *Service) ApiCreateZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
req.ZoneMoment.Zid = zones[0].Id 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) // 默认正在审核中 req.ZoneMoment.Status = goproto.Int64(consts.ZoneMoment_Auditing) // 默认正在审核中
if req.ZoneMoment.MediaComp != nil && len(req.ZoneMoment.MediaComp.GetImageIds()) > 0 { if req.ZoneMoment.MediaComp != nil && len(req.ZoneMoment.MediaComp.GetImageIds()) > 0 {
req.ZoneMoment.ImageAuditStatus = goproto.Int64(consts.ImageAudit_Created) // 创建 req.ZoneMoment.ImageAuditStatus = goproto.Int64(consts.ImageAudit_Created) // 创建
@ -2553,6 +2559,12 @@ func (s *Service) ApiUpdateZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
return 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() zmStatus := zonemoment.GetStatus()
// 抹消审核信息,回退到初始 // 抹消审核信息,回退到初始

View File

@ -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) { func (s *Service) OpCreateZoneMoment(ctx *gin.Context, req *zonemomentproto.OpCreateReq) (ec errcode.ErrCode) {
ec = errcode.ErrCodeZoneMomentSrvOk 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) // 默认正在审核中 req.ZoneMoment.Status = goproto.Int64(consts.ZoneMoment_Auditing) // 默认正在审核中
if req.ZoneMoment.MediaComp != nil && len(req.ZoneMoment.MediaComp.GetImageIds()) > 0 { if req.ZoneMoment.MediaComp != nil && len(req.ZoneMoment.MediaComp.GetImageIds()) > 0 {
req.ZoneMoment.ImageAuditStatus = goproto.Int64(consts.ImageAudit_Created) // 创建 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) { func (s *Service) OpUpdateZoneMoment(ctx *gin.Context, req *zonemomentproto.OpUpdateReq) (ec errcode.ErrCode) {
ec = errcode.ErrCodeZoneMomentSrvOk 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()) zonemoment, err := _DefaultZoneMoment.GetById(ctx, req.ZoneMoment.GetId())
if err != nil { if err != nil {
logger.Error("_DefaultZoneMoment GetById fail, req: %v, err: %v", util.ToJson(req), err) logger.Error("_DefaultZoneMoment GetById fail, req: %v, err: %v", util.ToJson(req), err)

View File

@ -944,6 +944,9 @@ func (s *Service) utilEncryptInaccessibleZoneMoment(vo *zonemomentproto.ApiZoneM
imageIds = imageIds[:mediaVisibleRange] imageIds = imageIds[:mediaVisibleRange]
vo.MediaComp.ImageIds = util.Int64Slice(imageIds) vo.MediaComp.ImageIds = util.Int64Slice(imageIds)
} }
if vo.GetIsCreatingPaidText() == consts.IsCreatingPaidText_Yes {
vo.Text = goproto.String(vo.GetText()[:len(vo.GetText())-len(vo.GetPaidText())])
}
} }
// 填充动态是否解锁 // 填充动态是否解锁

View File

@ -103,3 +103,17 @@ func (p *ZoneMoment) GetIsCreatingPaidText() int64 {
} }
return 0 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 ""
}