by Robin at 20240430

This commit is contained in:
Leufolium 2024-04-30 09:51:23 +08:00
parent aa32674ed3
commit 1ac73882d1
4 changed files with 28 additions and 0 deletions

View File

@ -51,6 +51,7 @@ const (
DefaultMomentTextKey = "default_moment_text"
MaxDailyZoneMomentCreateTimesKey = "max_daily_zone_moment_create_times"
ReferentialZoneMomentKey = "referential_zone_moment"
IsMomentImageEncryptEnabledKey = "is_moment_image_encrypt_enabled"
)
// del_flag

View File

@ -70,3 +70,14 @@ func OpGetUploadMediaFailConfigList(ctx *gin.Context) {
ReplyOk(ctx, config)
}
func OpGetIsMomentImageEncryptEnabled(ctx *gin.Context) {
isEnabled, ec := service.DefaultConfigService.OpGetIsMomentImageEncryptEnabled(ctx)
if ec != errcode.ErrCodeOk {
logger.Error("OpGetIsMomentImageEncryptEnabled fail, ec: %v", ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, isEnabled)
}

View File

@ -114,6 +114,7 @@ func Init(r *gin.Engine) {
apiMomentGroup.POST("thumbs_up", middleware.JSONParamValidator(momentproto.ApiThumbsUpReq{}), middleware.JwtAuthenticator(), ApiThumbsUpMoment)
apiMomentGroup.POST("list_by_ids", middleware.JSONParamValidator(momentproto.ApiListByIdsReq{}), middleware.JwtAuthenticator(), ApiGetMomentListByIds)
apiMomentGroup.POST("recomm_list", middleware.JSONParamValidator(momentproto.ApiRecommListReq{}), middleware.JwtAuthenticator(), ApiGetMomentRecommList)
apiMomentGroup.POST("is_moment_image_encrypt_enabled", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpGetIsMomentImageEncryptEnabled)
// 足迹
// apiFootPrintGroup := r.Group("/api/footprint", PrepareToC())

View File

@ -169,3 +169,18 @@ func (s *ConfigService) OpGetUploadMediaFailConfigList(ctx *gin.Context) (upload
return
}
func (s *ConfigService) OpGetIsMomentImageEncryptEnabled(ctx *gin.Context) (isEnabled int64, ec errcode.ErrCode) {
ec = errcode.ErrCodeOk
isMomentImageEncryptEnabled, err := apollo.GetIntValue(consts.IsMomentImageEncryptEnabledKey, apollo.ApolloOpts().SetNamespace("application"))
if err != nil {
logger.Error("Apollo read failed : %v", err)
ec = errcode.ErrCodeApolloReadFail
return
}
isEnabled = int64(isMomentImageEncryptEnabled)
return
}