api.go
952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package configs
import (
"apigame/common/svconfig"
"apigame/common/svconst"
"apigame/service/constd"
"fmt"
)
type ApiGameConfig struct {
AppId string `json:"appid"`
GameId string `json:"gameid"`
Secret string `json:"secret"`
AppKey string `json:"appkey"`
Name string `json:"name"`
}
func (c *ApiGameConfig) GetRule(gameId string) *svconfig.ConfigRule {
tableName := constd.MYSQL_TABLE_S_CARDHOLDER_CONFIG
return &svconfig.ConfigRule{
DbMysql: svconst.DbApi,
TableNameTemplate: svconfig.MYSQL_TABLE_TEMPLATE,
TableName: tableName + gameId,
CacheKey: fmt.Sprintf("%s::%s::%s", svconfig.REDIS_CACHEP_REFIX, tableName, gameId),
CacheTime: 300,
}
}
func (c *ApiGameConfig) ReadFromMysql(gameId string) *ApiGameConfig {
rule := c.GetRule(gameId)
}
func GetApiGameConfig(gameId string) (config *ApiGameConfig, err error) {
//rds := zredis.GetConn()
//zredis.HGetData(rds, player)
return
}