by Robin at 20240501
This commit is contained in:
parent
cf4068ddca
commit
7317ea2a65
|
@ -53,6 +53,7 @@ const (
|
|||
ReferentialZoneMomentKey = "referential_zone_moment"
|
||||
IsMomentImageEncryptEnabledKey = "is_moment_image_encrypt_enabled"
|
||||
RestrictedVisitorMomentKey = "restricted_visitor_moment"
|
||||
AppConfigReflectKey = "app_config_reflect"
|
||||
)
|
||||
|
||||
// del_flag
|
||||
|
|
|
@ -40,6 +40,7 @@ import (
|
|||
"service/library/contentaudit/textaudit"
|
||||
videomoderation "service/library/contentaudit/video_moderation"
|
||||
"service/library/logger"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
|
@ -2110,7 +2111,23 @@ func (s *Service) ApiGetThumbsUpList(ctx *gin.Context, req *thumbsupproto.ApiLis
|
|||
func (s *Service) ApiGetAppConfigListByKey(ctx *gin.Context, req *appconfigproto.ApiListByKeyReq) (appconfig *dbstruct.AppConfig, ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeAppConfigSrvOk
|
||||
|
||||
appconfig, err := _DefaultAppConfig.OpListByKey(ctx, &appconfigproto.OpListByKeyReq{
|
||||
//读取版本下是否有字段需要进行版本映射
|
||||
appConfigReflect, err := apollo.GetStringValue(consts.AppConfigReflectKey+"_"+req.BaseRequest.Version, apollo.ApolloOpts().SetNamespace("version"))
|
||||
if err != nil {
|
||||
logger.Error("Apollo read failed : %v", err)
|
||||
ec = errcode.ErrCodeApolloReadFail
|
||||
return
|
||||
}
|
||||
if appConfigReflect != "" {
|
||||
appConfigReflectColumns := strings.Split(appConfigReflect, ";")
|
||||
for _, column := range appConfigReflectColumns {
|
||||
if req.ConfigKey == column {
|
||||
req.ConfigKey = req.ConfigKey + "_" + req.BaseRequest.Version
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
appconfig, err = _DefaultAppConfig.OpListByKey(ctx, &appconfigproto.OpListByKeyReq{
|
||||
ConfigKey: req.ConfigKey,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
@ -57,6 +57,7 @@ import (
|
|||
"service/library/payclients/alipaycli"
|
||||
"service/library/payclients/wxpaycli"
|
||||
"service/library/redis"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
accountpunishmentproto "service/api/proto/accountpunishment/proto"
|
||||
|
@ -2968,7 +2969,23 @@ func (s *Service) OpGetAppConfigListByKey(ctx *gin.Context, req *appconfigproto.
|
|||
return
|
||||
}
|
||||
|
||||
appconfig, err := _DefaultAppConfig.OpListByKey(ctx, req)
|
||||
//读取版本下是否有字段需要进行版本映射
|
||||
appConfigReflect, err := apollo.GetStringValue(consts.AppConfigReflectKey+"_"+req.BaseRequest.Version, apollo.ApolloOpts().SetNamespace("version"))
|
||||
if err != nil {
|
||||
logger.Error("Apollo read failed : %v", err)
|
||||
ec = errcode.ErrCodeApolloReadFail
|
||||
return
|
||||
}
|
||||
if appConfigReflect != "" {
|
||||
appConfigReflectColumns := strings.Split(appConfigReflect, ";")
|
||||
for _, column := range appConfigReflectColumns {
|
||||
if req.ConfigKey == column {
|
||||
req.ConfigKey = req.ConfigKey + "_" + req.BaseRequest.Version
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
appconfig, err = _DefaultAppConfig.OpListByKey(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error("OpGetAppConfigListByKey fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeAppConfigSrvFail
|
||||
|
|
Loading…
Reference in New Issue