This commit is contained in:
laodaming 2023-07-14 14:07:23 +08:00
parent 6d3a3b2dda
commit 56a8b32d90
3 changed files with 12 additions and 7 deletions

View File

@ -184,18 +184,21 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
}
}
//最终值提取最高级别那一层出来
menus := make([]types.TagItem, 0, len(mapTagLevel))
tagListRsp := make([]types.TagItem, 0, len(mapTagLevel))
for _, v := range mapTagLevel {
if v.Level != minLevel {
continue
}
menus = append(menus, *v)
tagListRsp = append(tagListRsp, *v)
}
//排序
sort.Slice(menus, func(i, j int) bool {
return menus[i].Sort < menus[j].Sort
sort.Slice(tagListRsp, func(i, j int) bool {
return tagListRsp[i].Sort < tagListRsp[j].Sort
})
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetTagProductListRsp{
TotalCategory: len(mapTagLevel),
TagList: tagListRsp,
})
return resp.SetStatusWithMessage(basic.CodeOK, "success", menus)
}
// 获取对应tag的产品列表

View File

@ -250,7 +250,8 @@ type GetTagProductListReq struct {
}
type GetTagProductListRsp struct {
TagList []TagItem `json:"tag_list"`
TotalCategory int `json:"totalCategory"`
TagList []TagItem `json:"tag_list"`
}
type TagItem struct {

View File

@ -266,7 +266,8 @@ type GetTagProductListReq {
Size uint32 `form:"size,optional"` //尺寸
}
type GetTagProductListRsp {
TagList []TagItem `json:"tag_list"`
TotalCategory int `json:"totalCategory"`
TagList []TagItem `json:"tag_list"`
}
type TagItem {
TypeName string `json:"type_name"`