Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into feature/auth
This commit is contained in:
@@ -109,8 +109,8 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, useri
|
||||
tagIds := make([]int64, 0, len(productTemplateList))
|
||||
for _, v := range productTemplateList {
|
||||
mapTemplateModelId[*v.ModelId] = struct{}{}
|
||||
if v.Tag != nil && *v.Tag != "" {
|
||||
tagId, err := strconv.ParseInt(*v.Tag, 10, 64)
|
||||
if v.TemplateTag != nil && *v.TemplateTag != "" {
|
||||
tagId, err := strconv.ParseInt(*v.TemplateTag, 10, 64)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "tag is not a number")
|
||||
@@ -296,7 +296,7 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, useri
|
||||
partListRsp = append(partListRsp, thisInfo)
|
||||
}
|
||||
tagName := ""
|
||||
if tagData, ok := mapTag[*tmp.Tag]; ok {
|
||||
if tagData, ok := mapTag[*tmp.TemplateTag]; ok {
|
||||
tagName = *tagData.Title
|
||||
}
|
||||
//按照材质和尺寸来存放模板信息
|
||||
|
||||
@@ -127,7 +127,7 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
|
||||
mapTagProp := make(map[int64][]types.CoverDefaultItem)
|
||||
for _, v := range productTagPropList {
|
||||
mapTagProp[*v.ProductId] = append(mapTagProp[*v.ProductId], types.CoverDefaultItem{
|
||||
Tag: v.Title,
|
||||
Tag: v.TemplateTag,
|
||||
Cover: *v.Cover,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
|
||||
}
|
||||
for _, v := range productTagPropList {
|
||||
mapTagProp[*v.ProductId] = append(mapTagProp[*v.ProductId], types.CoverDefaultItem{
|
||||
Tag: v.Title,
|
||||
Tag: v.TemplateTag,
|
||||
Cover: *v.Cover,
|
||||
})
|
||||
}
|
||||
@@ -312,6 +312,10 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL
|
||||
//最终值提取最高级别那一层出来
|
||||
rspList := make([]types.TagItem, 0, len(mapTagLevel))
|
||||
for prefix, _ := range mapTop {
|
||||
//大类下没有任何产品则不显示
|
||||
if len(mapTagLevel[prefix].TagProductList) == 0 {
|
||||
continue
|
||||
}
|
||||
rspList = append(rspList, *mapTagLevel[prefix])
|
||||
}
|
||||
//排序
|
||||
|
||||
@@ -67,6 +67,15 @@ func (l *GetTemplateByPidLogic) GetTemplateByPid(req *types.GetTemplateByPidReq,
|
||||
} else { //指定物料
|
||||
sizeIds = append(sizeIds, req.ProductSizeId)
|
||||
}
|
||||
//获取templatetag信息
|
||||
templateTagInfo, err := l.svcCtx.AllModels.FsProductTemplateTags.FindOne(l.ctx, req.ProductTemplateTagId)
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "template tag is not exists")
|
||||
}
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "failed to get template tag")
|
||||
}
|
||||
//根据尺寸id获取模型
|
||||
modelList, err := l.svcCtx.AllModels.FsProductModel3d.GetAllBySizeIdsTag(l.ctx, sizeIds, constants.TAG_MODEL)
|
||||
if err != nil {
|
||||
@@ -83,7 +92,7 @@ func (l *GetTemplateByPidLogic) GetTemplateByPid(req *types.GetTemplateByPidReq,
|
||||
mapModel[v.Id] = k
|
||||
}
|
||||
//查询模型ids下对应tag标签的模板
|
||||
templateList, err := l.svcCtx.AllModels.FsProductTemplateV2.FindAllByModelIdsTemplateTag(l.ctx, modelIds, fmt.Sprintf("%d", req.ProductTemplateTagId), "")
|
||||
templateList, err := l.svcCtx.AllModels.FsProductTemplateV2.FindAllByModelIdsTemplateTag(l.ctx, modelIds, *templateTagInfo.TemplateTag, "")
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get template list")
|
||||
|
||||
@@ -156,7 +156,7 @@ func (l *HomePageRecommendProductListLogic) HomePageRecommendProductList(req *ty
|
||||
mapTagProp := make(map[int64][]types.CoverDefaultItem)
|
||||
for _, v := range productTagPropList {
|
||||
mapTagProp[*v.ProductId] = append(mapTagProp[*v.ProductId], types.CoverDefaultItem{
|
||||
Tag: v.Title,
|
||||
Tag: v.TemplateTag,
|
||||
Cover: *v.Cover,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user