package model

import (
	"game/common/constant"
	"game/common/utils"
	"game/server/colorgame/config"
	"github.com/fox/fox/db"
	"github.com/fox/fox/log"
	"github.com/go-redis/redis/v8"
)

var (
	//UserBindServiceRedis *redis.Client
	UserRedis *redis.Client
)

func InitRedis() {
	log.Debug("init redis")
	var err error
	cfg := &config.Cfg.Redis
	//UserBindServiceRedis, err = db.InitRedis(cfg.Password, cfg.Host, cfg.Port, constant.Redis3UserBindService)
	//if err != nil {
	//	log.Fatal(err.Error())
	//	return
	//}
	//utils.AutoSetRedisPool(UserBindServiceRedis)

	UserRedis, err = db.InitRedis(cfg.Password, cfg.Host, cfg.Port, constant.Redis1User)
	if err != nil {
		log.Fatal(err.Error())
		return
	}
	utils.AutoSetRedisPool(UserRedis)
}
