registry.go
695 Bytes
package configs
import (
"apigame/common/svmysql"
"apigame/common/svredis"
"fmt"
)
// GetApiGame 获取 api游戏配置
func GetApiGame(gameId string) (conf *ApiGameConfig, err error) {
conf = new(ApiGameConfig)
has := svredis.LoadData(gameId, conf)
if has {
fmt.Println("dwjw GetApiGame use cache")
return
}
has, err = svmysql.First(conf, gameId)
if err != nil {
return
}
//rule := conf.GetRule(gameId)
//result := utdto.First(rule.DbMysql, conf, rule.TableName)
//has = result.RowsAffected != 0
//err = result.Error
//if err != nil {
// lxalilog.Errors(err, gameId)
// return
//}
fmt.Println("dwjw GetApiGame save cache")
svredis.SaveData(gameId, conf)
return
}