fix
This commit is contained in:
parent
b2460bbc87
commit
d349fe3197
|
@ -46,11 +46,13 @@ func (l *LoginNotifyLogic) LoginNotify(req *types.LoginNotifyReq, userinfo *auth
|
|||
logx.Error("解密失败:", err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "invalid data ")
|
||||
}
|
||||
//真正的数据结构
|
||||
var parseInfo websocket_data.NotifyData
|
||||
if err = json.Unmarshal([]byte(data), &parseInfo); err != nil {
|
||||
logx.Error("failed to parse json data:", err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "invalid format of parse data")
|
||||
}
|
||||
//websocket连接id不能为空
|
||||
if parseInfo.WebsocketConnectId == "" {
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "websocket connect id is empty")
|
||||
}
|
||||
|
@ -59,10 +61,12 @@ func (l *LoginNotifyLogic) LoginNotify(req *types.LoginNotifyReq, userinfo *auth
|
|||
if parseInfo.RequestTime < now-20 || parseInfo.RequestTime > now+20 {
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "invalid data ,time is not in allowed range")
|
||||
}
|
||||
//查询websocket连接
|
||||
value, ok := mapConnPool.Load(parseInfo.WebsocketConnectId)
|
||||
if !ok {
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "success,but connection is not found")
|
||||
}
|
||||
//断言连接
|
||||
ws, ok := value.(wsConnectItem)
|
||||
if !ok {
|
||||
logx.Error("渲染回调断言websocket连接失败")
|
||||
|
|
|
@ -46,11 +46,13 @@ func (l *RegisterAccountNotifyLogic) RegisterAccountNotify(req *types.RegisterAc
|
|||
logx.Error("解密失败:", err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "invalid data ")
|
||||
}
|
||||
//真正的数据结构
|
||||
var parseInfo websocket_data.NotifyData
|
||||
if err = json.Unmarshal([]byte(data), &parseInfo); err != nil {
|
||||
logx.Error("failed to parse json data:", err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "invalid format of parse data")
|
||||
}
|
||||
//websocket连接id不能为空
|
||||
if parseInfo.WebsocketConnectId == "" {
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "websocket connect id is empty")
|
||||
}
|
||||
|
@ -59,10 +61,12 @@ func (l *RegisterAccountNotifyLogic) RegisterAccountNotify(req *types.RegisterAc
|
|||
if parseInfo.RequestTime < now-20 || parseInfo.RequestTime > now+20 {
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "invalid data ,time is not in allowed range")
|
||||
}
|
||||
//查询websocket连接
|
||||
value, ok := mapConnPool.Load(parseInfo.WebsocketConnectId)
|
||||
if !ok {
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "success,but connection is not found")
|
||||
}
|
||||
//断言连接
|
||||
ws, ok := value.(wsConnectItem)
|
||||
if !ok {
|
||||
logx.Error("渲染回调断言websocket连接失败")
|
||||
|
|
Loading…
Reference in New Issue
Block a user