新增原价以及佣金
This commit is contained in:
@@ -887,12 +887,12 @@ router.put('/:id/status', async (req, res) => {
|
||||
);
|
||||
}
|
||||
|
||||
// 分佣金额分配
|
||||
if (status === 'completed') {
|
||||
const [products] = await getDB().execute(
|
||||
'SELECT * FROM order_items WHERE order_id = ?',
|
||||
[orderId]
|
||||
);
|
||||
let producers = []
|
||||
for (const product of products) {
|
||||
const [producersResult] = await db.execute(
|
||||
'SELECT * FROM products WHERE id = ?',
|
||||
@@ -901,7 +901,7 @@ router.put('/:id/status', async (req, res) => {
|
||||
if (producersResult[0].shop_name) {
|
||||
await db.execute(
|
||||
'UPDATE users SET income = income + ? WHERE id = ?',
|
||||
[1, parseInt(producersResult[0].shop_name)]
|
||||
[producersResult[0].price * product.quantity, parseInt(producersResult[0].shop_name)]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user