合并develop

This commit is contained in:
laodaming 2023-09-19 14:06:54 +08:00
parent 7fd65d9ac7
commit b19a16e5a0
3 changed files with 25 additions and 20 deletions

View File

@ -125,10 +125,12 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
list := make([]types.GetProductTemplateTagsRsp, 0, len(productTemplateTags))
for _, templateInfo := range productTemplateTags {
colors := make([]types.ColorsItem, 0, 10)
SelectedIndex := 0
SelectedColorIndex := 0
isDefaultTemplateTag := false
for _, colorsSet := range mapTemplateTag[*templateInfo.TemplateTag] {
if selectIndex, ok := mapSelectColor[*templateInfo.TemplateTag]; ok {
SelectedIndex = selectIndex
isDefaultTemplateTag = true
SelectedColorIndex = selectIndex
}
colors = append(colors, types.ColorsItem{
Color: colorsSet,
@ -137,10 +139,11 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
list = append(list, types.GetProductTemplateTagsRsp{
Id: templateInfo.Id,
TemplateTag: *templateInfo.TemplateTag,
IsDefaultTemplateTag: isDefaultTemplateTag,
Cover: *templateInfo.Cover,
CoverMetadata: mapResourceMetadata[*templateInfo.Cover],
Colors: colors,
SelectedIndex: SelectedIndex,
SelectedColorIndex: SelectedColorIndex,
})
}
return resp.SetStatusWithMessage(basic.CodeOK, "success", list)

View File

@ -12,10 +12,11 @@ type GetProductTemplateTagsReq struct {
type GetProductTemplateTagsRsp struct {
Id int64 `json:"id"`
TemplateTag string `json:"template_tag"`
IsDefaultTemplateTag bool `json:"is_default_template_tag"`
Cover string `json:"cover"`
CoverMetadata interface{} `json:"cover_metadata"`
Colors []ColorsItem `json:"colors"`
SelectedIndex int `json:"selected_index"`
SelectedColorIndex int `json:"selected_color_index"`
}
type ColorsItem struct {

View File

@ -22,10 +22,11 @@ type GetProductTemplateTagsReq {
type GetProductTemplateTagsRsp {
Id int64 `json:"id"`
TemplateTag string `json:"template_tag"`
IsDefaultTemplateTag bool `json:"is_default_template_tag"`
Cover string `json:"cover"`
CoverMetadata interface{} `json:"cover_metadata"`
Colors []ColorsItem `json:"colors"`
SelectedIndex int `json:"selected_index"`
SelectedColorIndex int `json:"selected_color_index"`
}
type ColorsItem {
Color []string `json:"color"`