Files
bl/logic/service/player/rpc.go
昔念 90b62b44e4
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
```
refactor(common): 统一Redis连接方式并优化代码结构

- 将 g.Redis("cool").Conn(ctx) 统一改为 Redis.Conn(ctx) 的调用方式
- 在coolconfig中添加ServerList.GetID()方法用于生成服务器唯一标识
- 引入gconv包用于类型转换操作

feat(rpc): 完善ListenFight函数实现集群消息监听

- 新增ListenFight函数,完全对齐ListenFunc
2026-03-20 04:58:23 +08:00

25 lines
419 B
Go

package player
import (
"blazing/cool"
"context"
)
// rpc,跨服匹配的玩家,只做数据的传输
type RPC_player struct {
baseplayer
//
serviceid uint32 //玩家所在的ID
}
func (f *RPC_player) SendPackCmd(cmd uint32, data any) {
conn, _ := cool.Redis.Conn(context.TODO())
defer conn.Close(context.TODO())
conn.Do(context.TODO(), "publish", "sun:send", cmd, data)
//fmt.Println("战斗结束")
}