From 9a13710f03c15d280e0165bee4c71a9ce61c8448 Mon Sep 17 00:00:00 2001 From: 王家文 Date: Wed, 17 Apr 2024 10:35:12 +0800 Subject: [PATCH] refactor♻️:redis对象和mysql对象持久化和读取 --- configs/feat-api.go | 13 ------------- configs/registry.go | 8 -------- 2 files changed, 0 insertions(+), 21 deletions(-) diff --git a/configs/feat-api.go b/configs/feat-api.go index 6efb06a..0217f8b 100644 --- a/configs/feat-api.go +++ b/configs/feat-api.go @@ -5,7 +5,6 @@ import ( "apigame/common/svdto" "apigame/common/svmysql" "apigame/common/svredis" - "apigame/util/utdto" "fmt" ) @@ -18,18 +17,6 @@ type ApiGameConfig struct { Name string `gorm:"column:name"` } -func (c *ApiGameConfig) TableName() string { return utdto.MYSQL_TABLE_TEMPLATE } - -func (c *ApiGameConfig) GetRule(gameId string) *svdto.DtoRule { - tableName := "s_game_config" - return &svdto.DtoRule{ - DbMysql: svconst.DbApi.Where("gameid = ?", gameId), - TableName: tableName, - CacheKey: fmt.Sprintf("%s:%s:%s", svdto.REDIS_CACHEP_REFIX, tableName, gameId), - CacheTime: 300, - } -} - func (c *ApiGameConfig) RedisInfo(gameId string) *svredis.RedisInfo { tableName := "s_game_config" return &svredis.RedisInfo{ diff --git a/configs/registry.go b/configs/registry.go index 6456448..3c7b565 100644 --- a/configs/registry.go +++ b/configs/registry.go @@ -19,14 +19,6 @@ func GetApiGame(gameId string) (conf *ApiGameConfig, err error) { 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) -- libgit2 0.21.0