fix
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
@@ -65,11 +64,27 @@ func (l *GetProductDesignLogic) GetProductDesign(req *types.GetProductDesignReq,
|
||||
if productTemplateV2Info.Id == 0 {
|
||||
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "template info is not exists")
|
||||
}
|
||||
//解析json
|
||||
var info types.ProductDesignInfo
|
||||
if err = json.Unmarshal([]byte(*designInfo.Info), &info); err != nil {
|
||||
//获取产品模型信息
|
||||
productModel3dModel := gmodel.NewFsProductModel3dModel(l.svcCtx.MysqlConn)
|
||||
model3dInfo, err := productModel3dModel.FindOne(l.ctx, *designInfo.OptionalId)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to parse design info")
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get product 3D model info")
|
||||
}
|
||||
return resp.SetStatus(basic.CodeOK)
|
||||
if model3dInfo.Id == 0 {
|
||||
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "product 3D model info is not exists")
|
||||
}
|
||||
optionalId := *designInfo.OptionalId
|
||||
if *model3dInfo.Status == 0 && *sizeInfo.Status == 1 && *productTemplateV2Info.Status == 1 && *productTemplateV2Info.IsDel == 0 {
|
||||
optionalId = 0
|
||||
}
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetProductDesignRsp{
|
||||
ProductId: *designInfo.ProductId,
|
||||
TemplateId: *designInfo.TemplateId,
|
||||
MaterialId: *designInfo.MaterialId,
|
||||
SizeId: *designInfo.SizeId,
|
||||
OptionalId: optionalId,
|
||||
Cover: *designInfo.Cover,
|
||||
Info: *designInfo.Info,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -97,79 +97,17 @@ type PriceObj struct {
|
||||
}
|
||||
|
||||
type GetProductDesignReq struct {
|
||||
Sn string `json:"sn"`
|
||||
Sn string `form:"sn"`
|
||||
}
|
||||
|
||||
type GetProductDesignRsp struct {
|
||||
ProductId int64 `json:"product_id"`
|
||||
TemplateId int64 `json:"template_id"`
|
||||
MaterialId int64 `json:"material_id"`
|
||||
SizeId int64 `json:"size_id"`
|
||||
OptionalId int64 `json:"optional_id"`
|
||||
Cover string `json:"cover"`
|
||||
Info []ProductDesignInfo `json:"info"`
|
||||
}
|
||||
|
||||
type ProductDesignInfo struct {
|
||||
Id string `json:"id"`
|
||||
Tag string `json:"tag"`
|
||||
Title string `json:"title"`
|
||||
Type string `json:"type"`
|
||||
Text string `json:"text"`
|
||||
Fill string `json:"fill"`
|
||||
FontSize int64 `json:"fontSize"`
|
||||
FontFamily string `json:"fontFamily"`
|
||||
IfBr bool `json:"ifBr"`
|
||||
IfShow bool `json:"ifShow"`
|
||||
IfGroup bool `json:"ifGroup"`
|
||||
MaxNum int64 `json:"maxNum"`
|
||||
Rotation int64 `json:"rotation"`
|
||||
Align string `json:"align"`
|
||||
VerticalAlign string `json:"verticalAlign"`
|
||||
Material string `json:"material"`
|
||||
QRcodeType string `json:"QRcodeType"`
|
||||
Width int64 `json:"width"`
|
||||
Height int64 `json:"height"`
|
||||
X int64 `json:"x"`
|
||||
Y int64 `json:"y"`
|
||||
Opacity int64 `json:"opacity"`
|
||||
OptionalColor []OptionalColor `json:"optionalColor"`
|
||||
ZIndex int64 `json:"zIndex"`
|
||||
SvgPath string `json:"svgPath"`
|
||||
MaterialName string `json:"materialName"`
|
||||
MaterialTime string `json:"materialTime"`
|
||||
Follow DesignFollow `json:"follow"`
|
||||
Group []DesignGroup `json:"group"`
|
||||
CameraStand CameraStand `json:"cameraStand"`
|
||||
}
|
||||
|
||||
type CameraStand struct {
|
||||
X int64 `json:"x"`
|
||||
Y int64 `json:"y"`
|
||||
Z int64 `json:"z"`
|
||||
}
|
||||
|
||||
type DesignGroup struct {
|
||||
Tag string `json:"tag"`
|
||||
Text string `json:"text"`
|
||||
Title string `json:"title"`
|
||||
IfBr bool `json:"ifBr"`
|
||||
IfGroupNoBr bool `json:"ifGroupNoBr"`
|
||||
IfShow bool `json:"ifShow"`
|
||||
MaxNum int64 `json:"maxNum"`
|
||||
PaddingNum int64 `json:"paddingNum"`
|
||||
}
|
||||
|
||||
type DesignFollow struct {
|
||||
Fill string `json:"fill"`
|
||||
IfShow string `json:"ifShow"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type OptionalColor struct {
|
||||
Color string `json:"color"`
|
||||
Name string `json:"name"`
|
||||
Default bool `json:"default"`
|
||||
ProductId int64 `json:"product_id"`
|
||||
TemplateId int64 `json:"template_id"`
|
||||
MaterialId int64 `json:"material_id"`
|
||||
SizeId int64 `json:"size_id"`
|
||||
OptionalId int64 `json:"optional_id"`
|
||||
Cover string `json:"cover"`
|
||||
Info string `json:"info"`
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
|
||||
Reference in New Issue
Block a user