|
|
|
@ -391,13 +391,8 @@ class ProductController extends AdminController |
|
|
|
return $form->response()->error('数据不存在'); |
|
|
|
} |
|
|
|
|
|
|
|
$where = [ |
|
|
|
['product_id', '=', $form->getKey()], |
|
|
|
['status', '>', OrderStatus::UNPAID], |
|
|
|
['status', '<', OrderStatus::SUCCESS], |
|
|
|
['status', '<>', OrderStatus::REFUNDED], |
|
|
|
]; |
|
|
|
if (Order::where($where)->exists()) { |
|
|
|
$no_status = [OrderStatus::CANCEL, OrderStatus::REFUNDED, OrderStatus::SUCCESS]; |
|
|
|
if (Order::where('product_id', $form->getKey())->whereNotIn('status', $no_status)->exists()) { |
|
|
|
return $form->response()->error('该产品存在未完成的订单,不允许删除'); |
|
|
|
} |
|
|
|
}); |
|
|
|
|