fix
This commit is contained in:
parent
05f61fc8b2
commit
666147cfe6
|
@ -209,9 +209,11 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
|
|||
logx.Error(err)
|
||||
return resp.SetStatusAddMessage(basic.CodeServiceErr, "failed to deal with tag data")
|
||||
}
|
||||
//组装等级从属关系
|
||||
rspTagList, TotalCategoryProduct := l.organizationLevelRelation(minLevel, mapTagLevel)
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetTagProductListRsp{
|
||||
TotalCategoryProduct: len(productList),
|
||||
TagList: l.organizationLevelRelation(minLevel, mapTagLevel), //组装等级从属关系
|
||||
TotalCategoryProduct: TotalCategoryProduct,
|
||||
TagList: rspTagList,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -274,7 +276,7 @@ func (l *GetTagProductListLogic) dealWithTagMenuData(req dealWithTagMenuDataReq)
|
|||
}
|
||||
|
||||
// 组织等级从属关系
|
||||
func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagLevel map[string]*types.TagItem) []types.TagItem {
|
||||
func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagLevel map[string]*types.TagItem) (rspTagList []types.TagItem, productCount int) {
|
||||
mapTop := make(map[string]struct{})
|
||||
//设置归属关系
|
||||
for prefix, tagItem := range mapTagLevel {
|
||||
|
@ -316,13 +318,14 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL
|
|||
if len(mapTagLevel[prefix].TagProductList) == 0 {
|
||||
continue
|
||||
}
|
||||
productCount += len(mapTagLevel[prefix].TagProductList)
|
||||
rspList = append(rspList, *mapTagLevel[prefix])
|
||||
}
|
||||
//排序
|
||||
sort.SliceStable(rspList, func(i, j int) bool {
|
||||
return rspList[i].Sort < rspList[j].Sort
|
||||
})
|
||||
return rspList
|
||||
return rspList, productCount
|
||||
}
|
||||
|
||||
// 获取对应tag的产品列表
|
||||
|
|
Loading…
Reference in New Issue
Block a user