Commit 9a13710f03c15d280e0165bee4c71a9ce61c8448

Authored by 王家文
1 parent dc16f901
Exists in master and in 1 other branch dev-wjw

refactor♻️:redis对象和mysql对象持久化和读取

Showing 2 changed files with 0 additions and 21 deletions   Show diff stats
configs/feat-api.go
@@ -5,7 +5,6 @@ import ( @@ -5,7 +5,6 @@ import (
5 "apigame/common/svdto" 5 "apigame/common/svdto"
6 "apigame/common/svmysql" 6 "apigame/common/svmysql"
7 "apigame/common/svredis" 7 "apigame/common/svredis"
8 - "apigame/util/utdto"  
9 "fmt" 8 "fmt"
10 ) 9 )
11 10
@@ -18,18 +17,6 @@ type ApiGameConfig struct { @@ -18,18 +17,6 @@ type ApiGameConfig struct {
18 Name string `gorm:"column:name"` 17 Name string `gorm:"column:name"`
19 } 18 }
20 19
21 -func (c *ApiGameConfig) TableName() string { return utdto.MYSQL_TABLE_TEMPLATE }  
22 -  
23 -func (c *ApiGameConfig) GetRule(gameId string) *svdto.DtoRule {  
24 - tableName := "s_game_config"  
25 - return &svdto.DtoRule{  
26 - DbMysql: svconst.DbApi.Where("gameid = ?", gameId),  
27 - TableName: tableName,  
28 - CacheKey: fmt.Sprintf("%s:%s:%s", svdto.REDIS_CACHEP_REFIX, tableName, gameId),  
29 - CacheTime: 300,  
30 - }  
31 -}  
32 -  
33 func (c *ApiGameConfig) RedisInfo(gameId string) *svredis.RedisInfo { 20 func (c *ApiGameConfig) RedisInfo(gameId string) *svredis.RedisInfo {
34 tableName := "s_game_config" 21 tableName := "s_game_config"
35 return &svredis.RedisInfo{ 22 return &svredis.RedisInfo{
configs/registry.go
@@ -19,14 +19,6 @@ func GetApiGame(gameId string) (conf *ApiGameConfig, err error) { @@ -19,14 +19,6 @@ func GetApiGame(gameId string) (conf *ApiGameConfig, err error) {
19 return 19 return
20 } 20 }
21 21
22 - //rule := conf.GetRule(gameId)  
23 - //result := utdto.First(rule.DbMysql, conf, rule.TableName)  
24 - //has = result.RowsAffected != 0  
25 - //err = result.Error  
26 - //if err != nil {  
27 - // lxalilog.Errors(err, gameId)  
28 - // return  
29 - //}  
30 fmt.Println("dwjw GetApiGame save cache") 22 fmt.Println("dwjw GetApiGame save cache")
31 svredis.SaveData(gameId, conf) 23 svredis.SaveData(gameId, conf)
32 24