This commit is contained in:
laodaming 2023-07-19 16:19:45 +08:00
parent 12bc736d49
commit 9647fe060a

View File

@ -186,14 +186,7 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
} }
//map tag菜单 //map tag菜单
mapTagLevel := make(map[string]*types.TagItem) mapTagLevel := make(map[string]*types.TagItem)
minLevel := int64(0) //记录最小等级数字
for _, tagInfo := range tagList { for _, tagInfo := range tagList {
if minLevel == 0 && *tagInfo.Level > 0 {
minLevel = *tagInfo.Level
}
if minLevel > *tagInfo.Level {
minLevel = *tagInfo.Level
}
tagTem := types.TagItem{ tagTem := types.TagItem{
TagProductList: nil, TagProductList: nil,
TagRecommendProductList: nil, TagRecommendProductList: nil,
@ -252,11 +245,9 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
//加入分类 //加入分类
mapTagLevel[*tagInfo.LevelPrefix] = &tagTem mapTagLevel[*tagInfo.LevelPrefix] = &tagTem
} }
//组装等级从属关系
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetTagProductListRsp{ return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetTagProductListRsp{
TotalCategory: len(mapTagLevel), TotalCategory: len(mapTagLevel),
TagList: l.organizationLevelRelation(mapTagLevel), TagList: l.organizationLevelRelation(mapTagLevel),//组装等级从属关系
}) })
} }
//排序推荐产品结构体 //排序推荐产品结构体