fix: 用户id参数没搞对

main
NorthLan 3 years ago
parent a09e4e40b8
commit 761177b22a

@ -2,7 +2,7 @@ Server:
Debug: false Debug: false
Listen: 0.0.0.0:8888 Listen: 0.0.0.0:8888
Command: Command:
Keys: [ "j", "加入", "加入游戏", "s", "w", "c1", "c2", "c3", "c4", "r1", "r2", "r3", "m1", "m2", "m3" ] Keys: [ "j", "加入", "加入游戏", "s", "w", "我在哪", "c1", "c2", "c3", "c4", "r1", "r2", "r3", "m1", "m2", "m3" ]
UserCenterRpc: UserCenterRpc:
Etcd: Etcd:
Hosts: Hosts:

@ -23,7 +23,7 @@ func (m *Manager) Register(h HandlerFunc, cmd string, alias ...string) {
m.handlers[cmd] = h m.handlers[cmd] = h
// alias // alias
for _, s := range alias { for _, s := range alias {
if _, ok := m.handlers[cmd]; ok { if _, ok := m.handlers[s]; ok {
continue continue
} }
m.handlers[s] = h m.handlers[s] = h

@ -23,6 +23,9 @@ func TestParse(t *testing.T) {
"不服你咬我啊?", "不服你咬我啊?",
"红方前排速度m2b2", "红方前排速度m2b2",
"c1c2c3c4c1c2c3c4", "c1c2c3c4c1c2c3c4",
"m2",
"b2",
"c2",
} }
p := NewCMDParser([]string{"j", "c1", "c2", "c3", "c4", "b1", "b2", "b3", "s", "b2", "b3", "w", "m1", "m2", "m3", "加入", "加入游戏"}) p := NewCMDParser([]string{"j", "c1", "c2", "c3", "c4", "b1", "b2", "b3", "s", "b2", "b3", "w", "m1", "m2", "m3", "加入", "加入游戏"})

@ -38,7 +38,7 @@ func (h *MsgToPushHandler) Init(svc *svc.ServiceContext) {
h.commandManager = command.NewManager() h.commandManager = command.NewManager()
h.commandManager.Register(h.handleJoinGame, "j", "加入", "加入游戏") h.commandManager.Register(h.handleJoinGame, "j", "加入", "加入游戏")
h.commandManager.Register(h.handleOutbreak, "s") h.commandManager.Register(h.handleOutbreak, "s")
h.commandManager.Register(h.handleWai, "w") h.commandManager.Register(h.handleWai, "w", "我在哪")
h.commandManager.Register(h.handleCreateUnit, "c1", "c2", "c3", "c4") h.commandManager.Register(h.handleCreateUnit, "c1", "c2", "c3", "c4")
h.commandManager.Register(h.handleMove, "m1", "m2", "m3") h.commandManager.Register(h.handleMove, "m1", "m2", "m3")
h.commandManager.Register(h.handleMode, "r1", "r2", "r3") h.commandManager.Register(h.handleMode, "r1", "r2", "r3")
@ -119,6 +119,7 @@ func (h *MsgToPushHandler) handleDanmaku(data []byte, msgKey string) {
PUid: strconv.FormatInt(msgFromMq.Uid, 10), PUid: strconv.FormatInt(msgFromMq.Uid, 10),
}) })
if err == nil { if err == nil {
pbUser.UId = rpcUser.User.Id
pbUser.Avatar = rpcUser.User.PAvatar pbUser.Avatar = rpcUser.User.PAvatar
} else { } else {
logger.SLog.Info("rpc获取用户信息失败") logger.SLog.Info("rpc获取用户信息失败")

@ -59,6 +59,7 @@ func (h *MsgToPushHandler) handleGift(data []byte, msgKey string) {
PUid: strconv.FormatInt(msgFromMq.Uid, 10), PUid: strconv.FormatInt(msgFromMq.Uid, 10),
}) })
if err == nil { if err == nil {
pbUser.UId = rpcUser.User.Id
pbUser.Avatar = rpcUser.User.PAvatar pbUser.Avatar = rpcUser.User.PAvatar
} else { } else {
logger.SLog.Error("rpc获取用户信息失败", err) logger.SLog.Error("rpc获取用户信息失败", err)

Loading…
Cancel
Save