Commit f0922e3ff01be79390d256eb39cfcad21596aca9
1 parent
ce84630f
Exists in
master
and in
1 other branch
feat✨:游戏功能配置
Showing
3 changed files
with
5 additions
and
7 deletions
Show diff stats
configs/confbase/index.go
| ... | ... | @@ -7,6 +7,7 @@ import ( |
| 7 | 7 | "apigame/util/zjson" |
| 8 | 8 | "apigame/util/zredis" |
| 9 | 9 | "fmt" |
| 10 | + "runtime/debug" | |
| 10 | 11 | ) |
| 11 | 12 | |
| 12 | 13 | func SaveCache[T IConfData](gameId string, obj T) { |
| ... | ... | @@ -40,7 +41,8 @@ func LoadData[T1 IConfData, T2 IConfRawData](gameId string, confId any, obj T1) |
| 40 | 41 | has = result.RowsAffected != 0 |
| 41 | 42 | err := result.Error |
| 42 | 43 | if err != nil { |
| 43 | - lxalilog.Errors(err, "confbase.LoadData error", gameId) | |
| 44 | + lxalilog.Errors(err, "confbase.LoadData error", gameId, confId) | |
| 45 | + fmt.Printf("%s", debug.Stack()) | |
| 44 | 46 | return |
| 45 | 47 | } |
| 46 | 48 | if !has { | ... | ... |
configs/confcardholder/config.go
| ... | ... | @@ -38,7 +38,7 @@ func (c *ActivityConfig) ConfInfo(suffix string) *confbase.ConfInfo { |
| 38 | 38 | return &confbase.ConfInfo{ |
| 39 | 39 | DbMysql: svconst.DbConfig, |
| 40 | 40 | TableName: fmt.Sprintf("%s_%s", tableName, suffix), |
| 41 | - KeyName: "gameid", | |
| 41 | + KeyName: "id", | |
| 42 | 42 | CacheKey: fmt.Sprintf("%s:%d", cacheKey, c.Id), |
| 43 | 43 | CacheCurrent: cacheKey + ":current", |
| 44 | 44 | CacheTime: 300, | ... | ... |
configs/confcardholder/get.go
| ... | ... | @@ -46,11 +46,7 @@ func GetCurrent(gameId string) (conf *ActivityConfig, has bool) { |
| 46 | 46 | // GetConfig 获取 配置根据Id |
| 47 | 47 | func GetConfig(gameId string, confId int64) (conf *ActivityConfig, has bool) { |
| 48 | 48 | conf = new(ActivityConfig) |
| 49 | - has := confbase.GetConfig[*ActivityConfig, ActivityConfigRaw](gameId, gameId, conf) | |
| 50 | - if !has { | |
| 51 | - err = errors.New("confapi.GetConfig error") | |
| 52 | - return | |
| 53 | - } | |
| 49 | + has = confbase.GetConfig[*ActivityConfig, ActivityConfigRaw](gameId, confId, conf) | |
| 54 | 50 | |
| 55 | 51 | //var err error |
| 56 | 52 | //conf = &ActivityConfig{Id: confId} | ... | ... |