Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into feature/auth
This commit is contained in:
@@ -88,7 +88,7 @@ func (l *GetTemplateByPidLogic) GetTemplateByPid(req *types.GetTemplateByPidReq,
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get template list")
|
||||
}
|
||||
rsp := make(map[string][]interface{})
|
||||
rsp := make(map[string]interface{})
|
||||
for _, templateInfo := range templateList {
|
||||
//没有设置模板据不要
|
||||
if templateInfo.TemplateInfo == nil || *templateInfo.TemplateInfo == "" {
|
||||
@@ -99,7 +99,7 @@ func (l *GetTemplateByPidLogic) GetTemplateByPid(req *types.GetTemplateByPidReq,
|
||||
continue
|
||||
}
|
||||
//基础模板信息
|
||||
var info map[string]map[string]interface{}
|
||||
var info interface{}
|
||||
if err = json.Unmarshal([]byte(*templateInfo.TemplateInfo), &info); err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeJsonErr, fmt.Sprintf("failed to parse json product template info(may be old data):%d", templateInfo.Id))
|
||||
@@ -110,16 +110,12 @@ func (l *GetTemplateByPidLogic) GetTemplateByPid(req *types.GetTemplateByPidReq,
|
||||
_ = json.Unmarshal([]byte(*templateInfo.SwitchInfo), &switchInfo)
|
||||
}
|
||||
modelInfo := modelList[modelIndex]
|
||||
var material interface{}
|
||||
if info["module_data"] != nil && info["module_data"]["material"] != nil {
|
||||
material = info["module_data"]["material"]
|
||||
}
|
||||
mapKey := fmt.Sprintf("_%d", *modelInfo.SizeId)
|
||||
rsp[mapKey] = append(rsp[mapKey], map[string]interface{}{
|
||||
rsp[mapKey] = map[string]interface{}{
|
||||
"id": templateInfo.Id,
|
||||
"material": material,
|
||||
"material": *templateInfo.MaterialImg,
|
||||
"material_data": switchInfo,
|
||||
})
|
||||
}
|
||||
}
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "success", rsp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user