fix
This commit is contained in:
parent
d4c77b2a13
commit
99bd3592af
@ -94,7 +94,7 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
|
||||
if v.RecommendProduct == nil || *v.RecommendProduct == "" {
|
||||
continue
|
||||
}
|
||||
sl, err := format.StrSlicToInt64Slice(strings.Split(*v.RecommendProductSort, ","))
|
||||
sl, err := format.StrSlicToInt64Slice(strings.Split(*v.RecommendProduct, ","))
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("failed to parse recommend product ids,id=%d", v.Id))
|
||||
@ -130,10 +130,7 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
|
||||
}
|
||||
//任意一个不为空
|
||||
if len(productList) != 0 || len(recommendProductList) != 0 {
|
||||
//提取产品ids
|
||||
productIds := make([]int64, 0, len(productList))
|
||||
for k, v := range productList {
|
||||
productIds = append(productIds, v.Id)
|
||||
mapProduct[v.Id] = k
|
||||
}
|
||||
//合并产品列表
|
||||
@ -145,6 +142,10 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
|
||||
productList = append(productList, v)
|
||||
mapProduct[v.Id] = len(productList) - 1
|
||||
}
|
||||
productIds := make([]int64,0,len(productList))
|
||||
for _,product := range productList{
|
||||
productIds = append(productIds,product.Id)
|
||||
}
|
||||
//获取产品价格列表
|
||||
productPriceList, err = l.svcCtx.AllModels.FsProductPrice.GetSimplePriceListByProductIds(l.ctx, productIds)
|
||||
if err != nil {
|
||||
@ -208,11 +209,13 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
|
||||
TagList: l.organizationLevelRelation(mapTagLevel), //组装等级从属关系
|
||||
})
|
||||
}
|
||||
|
||||
// 排序推荐产品结构体
|
||||
type sortRecommendProduct struct {
|
||||
ProductId int64
|
||||
Sort int64
|
||||
}
|
||||
|
||||
// 处理tag菜单数据
|
||||
type dealWithTagMenuDataReq struct {
|
||||
TagList []gmodel.FsTags
|
||||
@ -227,6 +230,7 @@ type dealWithTagMenuDataReq struct {
|
||||
Size uint32
|
||||
user gmodel.FsUser
|
||||
}
|
||||
|
||||
func (l *GetTagProductListLogic) dealWithTagMenuData(req dealWithTagMenuDataReq) error {
|
||||
for _, tagInfo := range req.TagList {
|
||||
tagTem := types.TagItem{
|
||||
@ -289,6 +293,7 @@ func (l *GetTagProductListLogic)dealWithTagMenuData(req dealWithTagMenuDataReq)e
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 组织等级从属关系
|
||||
func (l *GetTagProductListLogic) organizationLevelRelation(mapTagLevel map[string]*types.TagItem) []types.TagItem {
|
||||
mapTop := make(map[string]struct{})
|
||||
@ -323,6 +328,7 @@ func (l *GetTagProductListLogic)organizationLevelRelation(mapTagLevel map[string
|
||||
})
|
||||
return rspList
|
||||
}
|
||||
|
||||
// 获取tag推荐产品列表
|
||||
type getTagRecommendProductsReq struct {
|
||||
TagInfo gmodel.FsTags
|
||||
@ -398,6 +404,7 @@ func (l *GetTagProductListLogic)getTagRecommendProducts(req getTagRecommendProdu
|
||||
}
|
||||
return productListRsp
|
||||
}
|
||||
|
||||
// 获取对应tag的产品列表
|
||||
type getTagProductsReq struct {
|
||||
TagId int64
|
||||
|
Loading…
x
Reference in New Issue
Block a user