Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop

This commit is contained in:
momo 2023-10-30 18:30:24 +08:00
commit 9fdba9c9cc
2 changed files with 7 additions and 16 deletions

View File

@ -10,20 +10,11 @@ type allocationProcessorFactory interface {
allocationMessage(w *wsConnectItem, data []byte) allocationMessage(w *wsConnectItem, data []byte)
} }
var mapAllocationProcessor = make(map[constants.Websocket]allocationProcessorFactory) // 要添加分发在这里
var mapAllocationProcessor = map[constants.Websocket]allocationProcessorFactory{
constants.WEBSOCKET_RENDER_IMAGE: &renderProcessor{}, //渲染工厂
}
func (w *wsConnectItem) newAllocationProcessor(msgType constants.Websocket) allocationProcessorFactory { func (w *wsConnectItem) newAllocationProcessor(msgType constants.Websocket) allocationProcessorFactory {
if val, ok := mapAllocationProcessor[msgType]; ok { return mapAllocationProcessor[msgType]
return val
}
var obj allocationProcessorFactory
switch msgType {
//图片渲染
case constants.WEBSOCKET_RENDER_IMAGE:
obj = &renderProcessor{}
default:
return nil
}
mapAllocationProcessor[msgType] = obj
return obj
} }

View File

@ -159,8 +159,8 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
w.renderErrResponse(renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "请传入正确的合图分辨率格式", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0) w.renderErrResponse(renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "请传入正确的合图分辨率格式", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0)
return return
} }
if resolution < 512 || resolution > 2048 { if resolution < 100 || resolution > 800 {
w.renderErrResponse(renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "请传入正确的合图分辨率范围值(512~2048)", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0) w.renderErrResponse(renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "请传入正确的合图分辨率范围值(100~800)", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0)
return return
} }
lenColor := len(renderImageData.RenderData.TemplateTagColor.Colors) lenColor := len(renderImageData.RenderData.TemplateTagColor.Colors)