fix
This commit is contained in:
parent
34befce2f3
commit
19958a80de
|
@ -125,16 +125,13 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
|
|||
list := make([]types.GetProductTemplateTagsRsp, 0, len(productTemplateTags))
|
||||
for _, templateInfo := range productTemplateTags {
|
||||
colors := make([]types.ColorsItem, 0, 10)
|
||||
for index, v := range mapTemplateTag[*templateInfo.TemplateTag] {
|
||||
selected := false
|
||||
SelectedIndex := 0
|
||||
for _, colorsSet := range mapTemplateTag[*templateInfo.TemplateTag] {
|
||||
if selectIndex, ok := mapSelectColor[*templateInfo.TemplateTag]; ok {
|
||||
if index == selectIndex {
|
||||
selected = true
|
||||
}
|
||||
SelectedIndex = selectIndex
|
||||
}
|
||||
colors = append(colors, types.ColorsItem{
|
||||
Color: v,
|
||||
Selected: selected,
|
||||
Color: colorsSet,
|
||||
})
|
||||
}
|
||||
list = append(list, types.GetProductTemplateTagsRsp{
|
||||
|
@ -143,6 +140,7 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
|
|||
Cover: *templateInfo.Cover,
|
||||
CoverMetadata: mapResourceMetadata[*templateInfo.Cover],
|
||||
Colors: colors,
|
||||
SelectedIndex: SelectedIndex,
|
||||
})
|
||||
}
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "success", list)
|
||||
|
|
|
@ -15,11 +15,11 @@ type GetProductTemplateTagsRsp struct {
|
|||
Cover string `json:"cover"`
|
||||
CoverMetadata interface{} `json:"cover_metadata"`
|
||||
Colors []ColorsItem `json:"colors"`
|
||||
SelectedIndex int `json:"selected_index"`
|
||||
}
|
||||
|
||||
type ColorsItem struct {
|
||||
Color []string `json:"color"`
|
||||
Selected bool `json:"selected"`
|
||||
Color []string `json:"color"`
|
||||
}
|
||||
|
||||
type Request struct {
|
||||
|
|
|
@ -25,8 +25,8 @@ type GetProductTemplateTagsRsp {
|
|||
Cover string `json:"cover"`
|
||||
CoverMetadata interface{} `json:"cover_metadata"`
|
||||
Colors []ColorsItem `json:"colors"`
|
||||
SelectedIndex int `json:"selected_index"`
|
||||
}
|
||||
type ColorsItem {
|
||||
Color []string `json:"color"`
|
||||
Selected bool `json:"selected"`
|
||||
Color []string `json:"color"`
|
||||
}
|
Loading…
Reference in New Issue
Block a user