优化ws代码结构
This commit is contained in:
parent
d9daae7829
commit
e5ddc9e3dc
|
@ -173,7 +173,7 @@ func (w *wsConnectItem) renderImage(data []byte) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//获取唯一id
|
//获取唯一id
|
||||||
taskId := w.genRenderTaskId(renderImageData, model3dInfo, productTemplate, element)
|
taskId := w.genRenderTaskId(combineImage, renderImageData, model3dInfo, productTemplate, element)
|
||||||
//查询有没有缓存的资源,有就返回######################
|
//查询有没有缓存的资源,有就返回######################
|
||||||
resource, err := w.logic.svcCtx.AllModels.FsResource.FindOneById(w.logic.ctx, taskId)
|
resource, err := w.logic.svcCtx.AllModels.FsResource.FindOneById(w.logic.ctx, taskId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -492,7 +492,7 @@ func (w *wsConnectItem) modifyRenderTaskProperty(taskId string, property renderT
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组装渲染任务id
|
// 组装渲染任务id
|
||||||
func (w *wsConnectItem) genRenderTaskId(renderImageData websocket_data.RenderImageReqMsg, model3dInfo *gmodel.FsProductModel3d, productTemplate *gmodel.FsProductTemplateV2, element *gmodel.FsProductTemplateElement) string {
|
func (w *wsConnectItem) genRenderTaskId(combineImage string, renderImageData websocket_data.RenderImageReqMsg, model3dInfo *gmodel.FsProductModel3d, productTemplate *gmodel.FsProductTemplateV2, element *gmodel.FsProductTemplateElement) string {
|
||||||
//生成任务id(需要把user_id,guest_id设为0)
|
//生成任务id(需要把user_id,guest_id设为0)
|
||||||
incomeHashParam := renderImageData.RenderData
|
incomeHashParam := renderImageData.RenderData
|
||||||
incomeHashParam.UserId = 0 //设为0(渲染跟用户id无关)
|
incomeHashParam.UserId = 0 //设为0(渲染跟用户id无关)
|
||||||
|
@ -513,6 +513,7 @@ func (w *wsConnectItem) genRenderTaskId(renderImageData websocket_data.RenderIma
|
||||||
"template_info": templateHashStr,
|
"template_info": templateHashStr,
|
||||||
"material_image": *productTemplate.MaterialImg,
|
"material_image": *productTemplate.MaterialImg,
|
||||||
"render_element": elementHashBytes,
|
"render_element": elementHashBytes,
|
||||||
|
"combine_image": combineImage,
|
||||||
}
|
}
|
||||||
return hash.JsonHashKey(hashMap)
|
return hash.JsonHashKey(hashMap)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user