fix
This commit is contained in:
parent
afc6088f70
commit
91f6970eb0
|
@ -129,11 +129,11 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
|
||||||
return resp.SetStatusAddMessage(basic.CodeServiceErr, "failed to deal with tag data")
|
return resp.SetStatusAddMessage(basic.CodeServiceErr, "failed to deal with tag data")
|
||||||
}
|
}
|
||||||
//组装等级从属关系
|
//组装等级从属关系
|
||||||
rspTagList, mapTagList, TotalCategoryProduct := l.organizationLevelRelation(minLevel, mapTagLevel, productList, mapTagProduct)
|
rspTagList, mapTagRsp, TotalCategoryProduct := l.organizationLevelRelation(minLevel, mapTagLevel, productList, mapTagProduct)
|
||||||
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetTagProductListRsp{
|
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetTagProductListRsp{
|
||||||
TotalCategoryProduct: TotalCategoryProduct,
|
TotalCategoryProduct: TotalCategoryProduct,
|
||||||
TagList: rspTagList,
|
TagList: rspTagList,
|
||||||
TagMap: mapTagList,
|
TagMap: mapTagRsp,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,9 +321,9 @@ func (l *GetTagProductListLogic) dealWithTagMenuData(req dealWithTagMenuDataReq)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组织等级从属关系
|
// 组织等级从属关系
|
||||||
func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagLevel map[string]*types.TagItem, productList []gmodel.FsProduct, mapTagProduct map[int64]types.TagProduct) (rspTagList []types.TagItem, mapTagList map[int64]types.TagItem, productCount int) {
|
func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagLevel map[string]*types.TagItem, productList []gmodel.FsProduct, mapTagProduct map[int64]types.TagProduct) (rspTagList []types.TagItem, mapTagRsp map[int64]types.TagItem, productCount int) {
|
||||||
mapTop := make(map[string]struct{})
|
mapTop := make(map[string]struct{})
|
||||||
mapTagList = make(map[int64]types.TagItem)
|
mapTagRsp = make(map[int64]types.TagItem)
|
||||||
//设置归属关系
|
//设置归属关系
|
||||||
for prefix, tagItem := range mapTagLevel {
|
for prefix, tagItem := range mapTagLevel {
|
||||||
prefixSlice := strings.Split(prefix, "/")
|
prefixSlice := strings.Split(prefix, "/")
|
||||||
|
@ -379,13 +379,13 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL
|
||||||
}
|
}
|
||||||
productCount += len(mapTagLevel[prefix].TagProductList)
|
productCount += len(mapTagLevel[prefix].TagProductList)
|
||||||
rspList = append(rspList, *mapTagLevel[prefix])
|
rspList = append(rspList, *mapTagLevel[prefix])
|
||||||
mapTagList[mapTagLevel[prefix].TypeId] = *mapTagLevel[prefix]
|
mapTagRsp[mapTagLevel[prefix].TypeId] = *mapTagLevel[prefix]
|
||||||
}
|
}
|
||||||
//排序
|
//排序
|
||||||
sort.SliceStable(rspList, func(i, j int) bool {
|
sort.SliceStable(rspList, func(i, j int) bool {
|
||||||
return rspList[i].Sort < rspList[j].Sort
|
return rspList[i].Sort < rspList[j].Sort
|
||||||
})
|
})
|
||||||
return rspList, mapTagList, productCount
|
return rspList, mapTagRsp, productCount
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取某个tag的直属产品
|
// 获取某个tag的直属产品
|
||||||
|
|
Loading…
Reference in New Issue
Block a user