This commit is contained in:
laodaming 2023-08-16 17:18:51 +08:00
parent d3220e2461
commit a422979748
2 changed files with 7 additions and 1 deletions

View File

@ -11,3 +11,9 @@ 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
}

View File

@ -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.FindOneByModelId(w.logic.ctx, *productTemplate.ModelId)
element, err := w.logic.svcCtx.AllModels.FsProductTemplateElement.FindRandOne(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)