fix vip config
This commit is contained in:
parent
e1f6f9f9d7
commit
2a5192c4e1
|
@ -54,6 +54,7 @@ const (
|
|||
IsMomentImageEncryptEnabledKey = "is_moment_image_encrypt_enabled"
|
||||
RestrictedVisitorMomentKey = "restricted_visitor_moment"
|
||||
AppConfigReflectKey = "app_config_reflect"
|
||||
ZoneVIPConfigKey = "zone_vip_config"
|
||||
)
|
||||
|
||||
// del_flag
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package apollostruct
|
||||
|
||||
type ZoneVIPConfig struct {
|
||||
WhiteMids []int64 `json:"white_mids"`
|
||||
}
|
|
@ -1462,9 +1462,22 @@ var ZoneVIPMidMap = map[int64]bool{
|
|||
161: true,
|
||||
1: true,
|
||||
170: true,
|
||||
165: true,
|
||||
168: true,
|
||||
167: true,
|
||||
169: true,
|
||||
2: true,
|
||||
}
|
||||
|
||||
func IsZoneVIP(mid int64) bool {
|
||||
cfg := &apollostruct.ZoneVIPConfig{}
|
||||
_ = apollo.GetJson(consts.ZoneVIPConfigKey, cfg, apollo.ApolloOpts().SetNamespace("zone"))
|
||||
if util.Int64Contains(cfg.WhiteMids, mid) {
|
||||
if mid == 161 {
|
||||
logger.Info("_ZoneVip Apollo, mids: %v", cfg.WhiteMids)
|
||||
}
|
||||
return true
|
||||
}
|
||||
return ZoneVIPMidMap[mid]
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,15 @@ func StringsContains(elems []string, v string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func Int64Contains(elems []int64, v int64) bool {
|
||||
for _, s := range elems {
|
||||
if s == v {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 下划线转大写驼峰
|
||||
func UderscoreToUpperCamelCase(s string) string {
|
||||
s = strings.Replace(s, "_", " ", -1)
|
||||
|
|
Loading…
Reference in New Issue