fix
This commit is contained in:
parent
6dba8507a7
commit
cda5c69f4f
|
@ -40,14 +40,16 @@ func NewRenderNotifyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Rend
|
||||||
// }
|
// }
|
||||||
|
|
||||||
func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
logx.Info("收到渲染回调数据:", *req)
|
|
||||||
if req.TaskId == "" {
|
if req.TaskId == "" {
|
||||||
|
logx.Error("渲染回调参数错误:invalid param task_id")
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param task_id")
|
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param task_id")
|
||||||
}
|
}
|
||||||
if req.Image == "" {
|
if req.Image == "" {
|
||||||
|
logx.Error("渲染回调参数错误:invalid param image")
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param image")
|
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param image")
|
||||||
}
|
}
|
||||||
if req.UserId == 0 && req.GuestId == 0 {
|
if req.UserId == 0 && req.GuestId == 0 {
|
||||||
|
logx.Error("渲染回调参数错误:invalid user_id or guest_id")
|
||||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid user_id or guest_id")
|
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid user_id or guest_id")
|
||||||
}
|
}
|
||||||
// 上传文件
|
// 上传文件
|
||||||
|
@ -68,7 +70,7 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a
|
||||||
FileByte: nil,
|
FileByte: nil,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logx.Error(err)
|
logx.Error("渲染回调上传文件失败:", err)
|
||||||
return resp.SetStatusWithMessage(basic.CodeFileUploadErr, "failed to upload render resource image")
|
return resp.SetStatusWithMessage(basic.CodeFileUploadErr, "failed to upload render resource image")
|
||||||
}
|
}
|
||||||
//遍历websocket链接把数据传进去
|
//遍历websocket链接把数据传进去
|
||||||
|
@ -76,6 +78,7 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a
|
||||||
//断言连接
|
//断言连接
|
||||||
ws, ok := value.(wsConnectItem)
|
ws, ok := value.(wsConnectItem)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
logx.Error("渲染回调断言websocket连接失败")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//关闭标识
|
//关闭标识
|
||||||
|
@ -102,10 +105,10 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a
|
||||||
case ws.renderProperty.renderImageTaskCtlChan <- deleteTask: //删除对应的需要渲染的图片map
|
case ws.renderProperty.renderImageTaskCtlChan <- deleteTask: //删除对应的需要渲染的图片map
|
||||||
//发送数据到out chan
|
//发送数据到out chan
|
||||||
ws.sendToOutChan(b)
|
ws.sendToOutChan(b)
|
||||||
|
return true
|
||||||
case <-time.After(time.Second * 3): //超时丢弃
|
case <-time.After(time.Second * 3): //超时丢弃
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
})
|
})
|
||||||
logx.Info("渲染回调成功######################")
|
logx.Info("渲染回调成功######################")
|
||||||
return resp.SetStatusWithMessage(basic.CodeOK, "success")
|
return resp.SetStatusWithMessage(basic.CodeOK, "success")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user