fix
This commit is contained in:
@@ -42,6 +42,9 @@ func (l *GetTemplateByPidLogic) GetTemplateByPid(req *types.GetTemplateByPidReq,
|
||||
if req.Size > 0 {
|
||||
req.Size = image.GetCurrentSize(req.Size)
|
||||
}
|
||||
if req.ProductTemplateTagId <= 0 {
|
||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "err param:product_template_tag_id")
|
||||
}
|
||||
//获取产品信息(只是获取id)
|
||||
productInfo, err := l.svcCtx.AllModels.FsProduct.FindOneBySn(l.ctx, req.Pid, "id")
|
||||
if err != nil {
|
||||
@@ -51,7 +54,7 @@ func (l *GetTemplateByPidLogic) GetTemplateByPid(req *types.GetTemplateByPidReq,
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product info")
|
||||
}
|
||||
//获取尺寸ids(只获取)
|
||||
//获取尺寸ids(只获取id)
|
||||
sizeList, err := l.svcCtx.AllModels.FsProductSize.GetAllByProductIds(l.ctx, []int64{productInfo.Id}, "id")
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
@@ -80,7 +83,7 @@ func (l *GetTemplateByPidLogic) GetTemplateByPid(req *types.GetTemplateByPidReq,
|
||||
mapModel[v.Id] = k
|
||||
}
|
||||
//获取模板数据
|
||||
productTemplateList, err := l.svcCtx.AllModels.FsProductTemplateV2.FindAllByModelIds(l.ctx, modelIds, "sort DESC")
|
||||
productTemplateList, err := l.svcCtx.AllModels.FsProductTemplateV2.FindAllByModelIdsTemplateTag(l.ctx, modelIds, fmt.Sprintf("%d", req.ProductTemplateTagId), "sort DESC")
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product templates")
|
||||
|
||||
@@ -340,8 +340,9 @@ type GetSizeByPidRsp struct {
|
||||
}
|
||||
|
||||
type GetTemplateByPidReq struct {
|
||||
Pid string `form:"pid"`
|
||||
Size uint32 `form:"size"`
|
||||
Pid string `form:"pid"`
|
||||
Size uint32 `form:"size"`
|
||||
ProductTemplateTagId int64 `form:"product_template_tag_id"`
|
||||
}
|
||||
|
||||
type GetFittingByPidReq struct {
|
||||
|
||||
Reference in New Issue
Block a user