This commit is contained in:
laodaming 2023-10-07 10:43:33 +08:00
parent cf83bd068b
commit aafcbfcf50
4 changed files with 9 additions and 1 deletions

View File

@ -94,6 +94,7 @@ func (l *AddToCartLogic) AddToCart(req *types.AddToCartReq, userinfo *auth.UserI
fittingName string //配件名
lightJson interface{} //灯光设计数据
lightName string //灯光名字
modelJson interface{} //模型json
)
//有模板
if req.TemplateId > 0 {
@ -174,6 +175,10 @@ func (l *AddToCartLogic) AddToCart(req *types.AddToCartReq, userinfo *auth.UserI
if modelInfo.ModelInfo == nil || *modelInfo.ModelInfo == "" {
return resp.SetStatusWithMessage(basic.CodeServiceErr, "the model`s design info is empty")
}
if err = json.Unmarshal([]byte(*modelInfo.ModelInfo), &modelJson); err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse model design info")
}
//获取灯光信息
if *modelInfo.Light > 0 {
lightInfo, err := l.svcCtx.AllModels.FsProductModel3dLight.FindOne(l.ctx, *modelInfo.Light)
@ -208,7 +213,7 @@ func (l *AddToCartLogic) AddToCart(req *types.AddToCartReq, userinfo *auth.UserI
TemplateTag: templateTag,
},
ModelInfo: gmodel.ModelInfo{
ModelJson: *modelInfo.ModelInfo,
ModelJson: modelJson,
},
FittingInfo: gmodel.FittingInfo{
FittingJson: fittingJson,

View File

@ -196,6 +196,7 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo
IsSelected: *cart.IsSelected > 0,
TemplateTag: templateTag,
Logo: snapShot.Logo,
RenderImage: snapShot.RenderImage,
}
//是否有失效的
if description, ok := mapCartChange[cart.Id]; ok {

View File

@ -55,6 +55,7 @@ type CartItem struct {
IsSelected bool `json:"is_selected"` //是否选中
TemplateTag string `json:"template_tag"` //模板标签
Logo string `json:"logo"`
RenderImage string `json:"render_image"` //渲染结果图
}
type ProductInfo struct {

View File

@ -72,6 +72,7 @@ type CartItem {
IsSelected bool `json:"is_selected"` //是否选中
TemplateTag string `json:"template_tag"` //模板标签
Logo string `json:"logo"`
RenderImage string `json:"render_image"` //渲染结果图
}
type ProductInfo {
ProductId int64 `json:"product_id"` //产品id