fix(admin): 修复预售订单中商品已删除时的异常

- 在查询商品时使用 withTrashed() 方法,以包含软删除的商品
- 避免在商品被删除后创建预售订单时出现错误
This commit is contained in:
mkm 2024-12-18 16:00:45 +08:00
parent c0cdd0974b
commit 9de998ec83

View File

@ -190,9 +190,9 @@ class BeforehandOrderLogic extends BaseLogic
$total_prices = $v['total_price'];
$v['uid'] = $params['user_id'];
$v['store_id'] = $params['store_id'];
$find = StoreBranchProduct::where('store_id', $params['store_id'])->where('product_id', $v['product_id'])->find();
$find = StoreBranchProduct::where('store_id', $params['store_id'])->where('product_id', $v['product_id'])->withTrashed()->find();
if (!$find) {
$product = StoreProduct::where('id', $v['product_id'])->find();
$product = StoreProduct::where('id', $v['product_id'])->withTrashed()->find();
$find = StoreProductLogic::ordinary($product, $params['store_id'], 0, $product);
}