feat(OrderLogic, PayNotifyLogic): 修改订单和支付逻辑,增加异常捕获和处理,修复了库存更新错误,并优化了相关代码。
This commit is contained in:
parent
6641010821
commit
c6bcec76fa
@ -446,6 +446,7 @@ class OrderLogic extends BaseLogic
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
d($e);
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
@ -742,6 +742,7 @@ class PayNotifyLogic extends BaseLogic
|
||||
'product_id' => $v['product_id'],
|
||||
]
|
||||
)->withTrashed()->find();
|
||||
if($StoreBranchProduct){
|
||||
$updateData[] = [
|
||||
'id' => $StoreBranchProduct['id'],
|
||||
'stock' => $StoreBranchProduct['stock'] - $v['cart_num'],
|
||||
@ -749,6 +750,8 @@ class PayNotifyLogic extends BaseLogic
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
(new StoreBranchProduct())->saveAll($updateData);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user