This commit is contained in:
laodaming 2023-07-11 17:45:34 +08:00
parent 98c5727c7e
commit d2766d5bd3

View File

@ -130,12 +130,14 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, useri
var title types.SizeTitle
if err = json.Unmarshal([]byte(*v.Title), &title); err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to decode size info`s title")
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse size info`s title")
}
var modelInfo map[string]interface{}
if err = json.Unmarshal([]byte(*model3dList[model3dIndex].ModelInfo), &modelInfo); err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse model info")
if model3dList[model3dIndex].ModelInfo != nil && *model3dList[model3dIndex].ModelInfo != "" {
if err = json.Unmarshal([]byte(*model3dList[model3dIndex].ModelInfo), &modelInfo); err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse model info")
}
}
cover := ""
if modelInfo["cover"] != nil && modelInfo["cover"].(string) != "" {
@ -224,9 +226,11 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, useri
model3dInfo := allModel3dList[allModel3dIndex]
//解码template info
var templateInfoRsp map[string]interface{}
if err = json.Unmarshal([]byte(*tmp.TemplateInfo), &templateInfoRsp); err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse template info")
if tmp.TemplateInfo != nil && *tmp.TemplateInfo != "" {
if err = json.Unmarshal([]byte(*tmp.TemplateInfo), &templateInfoRsp); err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse template info")
}
}
if templateInfoRsp["cover"] != nil && templateInfoRsp["cover"].(string) != "" {
cover := templateInfoRsp["cover"].(string)
@ -240,9 +244,11 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, useri
}
//解码模型数据
var modelInfoRsp map[string]interface{}
if err = json.Unmarshal([]byte(*model3dInfo.ModelInfo), &modelInfoRsp); err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse template info")
if model3dInfo.ModelInfo != nil && *model3dInfo.ModelInfo != "" {
if err = json.Unmarshal([]byte(*model3dInfo.ModelInfo), &modelInfoRsp); err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse model info")
}
}
modelInfoRsp["id"] = allModel3dList[allModel3dIndex].Id
//解码灯光数据