package confcardholder import ( "apigame/configs/confbase" ) // GetCurrent 获取 当前配置 func GetCurrent(gameId string) (conf *ActivityConfig, has bool) { //currentKey := fmt.Sprintf("%s:%s:%s:current", // svconst.REDIS_CACHEP_REFIX, // svconst.MYSQL_TABLE_S_CARDHOLDER_CONFIG, // gameId) //currentId := zredis.GetInt64(zredis.GetConn(), currentKey) //timeNow := lxtime.NowUninx() //confRaw := new(ActivityConfigRaw) //hasFind := false //if currentId == 0 { // hasFind = confbase.FindDuringTime(confRaw, gameId) //} else { // conf, has = GetConfig(gameId, currentId) // if has { // if timeNow < conf.StartTime || timeNow > conf.EndTime { // hasFind = confbase.FindDuringTime(confRaw, gameId) // } // } else { // hasFind = confbase.FindDuringTime(confRaw, gameId) // } //} //if hasFind { // conf = new(ActivityConfig) // conf.Decode(gameId, confRaw) // svredis.SaveData(gameId, conf) // has = true // currentId = conf.Id // _ = zredis.Set(zredis.GetConn(), currentKey, utstring.Int64ToString(currentId)) //} conf = new(ActivityConfig) has = confbase.GetCurrent[*ActivityConfig, ActivityConfigRaw](gameId, conf) return } // GetConfig 获取 配置根据Id func GetConfig(gameId string, confId int64) (conf *ActivityConfig, has bool) { conf = new(ActivityConfig) has = confbase.GetConfig[*ActivityConfig, ActivityConfigRaw](gameId, confId, conf) return }