feat(产品服务): 重构产品查询逻辑并添加价格字段 #66
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -1791,7 +1791,7 @@ export class ProductService {
|
|||
}
|
||||
|
||||
let product = await this.getProductBySiteSku(siteProduct.sku, site)
|
||||
|
||||
|
||||
return {
|
||||
product,
|
||||
quantity: 1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue