Browse Source

存在未完成的订单,不允许删除

master
李可松 4 years ago
parent
commit
7abdeb54a3
  1. 6
      app/AdminSupplier/Controllers/ProductController.php

6
app/AdminSupplier/Controllers/ProductController.php

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

Loading…
Cancel
Save