Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
c2f61fc61a
|
@ -94,6 +94,7 @@ func (l *AddToCartLogic) AddToCart(req *types.AddToCartReq, userinfo *auth.UserI
|
||||||
fittingName string //配件名
|
fittingName string //配件名
|
||||||
lightJson interface{} //灯光设计数据
|
lightJson interface{} //灯光设计数据
|
||||||
lightName string //灯光名字
|
lightName string //灯光名字
|
||||||
|
modelJson interface{} //模型json
|
||||||
)
|
)
|
||||||
//有模板
|
//有模板
|
||||||
if req.TemplateId > 0 {
|
if req.TemplateId > 0 {
|
||||||
|
@ -174,6 +175,10 @@ func (l *AddToCartLogic) AddToCart(req *types.AddToCartReq, userinfo *auth.UserI
|
||||||
if modelInfo.ModelInfo == nil || *modelInfo.ModelInfo == "" {
|
if modelInfo.ModelInfo == nil || *modelInfo.ModelInfo == "" {
|
||||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "the model`s design info is empty")
|
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 {
|
if *modelInfo.Light > 0 {
|
||||||
lightInfo, err := l.svcCtx.AllModels.FsProductModel3dLight.FindOne(l.ctx, *modelInfo.Light)
|
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,
|
TemplateTag: templateTag,
|
||||||
},
|
},
|
||||||
ModelInfo: gmodel.ModelInfo{
|
ModelInfo: gmodel.ModelInfo{
|
||||||
ModelJson: *modelInfo.ModelInfo,
|
ModelJson: modelJson,
|
||||||
},
|
},
|
||||||
FittingInfo: gmodel.FittingInfo{
|
FittingInfo: gmodel.FittingInfo{
|
||||||
FittingJson: fittingJson,
|
FittingJson: fittingJson,
|
||||||
|
|
|
@ -146,6 +146,7 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo
|
||||||
productSn := snapShot.ProductInfo.ProductSn
|
productSn := snapShot.ProductInfo.ProductSn
|
||||||
//产品封面图资源元数据
|
//产品封面图资源元数据
|
||||||
var productCoverMetadata interface{}
|
var productCoverMetadata interface{}
|
||||||
|
cartIsSelected := *cart.IsSelected > 0
|
||||||
//产品信息
|
//产品信息
|
||||||
if productInfo, ok := mapProduct[*cart.ProductId]; ok {
|
if productInfo, ok := mapProduct[*cart.ProductId]; ok {
|
||||||
productCover = *productInfo.Cover
|
productCover = *productInfo.Cover
|
||||||
|
@ -154,6 +155,10 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo
|
||||||
if metadata, ok := mapResourceMetadata[*productInfo.Cover]; ok {
|
if metadata, ok := mapResourceMetadata[*productInfo.Cover]; ok {
|
||||||
productCoverMetadata = metadata
|
productCoverMetadata = metadata
|
||||||
}
|
}
|
||||||
|
//产品下架了
|
||||||
|
if *productInfo.IsShelf == 0 {
|
||||||
|
cartIsSelected = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
templateTag := ""
|
templateTag := ""
|
||||||
if templateInfo, ok := mapTemplate[*cart.TemplateId]; ok {
|
if templateInfo, ok := mapTemplate[*cart.TemplateId]; ok {
|
||||||
|
@ -193,9 +198,10 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo
|
||||||
MinPurchaseQuantity: stepPrice.MinBuyUnitsNum,
|
MinPurchaseQuantity: stepPrice.MinBuyUnitsNum,
|
||||||
StepPurchaseQuantity: stepPurchaseQuantity,
|
StepPurchaseQuantity: stepPurchaseQuantity,
|
||||||
IsHighlyCustomized: *cart.IsHighlyCustomized > 0,
|
IsHighlyCustomized: *cart.IsHighlyCustomized > 0,
|
||||||
IsSelected: *cart.IsSelected > 0,
|
IsSelected: cartIsSelected,
|
||||||
TemplateTag: templateTag,
|
TemplateTag: templateTag,
|
||||||
Logo: snapShot.Logo,
|
Logo: snapShot.Logo,
|
||||||
|
RenderImage: snapShot.RenderImage,
|
||||||
}
|
}
|
||||||
//是否有失效的
|
//是否有失效的
|
||||||
if description, ok := mapCartChange[cart.Id]; ok {
|
if description, ok := mapCartChange[cart.Id]; ok {
|
||||||
|
|
|
@ -55,6 +55,7 @@ type CartItem struct {
|
||||||
IsSelected bool `json:"is_selected"` //是否选中
|
IsSelected bool `json:"is_selected"` //是否选中
|
||||||
TemplateTag string `json:"template_tag"` //模板标签
|
TemplateTag string `json:"template_tag"` //模板标签
|
||||||
Logo string `json:"logo"`
|
Logo string `json:"logo"`
|
||||||
|
RenderImage string `json:"render_image"` //渲染结果图
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProductInfo struct {
|
type ProductInfo struct {
|
||||||
|
|
|
@ -72,6 +72,7 @@ type CartItem {
|
||||||
IsSelected bool `json:"is_selected"` //是否选中
|
IsSelected bool `json:"is_selected"` //是否选中
|
||||||
TemplateTag string `json:"template_tag"` //模板标签
|
TemplateTag string `json:"template_tag"` //模板标签
|
||||||
Logo string `json:"logo"`
|
Logo string `json:"logo"`
|
||||||
|
RenderImage string `json:"render_image"` //渲染结果图
|
||||||
}
|
}
|
||||||
type ProductInfo {
|
type ProductInfo {
|
||||||
ProductId int64 `json:"product_id"` //产品id
|
ProductId int64 `json:"product_id"` //产品id
|
||||||
|
|
Loading…
Reference in New Issue
Block a user