by Robin at 20240426

This commit is contained in:
Leufolium 2024-04-26 11:13:49 +08:00
parent 3076813dfb
commit 4137710945
3 changed files with 36 additions and 2 deletions

View File

@ -50,6 +50,7 @@ const (
MaxDailyMomentCreateTimesKey = "max_daily_moment_create_times"
DefaultMomentTextKey = "default_moment_text"
MaxDailyZoneMomentCreateTimesKey = "max_daily_zone_moment_create_times"
ZoneKey = "zone"
)
// del_flag

View File

@ -0,0 +1,10 @@
package apollostruct
import "service/dbstruct"
type ReferentialZoneMoment struct {
Text *string `json:"text"` // 动态文字内容
MediaComp *dbstruct.MediaComponent `json:"media_component"` // 动态媒体内容
MType *int64 `json:"m_type"` // 媒体类型,见: MediaType*
Status *int64 `json:"status"` // 审批状态
}

View File

@ -2147,6 +2147,31 @@ func (s *Service) ApiCreateZone(ctx *gin.Context, req *zoneproto.ApiCreateReq) (
return
}
// 创建默认动态
cfg := apollostruct.ReferentialZoneMoment{}
err = apollo.GetJson(consts.ZoneKey, &cfg, apollo.ApolloOpts().SetNamespace("referential_zone_moment"))
if err != nil {
logger.Error("Apollo read failed : %v", err)
return errcode.ErrCodeApolloReadFail
}
_, err = _DefaultZoneMoment.OpCreate(ctx, &zonemomentproto.OpCreateReq{
ZoneMoment: &dbstruct.ZoneMoment{
Mid: req.Zone.Mid,
Zid: goproto.Int64(zid),
CType: goproto.Int64(consts.ZoneMomentCType_Free),
Text: cfg.Text,
MediaComp: cfg.MediaComp,
MType: cfg.MType,
Status: cfg.Status,
},
})
if err != nil {
logger.Error("_DefaultZoneMoment OpCreate fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneSrvFail
return
}
return
}
@ -2629,8 +2654,6 @@ func (s *Service) ApiDeleteZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
logger.Error("OpGetAndUpdate fail, err: %v", err)
ec = errcode.ErrCodeZoneMomentSrvFail
return
return
}
func (s *Service) ApiGetZoneMomentListByVisitorMid(ctx *gin.Context, req *zonemomentproto.ApiListByVisitorMidReq) (volist []*zonemomentproto.ApiZoneMomentVO, ec errcode.ErrCode) {