1
This commit is contained in:
@@ -21,6 +21,7 @@ var (
|
||||
// RunMode = "dev" // 定义全局运行模式
|
||||
IsRedisMode = false // 定义全局是否为redis模式
|
||||
I18n = gi18n.New() // 定义全局国际化对象
|
||||
Redis *gredis.Redis
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -47,11 +48,11 @@ func init() {
|
||||
}
|
||||
if !redisVar.IsEmpty() {
|
||||
redisVar.Struct(redisConfig)
|
||||
redis, err := gredis.New(redisConfig)
|
||||
Redis, err = gredis.New(redisConfig)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
CacheManager.SetAdapter(gcache.NewAdapterRedis(redis))
|
||||
CacheManager.SetAdapter(gcache.NewAdapterRedis(Redis))
|
||||
IsRedisMode = true
|
||||
// g.DB().GetCache().SetAdapter(gcache.NewAdapterRedis(redis)) //设置数据库
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"net"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gcache"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
@@ -57,9 +58,9 @@ func isPortAvailable(port uint32) bool {
|
||||
func Start() {
|
||||
serverID := cool.Config.GameOnlineID
|
||||
cool.Config.ServerInfo = config.NewServerService().GetServerID(serverID).ServerList
|
||||
// if cool.Config.ServerInfo.IsVip != 0 {
|
||||
// g.DB().GetCache().SetAdapter(gcache.NewAdapterRedis(redis)) //设置数据库
|
||||
// }
|
||||
if cool.Config.ServerInfo.IsVip != 0 {
|
||||
g.DB().GetCache().SetAdapter(gcache.NewAdapterRedis(cool.Redis)) //设置数据库
|
||||
}
|
||||
|
||||
if cool.Config.ServerInfo.IsDebug == 1 {
|
||||
g.DB().SetDebug(true)
|
||||
|
||||
Reference in New Issue
Block a user