fix
This commit is contained in:
parent
7c0b1107f8
commit
cc6da9a648
@ -52,16 +52,16 @@ type ProductInfo struct {
|
|||||||
ProductSn string `json:"product_sn"`
|
ProductSn string `json:"product_sn"`
|
||||||
}
|
}
|
||||||
type ModelInfo struct {
|
type ModelInfo struct {
|
||||||
ModelJson string `json:"model_json"` //模型设计json数据
|
ModelJson interface{} `json:"model_json"` //模型设计json数据
|
||||||
}
|
}
|
||||||
type FittingInfo struct {
|
type FittingInfo struct {
|
||||||
FittingJson string `json:"fitting_json"` //配件设计json数据
|
FittingJson interface{} `json:"fitting_json"` //配件设计json数据
|
||||||
FittingName string `json:"fitting_name"` //配件名称
|
FittingName string `json:"fitting_name"` //配件名称
|
||||||
|
|
||||||
}
|
}
|
||||||
type TemplateInfo struct {
|
type TemplateInfo struct {
|
||||||
TemplateJson string `json:"template_json"` //模板设计json数据
|
TemplateJson interface{} `json:"template_json"` //模板设计json数据
|
||||||
TemplateTag string `json:"template_tag"` //模板标签
|
TemplateTag string `json:"template_tag"` //模板标签
|
||||||
}
|
}
|
||||||
type SizeInfo struct {
|
type SizeInfo struct {
|
||||||
Inch string `json:"inch"`
|
Inch string `json:"inch"`
|
||||||
@ -76,8 +76,8 @@ type UserDiyInformation struct {
|
|||||||
Slogan string `json:"slogan"` //slogan
|
Slogan string `json:"slogan"` //slogan
|
||||||
}
|
}
|
||||||
type LightInfo struct {
|
type LightInfo struct {
|
||||||
LightJson string `json:"light_json"` //灯光设计json数据
|
LightJson interface{} `json:"light_json"` //灯光设计json数据
|
||||||
LightName string `json:"light_name"` //名称
|
LightName string `json:"light_name"` //名称
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取单个
|
// 获取单个
|
||||||
|
@ -88,12 +88,12 @@ func (l *AddToCartLogic) AddToCart(req *types.AddToCartReq, userinfo *auth.UserI
|
|||||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product info")
|
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product info")
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
templateJson string //模板表的记录中的json设计信息
|
templateJson interface{} //模板表的记录中的json设计信息
|
||||||
templateTag string //模板表的模板标签
|
templateTag string //模板表的模板标签
|
||||||
fittingJson string //配件的json设计信息
|
fittingJson interface{} //配件的json设计信息
|
||||||
fittingName string //配件名
|
fittingName string //配件名
|
||||||
lightJson string //灯光设计数据
|
lightJson interface{} //灯光设计数据
|
||||||
lightName string //灯光名字
|
lightName string //灯光名字
|
||||||
)
|
)
|
||||||
//有模板
|
//有模板
|
||||||
if req.TemplateId > 0 {
|
if req.TemplateId > 0 {
|
||||||
@ -114,7 +114,10 @@ func (l *AddToCartLogic) AddToCart(req *types.AddToCartReq, userinfo *auth.UserI
|
|||||||
if templateInfo.TemplateInfo == nil || *templateInfo.TemplateInfo == "" {
|
if templateInfo.TemplateInfo == nil || *templateInfo.TemplateInfo == "" {
|
||||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "the template`s design info is empty")
|
return resp.SetStatusWithMessage(basic.CodeServiceErr, "the template`s design info is empty")
|
||||||
}
|
}
|
||||||
templateJson = *templateInfo.TemplateInfo
|
if err = json.Unmarshal([]byte(*templateInfo.TemplateInfo), &templateJson); err != nil {
|
||||||
|
logx.Error(err)
|
||||||
|
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse template design info")
|
||||||
|
}
|
||||||
templateTag = *templateInfo.TemplateTag
|
templateTag = *templateInfo.TemplateTag
|
||||||
}
|
}
|
||||||
//有配件
|
//有配件
|
||||||
@ -133,7 +136,10 @@ func (l *AddToCartLogic) AddToCart(req *types.AddToCartReq, userinfo *auth.UserI
|
|||||||
if fittingInfo.ModelInfo == nil || *fittingInfo.ModelInfo == "" {
|
if fittingInfo.ModelInfo == nil || *fittingInfo.ModelInfo == "" {
|
||||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "the fitting`s design info is empty")
|
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "the fitting`s design info is empty")
|
||||||
}
|
}
|
||||||
fittingJson = *fittingInfo.ModelInfo
|
if err = json.Unmarshal([]byte(*fittingInfo.ModelInfo), &fittingJson); err != nil {
|
||||||
|
logx.Error(err)
|
||||||
|
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse fitting design info")
|
||||||
|
}
|
||||||
fittingName = *fittingInfo.Title
|
fittingName = *fittingInfo.Title
|
||||||
}
|
}
|
||||||
//获取尺寸信息
|
//获取尺寸信息
|
||||||
@ -180,7 +186,10 @@ func (l *AddToCartLogic) AddToCart(req *types.AddToCartReq, userinfo *auth.UserI
|
|||||||
}
|
}
|
||||||
lightName = *lightInfo.Name
|
lightName = *lightInfo.Name
|
||||||
if lightInfo.Info != nil && *lightInfo.Info != "" {
|
if lightInfo.Info != nil && *lightInfo.Info != "" {
|
||||||
lightJson = *lightInfo.Info
|
if err = json.Unmarshal([]byte(*lightInfo.Info), &lightJson); err != nil {
|
||||||
|
logx.Error(err)
|
||||||
|
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse light design info")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var sizeKeyInfo gmodel.SizeInfo
|
var sizeKeyInfo gmodel.SizeInfo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user