api.go 952 Bytes
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
}