fix
This commit is contained in:
parent
991f3c5cd5
commit
190010a6fe
|
@ -31,15 +31,12 @@ func NewCommonNotifyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Comm
|
||||||
// }
|
// }
|
||||||
|
|
||||||
func (l *CommonNotifyLogic) CommonNotify(req *types.CommonNotifyReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *CommonNotifyLogic) CommonNotify(req *types.CommonNotifyReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if req.Data == "" {
|
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "data is empty")
|
|
||||||
}
|
|
||||||
//websocket连接id不能为空
|
//websocket连接id不能为空
|
||||||
if req.WebsocketId == "" {
|
if req.Wid == "" {
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "websocket connect id is empty")
|
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "websocket connect id is empty")
|
||||||
}
|
}
|
||||||
//查询websocket连接
|
//查询websocket连接
|
||||||
value, ok := mapConnPool.Load(req.WebsocketId)
|
value, ok := mapConnPool.Load(req.Wid)
|
||||||
if !ok {
|
if !ok {
|
||||||
return resp.SetStatusWithMessage(basic.CodeOK, "success,but connection is not found")
|
return resp.SetStatusWithMessage(basic.CodeOK, "success,but connection is not found")
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@ type RenderNotifyReq struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommonNotifyReq struct {
|
type CommonNotifyReq struct {
|
||||||
WebsocketId string `json:"websocket_id"` //websocket连接标识
|
Wid string `json:"wid"` //websocket连接标识
|
||||||
Data map[string]interface{} `json:"data"` //后端与前端约定好的数据
|
Data map[string]interface{} `json:"data"` //后端与前端约定好的数据
|
||||||
}
|
}
|
||||||
|
|
||||||
type Request struct {
|
type Request struct {
|
||||||
|
|
|
@ -29,6 +29,6 @@ type RenderNotifyReq {
|
||||||
}
|
}
|
||||||
//通用回调接口
|
//通用回调接口
|
||||||
type CommonNotifyReq {
|
type CommonNotifyReq {
|
||||||
WebsocketId string `json:"websocket_id"` //websocket连接标识
|
Wid string `json:"wid"` //websocket连接标识
|
||||||
Data map[string]interface{} `json:"data"` //后端与前端约定好的数据
|
Data map[string]interface{} `json:"data"` //后端与前端约定好的数据
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user