fix:订单模块

This commit is contained in:
momo 2023-10-07 10:40:44 +08:00
parent cc6da9a648
commit cf83bd068b

View File

@ -1205,79 +1205,79 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe
func (d *defaultOrder) OrderShoppingCartSnapshotHandler(ctx context.Context, req *string) (res map[string]interface{}, err error) {
var snapshot map[string]interface{}
json.Unmarshal([]byte(*req), &snapshot)
snapshotFittingInfoData, snapshotFittingInfoEx := snapshot["fitting_info"]
var fittingInfoMap map[string]interface{}
if snapshotFittingInfoEx {
var snapshotFittingInfoJson map[string]interface{}
var fittingName string
snapshotFittingInfo := snapshotFittingInfoData.(map[string]interface{})
snapshotFittingInfoJsonData, snapshotFittingInfoJsonEx := snapshotFittingInfo["fitting_json"]
if snapshotFittingInfoJsonEx {
json.Unmarshal([]byte(snapshotFittingInfoJsonData.(string)), &snapshotFittingInfoJson)
}
fittingNameData, fittingNameEx := snapshotFittingInfo["fitting_name"]
if fittingNameEx {
fittingName = fittingNameData.(string)
}
fittingInfoMap = make(map[string]interface{}, 2)
fittingInfoMap["fitting_json"] = snapshotFittingInfoJson
fittingInfoMap["fitting_name"] = fittingName
}
snapshot["fitting_info"] = fittingInfoMap
// snapshotFittingInfoData, snapshotFittingInfoEx := snapshot["fitting_info"]
// var fittingInfoMap map[string]interface{}
// if snapshotFittingInfoEx {
// var snapshotFittingInfoJson map[string]interface{}
// var fittingName string
// snapshotFittingInfo := snapshotFittingInfoData.(map[string]interface{})
// snapshotFittingInfoJsonData, snapshotFittingInfoJsonEx := snapshotFittingInfo["fitting_json"]
// if snapshotFittingInfoJsonEx {
// json.Unmarshal([]byte(snapshotFittingInfoJsonData.(string)), &snapshotFittingInfoJson)
// }
// fittingNameData, fittingNameEx := snapshotFittingInfo["fitting_name"]
// if fittingNameEx {
// fittingName = fittingNameData.(string)
// }
// fittingInfoMap = make(map[string]interface{}, 2)
// fittingInfoMap["fitting_json"] = snapshotFittingInfoJson
// fittingInfoMap["fitting_name"] = fittingName
// }
// snapshot["fitting_info"] = fittingInfoMap
snapshotModelInfoData, snapshotModelInfoEx := snapshot["model_info"]
var modelInfoMap map[string]interface{}
if snapshotModelInfoEx {
var snapshotModelInfoJson map[string]interface{}
snapshotModelInfo := snapshotModelInfoData.(map[string]interface{})
snapshotModelInfoJsonData, snapshotModelInfoJsonEx := snapshotModelInfo["model_json"]
if snapshotModelInfoJsonEx {
json.Unmarshal([]byte(snapshotModelInfoJsonData.(string)), &snapshotModelInfoJson)
}
modelInfoMap = make(map[string]interface{}, 1)
modelInfoMap["model_json"] = snapshotModelInfoJson
}
snapshot["model_info"] = modelInfoMap
// snapshotModelInfoData, snapshotModelInfoEx := snapshot["model_info"]
// var modelInfoMap map[string]interface{}
// if snapshotModelInfoEx {
// var snapshotModelInfoJson map[string]interface{}
// snapshotModelInfo := snapshotModelInfoData.(map[string]interface{})
// snapshotModelInfoJsonData, snapshotModelInfoJsonEx := snapshotModelInfo["model_json"]
// if snapshotModelInfoJsonEx {
// json.Unmarshal([]byte(snapshotModelInfoJsonData.(string)), &snapshotModelInfoJson)
// }
// modelInfoMap = make(map[string]interface{}, 1)
// modelInfoMap["model_json"] = snapshotModelInfoJson
// }
// snapshot["model_info"] = modelInfoMap
snapshotTemplateInfoData, snapshotTemplateInfoEx := snapshot["template_info"]
var templateInfoMap map[string]interface{}
if snapshotTemplateInfoEx {
var snapshotTemplateInfoJson map[string]interface{}
var templateTag string
snapshotTemplateInfo := snapshotTemplateInfoData.(map[string]interface{})
snapshotTemplateInfoJsonData, snapshotTemplateInfoJsonEx := snapshotTemplateInfo["template_json"]
if snapshotTemplateInfoJsonEx {
json.Unmarshal([]byte(snapshotTemplateInfoJsonData.(string)), &snapshotTemplateInfoJson)
}
templateTagData, templateTagEx := snapshotTemplateInfo["template_tag"]
if templateTagEx {
templateTag = templateTagData.(string)
}
templateInfoMap = make(map[string]interface{}, 2)
templateInfoMap["template_json"] = snapshotTemplateInfoJson
templateInfoMap["template_tag"] = templateTag
}
snapshot["template_info"] = templateInfoMap
// snapshotTemplateInfoData, snapshotTemplateInfoEx := snapshot["template_info"]
// var templateInfoMap map[string]interface{}
// if snapshotTemplateInfoEx {
// var snapshotTemplateInfoJson map[string]interface{}
// var templateTag string
// snapshotTemplateInfo := snapshotTemplateInfoData.(map[string]interface{})
// snapshotTemplateInfoJsonData, snapshotTemplateInfoJsonEx := snapshotTemplateInfo["template_json"]
// if snapshotTemplateInfoJsonEx {
// json.Unmarshal([]byte(snapshotTemplateInfoJsonData.(string)), &snapshotTemplateInfoJson)
// }
// templateTagData, templateTagEx := snapshotTemplateInfo["template_tag"]
// if templateTagEx {
// templateTag = templateTagData.(string)
// }
// templateInfoMap = make(map[string]interface{}, 2)
// templateInfoMap["template_json"] = snapshotTemplateInfoJson
// templateInfoMap["template_tag"] = templateTag
// }
// snapshot["template_info"] = templateInfoMap
snapshotLightInfoData, snapshotLightInfoEx := snapshot["light_info"]
var lightInfoMap map[string]interface{}
if snapshotLightInfoEx {
var snapshotLightInfoJson map[string]interface{}
var lightTag string
snapshotLightInfo := snapshotLightInfoData.(map[string]interface{})
snapshotLightInfoJsonData, snapshotLightInfoJsonEx := snapshotLightInfo["light_json"]
if snapshotLightInfoJsonEx {
json.Unmarshal([]byte(snapshotLightInfoJsonData.(string)), &snapshotLightInfoJson)
}
lightTagData, lightTagEx := snapshotLightInfo["light_tag"]
if lightTagEx {
lightTag = lightTagData.(string)
}
lightInfoMap = make(map[string]interface{}, 2)
lightInfoMap["light_json"] = snapshotLightInfoJson
lightInfoMap["light_tag"] = lightTag
}
snapshot["light_info"] = lightInfoMap
// snapshotLightInfoData, snapshotLightInfoEx := snapshot["light_info"]
// var lightInfoMap map[string]interface{}
// if snapshotLightInfoEx {
// var snapshotLightInfoJson map[string]interface{}
// var lightTag string
// snapshotLightInfo := snapshotLightInfoData.(map[string]interface{})
// snapshotLightInfoJsonData, snapshotLightInfoJsonEx := snapshotLightInfo["light_json"]
// if snapshotLightInfoJsonEx {
// json.Unmarshal([]byte(snapshotLightInfoJsonData.(string)), &snapshotLightInfoJson)
// }
// lightTagData, lightTagEx := snapshotLightInfo["light_tag"]
// if lightTagEx {
// lightTag = lightTagData.(string)
// }
// lightInfoMap = make(map[string]interface{}, 2)
// lightInfoMap["light_json"] = snapshotLightInfoJson
// lightInfoMap["light_tag"] = lightTag
// }
// snapshot["light_info"] = lightInfoMap
return snapshot, nil
}