diff --git a/model/gmodel/fs_product_template_element_logic.go b/model/gmodel/fs_product_template_element_logic.go index f1f2afe4..783f5480 100644 --- a/model/gmodel/fs_product_template_element_logic.go +++ b/model/gmodel/fs_product_template_element_logic.go @@ -11,9 +11,3 @@ func (e *FsProductTemplateElementModel) FindOneByModelId(ctx context.Context, mo Take(&resp).Error return resp, err } -func (e *FsProductTemplateElementModel) FindRandOne(ctx context.Context) (resp *FsProductTemplateElement, err error) { - err = e.db.WithContext(ctx).Model(&FsProductTemplateElement{}). - Order("RAND()"). - Take(&resp).Error - return resp, err -} diff --git a/server/websocket/internal/logic/ws_render_image_logic.go b/server/websocket/internal/logic/ws_render_image_logic.go index 338d074b..560cb4d7 100644 --- a/server/websocket/internal/logic/ws_render_image_logic.go +++ b/server/websocket/internal/logic/ws_render_image_logic.go @@ -188,7 +188,7 @@ func (w *wsConnectItem) assembleRenderData(taskId string, info websocket_data.Re } logx.Info("合成刀版图成功:", *res.ResourceUrl) //获取渲染设置信息 - element, err := w.logic.svcCtx.AllModels.FsProductTemplateElement.FindRandOne(w.logic.ctx /*, *productTemplate.ModelId*/) + element, err := w.logic.svcCtx.AllModels.FsProductTemplateElement.FindOneByModelId(w.logic.ctx, *productTemplate.ModelId) if err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { logx.Error("element info is not found,model_id = ", *productTemplate.ModelId)