fix: 产品相关问题 #71

Merged
zksu merged 4 commits from zksu/API:main into main 2026-01-29 01:22:42 +00:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 534cc3f2c7 - Show all commits

View File

@ -733,7 +733,7 @@ export class OrderService {
if (!orderItem.sku) return;
// 从数据库查询产品,关联查询组件
const componentDetails = await this.productService.getComponentDetailFromSiteSku({ sku: orderItem.sku, name: orderItem.name },orderItem.quantity,site);
const componentDetails = await this.productService.getComponentDetailFromSiteSku({ sku: orderItem.sku, name: orderItem.name }, site);
if(!componentDetails?.length){
return
}

View File

@ -1786,7 +1786,7 @@ export class ProductService {
}
}
// 获取库存单品列表
async getComponentDetailFromSiteSku(siteProduct: { sku: string, name: string }, quantity: number = 1, site: Site): Promise<{ product: Product,parentProduct?: Product, quantity: number }[]> {
async getComponentDetailFromSiteSku(siteProduct: { sku: string, name: string }, site: Site): Promise<{ product: Product,parentProduct?: Product, quantity: number }[]> {
if (!siteProduct.sku) {
throw new Error('siteSku 不能为空')
}
@ -1798,7 +1798,7 @@ export class ProductService {
if(!product?.components?.length){
return [{
product,
quantity
quantity:1
}]
}
@ -1808,7 +1808,7 @@ export class ProductService {
where: { id: comp.productId },
}),
parentProduct: product, // 这里得记录一下他的爸爸用来记录
quantity: comp.quantity * quantity,
quantity: comp.quantity,
}
}))
}