This commit is contained in:
2025-12-09 18:55:28 +08:00
parent 8d00d67540
commit c23ab8338b
209 changed files with 5445 additions and 3963 deletions

View File

@@ -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)) {

View File

@@ -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)) {