package gameServerMgr

import (
	"encoding/json"

	. "Framework/managecenterModel"
)

var (
	mChargeConfigMap = make(map[int32][]*ChargeConfig, 0)
)

//解析充值配置信息
func ParseChargeConfigInfo(partnerList []*Partner) {
	tmpChargeConfigMap := make(map[int32][]*ChargeConfig, 0)

	//循环解析所有合作商里面的充值配置信息
	for _, partner := range partnerList {
		var chargeConfigList []*ChargeConfig
		if err := json.Unmarshal([]byte(partner.ChargeConfig), &chargeConfigList); err == nil {
			tmpChargeConfigMap[partner.Id] = chargeConfigList
		}
	}

	mChargeConfigMap = tmpChargeConfigMap
}

// 根据合作商Id获取合作商充值配置对象
func GetChargeConfigList(partnerId int32) (chargeConfigList []*ChargeConfig, exist bool) {
	chargeConfigList, exist = mChargeConfigMap[partnerId]

	return
}
