diff --git a/src/service/order.service.ts b/src/service/order.service.ts index c764bb4..7553dfc 100644 --- a/src/service/order.service.ts +++ b/src/service/order.service.ts @@ -735,8 +735,9 @@ export class OrderService { // 从数据库查询产品,关联查询组件 const productDetail = await this.productService.getComponentDetailFromSiteSku({ sku: orderItem.sku, name: orderItem.name },site); - if (!productDetail || !productDetail.quantity) return; + if (!productDetail || !productDetail.product || !productDetail.quantity) return; const { product, quantity } = productDetail + const componentDetails: { product: Product, quantity: number }[] = product.components?.length > 0 ? await Promise.all(product.components.map(async comp => { return { product: await this.productModel.findOne({ diff --git a/src/service/product.service.ts b/src/service/product.service.ts index cea866c..fef1c8f 100644 --- a/src/service/product.service.ts +++ b/src/service/product.service.ts @@ -1791,7 +1791,7 @@ export class ProductService { } let product = await this.getProductBySiteSku(siteProduct.sku, site) - + return { product, quantity: 1,