diff --git a/server/product/internal/logic/gettemplatebypidlogic.go b/server/product/internal/logic/gettemplatebypidlogic.go index e036fa15..d13dbd0a 100644 --- a/server/product/internal/logic/gettemplatebypidlogic.go +++ b/server/product/internal/logic/gettemplatebypidlogic.go @@ -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 == "" { @@ -115,11 +115,11 @@ func (l *GetTemplateByPidLogic) GetTemplateByPid(req *types.GetTemplateByPidReq, 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_data": switchInfo, - }) + } } return resp.SetStatusWithMessage(basic.CodeOK, "success", rsp) }