v1.1
This commit is contained in:
@@ -53,14 +53,14 @@ func (l *GetProductAppByEnLogic) GetProductAppByEn(req *types.GetProductByEnRequ
|
||||
source <- productFeature.FeatureId
|
||||
}
|
||||
}, func(item interface{}, writer mr.Writer[*model.Feature], cancel func(error)) {
|
||||
id := item.(int64)
|
||||
id := item.(string)
|
||||
|
||||
feature, findFeatureErr := l.svcCtx.FeatureModel.FindOne(l.ctx, id)
|
||||
if findFeatureErr != nil {
|
||||
logx.WithContext(l.ctx).Errorf("产品查询, 查找关联feature错误: %d, err:%v", id, findFeatureErr)
|
||||
return
|
||||
}
|
||||
if feature != nil && feature.Id > 0 {
|
||||
if feature != nil && feature.Id != "" {
|
||||
writer.Write(feature)
|
||||
}
|
||||
}, func(pipe <-chan *model.Feature, cancel func(error)) {
|
||||
|
||||
@@ -2,9 +2,10 @@ package product
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
"sort"
|
||||
|
||||
"github.com/Masterminds/squirrel"
|
||||
"github.com/jinzhu/copier"
|
||||
@@ -44,13 +45,13 @@ func (l *GetProductByEnLogic) GetProductByEn(req *types.GetProductByEnRequest) (
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "产品查询, 查找产品关联错误: %v", err)
|
||||
}
|
||||
|
||||
|
||||
// 创建featureId到sort的映射,用于后续排序
|
||||
featureSortMap := make(map[int64]int64)
|
||||
featureSortMap := make(map[string]int64)
|
||||
for _, productFeature := range productFeatureAll {
|
||||
featureSortMap[productFeature.FeatureId] = productFeature.Sort
|
||||
featureSortMap[fmt.Sprintf("%d", productFeature.FeatureId)] = productFeature.Sort
|
||||
}
|
||||
|
||||
|
||||
var product types.Product
|
||||
err = copier.Copy(&product, productModel)
|
||||
if err != nil {
|
||||
@@ -61,14 +62,14 @@ func (l *GetProductByEnLogic) GetProductByEn(req *types.GetProductByEnRequest) (
|
||||
source <- productFeature.FeatureId
|
||||
}
|
||||
}, func(item interface{}, writer mr.Writer[*model.Feature], cancel func(error)) {
|
||||
id := item.(int64)
|
||||
id := item.(string)
|
||||
|
||||
feature, findFeatureErr := l.svcCtx.FeatureModel.FindOne(l.ctx, id)
|
||||
if findFeatureErr != nil {
|
||||
logx.WithContext(l.ctx).Errorf("产品查询, 查找关联feature错误: %d, err:%v", id, findFeatureErr)
|
||||
return
|
||||
}
|
||||
if feature != nil && feature.Id > 0 {
|
||||
if feature != nil && feature.Id != "" {
|
||||
writer.Write(feature)
|
||||
}
|
||||
}, func(pipe <-chan *model.Feature, cancel func(error)) {
|
||||
|
||||
Reference in New Issue
Block a user