feat(产品服务): 重构产品查询逻辑并添加价格字段 #66

Merged
zhuotianyuan merged 3 commits from zksu/API:main into main 2026-01-27 11:19:15 +00:00
2 changed files with 3 additions and 2 deletions
Showing only changes of commit d3d493f858 - Show all commits

View File

@ -735,8 +735,9 @@ export class OrderService {
// 从数据库查询产品,关联查询组件 // 从数据库查询产品,关联查询组件
const productDetail = await this.productService.getComponentDetailFromSiteSku({ sku: orderItem.sku, name: orderItem.name },site); 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 { product, quantity } = productDetail
const componentDetails: { product: Product, quantity: number }[] = product.components?.length > 0 ? await Promise.all(product.components.map(async comp => { const componentDetails: { product: Product, quantity: number }[] = product.components?.length > 0 ? await Promise.all(product.components.map(async comp => {
return { return {
product: await this.productModel.findOne({ product: await this.productModel.findOne({