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