Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop
This commit is contained in:
commit
958624afde
|
@ -95,7 +95,7 @@ type wsConnectItem struct {
|
||||||
inChan chan []byte //接受消息缓冲队列(基本属性)
|
inChan chan []byte //接受消息缓冲队列(基本属性)
|
||||||
outChan chan []byte //要发送回客户端的消息缓冲队列(基本属性)
|
outChan chan []byte //要发送回客户端的消息缓冲队列(基本属性)
|
||||||
mutex sync.Mutex //互斥锁(基本属性)
|
mutex sync.Mutex //互斥锁(基本属性)
|
||||||
openDebug bool //是否开启debug
|
debug *auth.Debug //是否开启debug
|
||||||
userId int64 //用户id(基本属性)
|
userId int64 //用户id(基本属性)
|
||||||
guestId int64 //游客id(基本属性)
|
guestId int64 //游客id(基本属性)
|
||||||
extendRenderProperty extendRenderProperty //扩展云渲染属性(扩展属性)
|
extendRenderProperty extendRenderProperty //扩展云渲染属性(扩展属性)
|
||||||
|
@ -222,7 +222,13 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
|
||||||
renderCtx: renderCtx,
|
renderCtx: renderCtx,
|
||||||
renderCtxCancelFunc: renderCtxCancelFunc,
|
renderCtxCancelFunc: renderCtxCancelFunc,
|
||||||
},
|
},
|
||||||
openDebug: true, //默认都开debug
|
debug: userInfo.Debug,
|
||||||
|
}
|
||||||
|
//先设置下debug(后面要删掉)
|
||||||
|
ws.debug = &auth.Debug{
|
||||||
|
Exp: &userInfo.Exp,
|
||||||
|
IsCache: 1,
|
||||||
|
IsAllTemplateTag: 0,
|
||||||
}
|
}
|
||||||
//保存连接
|
//保存连接
|
||||||
mapConnPool.Store(uniqueId, ws)
|
mapConnPool.Store(uniqueId, ws)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import "fusenapi/constants"
|
||||||
|
|
||||||
// 入口数据格式错误
|
// 入口数据格式错误
|
||||||
func (w *wsConnectItem) incomeDataFormatErrResponse(data interface{}) {
|
func (w *wsConnectItem) incomeDataFormatErrResponse(data interface{}) {
|
||||||
if !w.openDebug {
|
if w.debug == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ERR_DATA_FORMAT, data))
|
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ERR_DATA_FORMAT, data))
|
||||||
|
@ -12,7 +12,7 @@ func (w *wsConnectItem) incomeDataFormatErrResponse(data interface{}) {
|
||||||
|
|
||||||
// 渲染错误通知
|
// 渲染错误通知
|
||||||
func (w *wsConnectItem) renderErrResponse(renderId, requestId, templateTag, taskId, description string, productId, userId, guestId, templateId, modelId, sizeId, elementModelId int64) {
|
func (w *wsConnectItem) renderErrResponse(renderId, requestId, templateTag, taskId, description string, productId, userId, guestId, templateId, modelId, sizeId, elementModelId int64) {
|
||||||
if !w.openDebug {
|
if w.debug == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data := make(map[string]interface{})
|
data := make(map[string]interface{})
|
||||||
|
|
|
@ -210,7 +210,6 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
|
||||||
logx.Error("failed to get element ,", err)
|
logx.Error("failed to get element ,", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取刀版图
|
//获取刀版图
|
||||||
combineReq := repositories.LogoCombineReq{
|
combineReq := repositories.LogoCombineReq{
|
||||||
UserId: renderImageData.RenderData.UserId,
|
UserId: renderImageData.RenderData.UserId,
|
||||||
|
@ -229,6 +228,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
|
||||||
Index: renderImageData.RenderData.TemplateTagColor.SelectedColorIndex,
|
Index: renderImageData.RenderData.TemplateTagColor.SelectedColorIndex,
|
||||||
},
|
},
|
||||||
Resolution: renderImageData.RenderData.Resolution,
|
Resolution: renderImageData.RenderData.Resolution,
|
||||||
|
Debug: w.debug,
|
||||||
}
|
}
|
||||||
res, err := w.logic.svcCtx.Repositories.ImageHandle.LogoCombine(w.logic.ctx, &combineReq)
|
res, err := w.logic.svcCtx.Repositories.ImageHandle.LogoCombine(w.logic.ctx, &combineReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -256,19 +256,24 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
|
||||||
logx.Error("failed to find render resource:", err)
|
logx.Error("failed to find render resource:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//无缓存
|
||||||
logx.Info("无缓存的渲染图,需要unity")
|
logx.Info("无缓存的渲染图,需要unity")
|
||||||
} else {
|
} else { //有缓存
|
||||||
//返回给客户端
|
//如果没有debug或者debug模式下开启了缓存则返回缓存
|
||||||
w.sendRenderResultData(websocket_data.RenderImageRspMsg{
|
if w.debug == nil || w.debug.IsCache == 1 {
|
||||||
RenderId: renderImageData.RenderId,
|
//返回给客户端
|
||||||
RequestId: renderImageData.RequestId,
|
w.sendRenderResultData(websocket_data.RenderImageRspMsg{
|
||||||
Image: *resource.ResourceUrl,
|
RenderId: renderImageData.RenderId,
|
||||||
RenderProcessTime: websocket_data.RenderProcessTime{
|
RequestId: renderImageData.RequestId,
|
||||||
UnityRenderTakesTime: "cache",
|
Image: *resource.ResourceUrl,
|
||||||
UploadUnityRenderImageTakesTime: "cache",
|
RenderProcessTime: websocket_data.RenderProcessTime{
|
||||||
},
|
UnityRenderTakesTime: "cache",
|
||||||
})
|
UploadUnityRenderImageTakesTime: "cache",
|
||||||
return
|
},
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//否则继续去unity
|
||||||
}
|
}
|
||||||
//组装数据
|
//组装数据
|
||||||
if err = w.assembleRenderDataToUnity(taskId, combineImage, renderImageData, productTemplate, model3dInfo, element, productSize); err != nil {
|
if err = w.assembleRenderDataToUnity(taskId, combineImage, renderImageData, productTemplate, model3dInfo, element, productSize); err != nil {
|
||||||
|
@ -463,7 +468,7 @@ func (w *wsConnectItem) genRenderTaskId(combineImage string, renderImageData web
|
||||||
// ****************************下面的发送消息的*********************************
|
// ****************************下面的发送消息的*********************************
|
||||||
// 发送合图完毕阶段通知消息
|
// 发送合图完毕阶段通知消息
|
||||||
func (w *wsConnectItem) sendCombineImageStepResponseMessage(renderId, requestId, combineImage string, sizeId, modelId, templateId, combineTime, uploadTime int64) {
|
func (w *wsConnectItem) sendCombineImageStepResponseMessage(renderId, requestId, combineImage string, sizeId, modelId, templateId, combineTime, uploadTime int64) {
|
||||||
if !w.openDebug {
|
if w.debug == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
combineTakesTime := "cache"
|
combineTakesTime := "cache"
|
||||||
|
@ -490,7 +495,7 @@ func (w *wsConnectItem) sendCombineImageStepResponseMessage(renderId, requestId,
|
||||||
|
|
||||||
// 发送组装unity需要的数据完毕消息
|
// 发送组装unity需要的数据完毕消息
|
||||||
func (w *wsConnectItem) sendAssembleRenderDataStepResponseMessage(renderId string, requestId string) {
|
func (w *wsConnectItem) sendAssembleRenderDataStepResponseMessage(renderId string, requestId string) {
|
||||||
if !w.openDebug {
|
if w.debug == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ASSEMBLE_RENDER_DATA, websocket_data.ToUnityRspMsg{RenderId: renderId, RequestId: requestId}))
|
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ASSEMBLE_RENDER_DATA, websocket_data.ToUnityRspMsg{RenderId: renderId, RequestId: requestId}))
|
||||||
|
@ -498,7 +503,7 @@ func (w *wsConnectItem) sendAssembleRenderDataStepResponseMessage(renderId strin
|
||||||
|
|
||||||
// 发送组装数据到unity完毕阶段通知消息
|
// 发送组装数据到unity完毕阶段通知消息
|
||||||
func (w *wsConnectItem) sendRenderDataToUnityStepResponseMessage(renderId string, requestId string) {
|
func (w *wsConnectItem) sendRenderDataToUnityStepResponseMessage(renderId string, requestId string) {
|
||||||
if !w.openDebug {
|
if w.debug == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_SEND_DATA_TO_UNITY, websocket_data.AssembleRenderDataRspMsg{RenderId: renderId, RequestId: requestId}))
|
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_SEND_DATA_TO_UNITY, websocket_data.AssembleRenderDataRspMsg{RenderId: renderId, RequestId: requestId}))
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"fusenapi/constants"
|
"fusenapi/constants"
|
||||||
"fusenapi/model/gmodel"
|
"fusenapi/model/gmodel"
|
||||||
|
"fusenapi/utils/auth"
|
||||||
"fusenapi/utils/curl"
|
"fusenapi/utils/curl"
|
||||||
"fusenapi/utils/file"
|
"fusenapi/utils/file"
|
||||||
"fusenapi/utils/hash"
|
"fusenapi/utils/hash"
|
||||||
|
@ -126,7 +127,8 @@ type (
|
||||||
Qrcode string `json:"qrcode"` // 合图参数
|
Qrcode string `json:"qrcode"` // 合图参数
|
||||||
LogoUrl string `json:"logo_url"` // 合图参数
|
LogoUrl string `json:"logo_url"` // 合图参数
|
||||||
Resolution string `json:"resolution"` // 合图参数
|
Resolution string `json:"resolution"` // 合图参数
|
||||||
TemplateTagColor TemplateTagColor `json:"template_tag_color"` //合图颜色
|
TemplateTagColor TemplateTagColor `json:"template_tag_color"` // 合图颜色
|
||||||
|
Debug *auth.Debug `json:"debug"`
|
||||||
}
|
}
|
||||||
LogoCombineRes struct {
|
LogoCombineRes struct {
|
||||||
ResourceId string
|
ResourceId string
|
||||||
|
|
Loading…
Reference in New Issue
Block a user