refactor(common): 统一Redis连接方式并优化代码结构
- 将 g.Redis("cool").Conn(ctx) 统一改为 Redis.Conn(ctx) 的调用方式
- 在coolconfig中添加ServerList.GetID()方法用于生成服务器唯一标识
- 引入gconv包用于类型转换操作
feat(rpc): 完善ListenFight函数实现集群消息监听
- 新增ListenFight函数,完全对齐ListenFunc
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"blazing/common/rpc"
|
||||
"blazing/common/socket"
|
||||
"blazing/cool"
|
||||
"context"
|
||||
|
||||
"blazing/logic/controller"
|
||||
|
||||
@@ -60,7 +61,7 @@ func Start() {
|
||||
// if cool.Config.ServerInfo.IsVip != 0 {
|
||||
// g.DB().GetCache().SetAdapter(gcache.NewAdapterRedis(cool.Redis)) //设置数据库
|
||||
// }
|
||||
|
||||
go rpc.ListenFight(context.Background())
|
||||
if cool.Config.ServerInfo.IsDebug == 1 {
|
||||
g.DB().SetDebug(true)
|
||||
|
||||
@@ -81,7 +82,7 @@ func Start() {
|
||||
|
||||
controller.Maincontroller.RPCClient = rpcClient //将RPC赋值Start
|
||||
|
||||
controller.Maincontroller.UID = uint32(100000*serverID + uint32(port)) //赋值服务器ID
|
||||
controller.Maincontroller.UID = gconv.Uint32(cool.Config.ServerInfo.GetID()) //赋值服务器ID
|
||||
controller.Init(true)
|
||||
xmlres.Initfile()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user