registry.go 882 Bytes
package configs

import (
	"apigame/configs/confroomrank"
	"apigame/service-common/svmysql"
	"apigame/service-common/svredis"
	"apigame/util/util-lx/lxalilog"
	"fmt"
)

// GetRoomRankConfig 获取 房间排行活动配置
func GetRoomRankConfig(gameId string) (conf *confroomrank.ActivityConfig, has bool) {
	var err error
	conf = new(confroomrank.ActivityConfig)
	has = svredis.LoadData(gameId, conf)
	if has {
		fmt.Println("dwjw GetRoomRankConfig use cache")
		return
	}
	confRaw := new(confroomrank.ActivityConfigRaw)
	has, err = svmysql.First(confRaw, gameId)
	if err != nil {
		lxalilog.Errors(err, "configs.GetRoomRankConfig error", gameId)
		return
	}
	if !has {

		return
	}

	conf.Decode(gameId, confRaw)

	fmt.Println("dwjw GetRoomRankConfig save cache")
	fmt.Println("dwjw🐸", conf.Robot)
	fmt.Println("dwjw🐸", conf.Room)
	svredis.SaveData(gameId, conf)

	return
}