service/vendor/library/apollo/apollo_test.go

62 lines
3.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package apollo
import (
"fmt"
"service/bizcommon/util"
"service/library/configcenter"
"testing"
)
// 拍拍贷入口
type PaiPaiDaiEntranceCfg struct {
MidWhitelist []int64 `json:"mid_whitelist"` // mid白名单一定出
MidBlacklist []int64 `json:"mid_blacklist"` // mid黑名单一定不出
DidWhitelist []string `json:"did_whitelist"` // did白名单一定出
DidBlacklist []string `json:"did_blacklist"` // did黑名单一点不出
AndroidVerBlacklist []string `json:"android_ver_blacklist"` // 安卓版本黑名单
IosVerBlacklist []string `json:"ios_ver_blacklist"` // ios版本黑名单
AndroidChanWhitelist []string `json:"android_chan_whitelist"` // 安卓渠道白名单
AndroidChanBlacklist []string `json:"android_chan_blacklist"` // 安卓渠道黑名单
AndroidShow int `json:"android_show"` // 1: 展示, 0: 不展示
IosShow int `json:"ios_show"` // 1: 展示, 0: 不展示
}
type AccountInitCfg struct {
DefaultLevel int64 `json:"default_level"` //默认等级
DefaultRole int64 `json:"default_role"` //默认角色
DefaultIsDndModeEnabled int64 `json:"default_is_dnd_mode_enabled"` //默认是否开启勿扰模式
LevelLowerBound int64 `json:"level_lower_bound"` //等级下界
LevelUpperBound int64 `json:"level_upper_bound"` //等级上界
LevelUpExpVector1 []int64 `json:"level_up_exp_vector_1"` //1-10级升级所需经验向量
LevelUpExpVector2 []int64 `json:"level_up_exp_vector_2"` //11-20级升级所需经验向量
LevelUpExpVector3 []int64 `json:"level_up_exp_vector_3"` //21-30级升级所需经验
LevelUpExpVector4 []int64 `json:"level_up_exp_vector_4"` //31-40级升级所需经验
LevelUpExpVector5 []int64 `json:"level_up_exp_vector_5"` //41-50级升级所需经验
LevelUpExpVector6 []int64 `json:"level_up_exp_vector_6"` //51-60级升级所需经验
LevelUpExpVector7 []int64 `json:"level_up_exp_vector_7"` //61-70级升级所需经验
LevelUpExpVector8 []int64 `json:"level_up_exp_vector_8"` //71-80级升级所需经验
LevelUpExpVector9 []int64 `json:"level_up_exp_vector_9"` //81-90级升级所需经验
LevelUpExpVector10 []int64 `json:"level_up_exp_vector_10"` //91-100级升级所需经验
}
func TestGetJsonTest(t *testing.T) {
err := Init(&configcenter.ApolloConfig{
AppID: "wishpal_live_service",
Cluster: "dev",
IP: "http://localhost:8080",
NamespaceName: "application,tag,account_init",
})
if err != nil {
t.Fatal(err)
}
key := "account_init"
cfg := AccountInitCfg{}
err = GetJson(key, &cfg, ApolloOpts().SetNamespace("account_init"))
if err != nil {
t.Fatal(err)
}
t.Log(util.ToJson(cfg))
fmt.Print(cfg.LevelUpExpVector1[2])
}