v1.1
This commit is contained in:
@@ -2,12 +2,12 @@ package admin_query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/globalkey"
|
||||
"ycc-server/common/xerr"
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
@@ -66,23 +66,23 @@ func (l *AdminGetQueryCleanupDetailListLogic) AdminGetQueryCleanupDetailList(req
|
||||
}
|
||||
|
||||
// 4. 获取所有产品ID
|
||||
productIds := make([]int64, 0, len(details))
|
||||
productIds := make([]string, 0, len(details))
|
||||
for _, detail := range details {
|
||||
productIds = append(productIds, detail.ProductId)
|
||||
}
|
||||
|
||||
// 5. 并发获取产品信息
|
||||
productMap := make(map[int64]string)
|
||||
productMap := make(map[string]string)
|
||||
var mu sync.Mutex
|
||||
err = mr.MapReduceVoid(func(source chan<- interface{}) {
|
||||
for _, productId := range productIds {
|
||||
source <- productId
|
||||
}
|
||||
}, func(item interface{}, writer mr.Writer[struct{}], cancel func(error)) {
|
||||
productId := item.(int64)
|
||||
productId := item.(string)
|
||||
product, err := l.svcCtx.ProductModel.FindOne(l.ctx, productId)
|
||||
if err != nil && !errors.Is(err, model.ErrNotFound) {
|
||||
cancel(errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查询产品信息失败, product_id: %d, err: %v", productId, err))
|
||||
cancel(errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查询产品信息失败, product_id: %s, err: %v", productId, err))
|
||||
return
|
||||
}
|
||||
mu.Lock()
|
||||
|
||||
@@ -135,7 +135,7 @@ func ProcessQueryParams(QueryParams string, target *map[string]interface{}, key
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *AdminGetQueryDetailByOrderIdLogic) UpdateFeatureAndProductFeature(productID int64, target *[]types.AdminQueryItem) error {
|
||||
func (l *AdminGetQueryDetailByOrderIdLogic) UpdateFeatureAndProductFeature(productID string, target *[]types.AdminQueryItem) error {
|
||||
// 遍历 target 数组,使用倒序遍历,以便删除元素时不影响索引
|
||||
for i := len(*target) - 1; i >= 0; i-- {
|
||||
queryItem := &(*target)[i]
|
||||
|
||||
Reference in New Issue
Block a user