diff --git a/app/Admin/Actions/Grid/BatchAuditProduct.php b/app/Admin/Actions/Grid/BatchAuditProduct.php index 57eb93b..3624d84 100644 --- a/app/Admin/Actions/Grid/BatchAuditProduct.php +++ b/app/Admin/Actions/Grid/BatchAuditProduct.php @@ -21,18 +21,15 @@ class BatchAuditProduct extends BatchAction */ protected $action; private ?string $title_text; - private $type = null; /** * BatchAuditProduct constructor. * @param null $title * @param int $action 1:通过;2:拒绝 - * @param int $type 1:普通产品Product;2:行业产品IndustryProduct; */ - public function __construct($title = null, $action = 1, $type = 1) + public function __construct($title = null, $action = 1) { $this->action = $action; - $this->type = $type; $this->title_text = $action == 1 ? '审核通过' : '审核拒绝'; $this->title = ' ' . $this->title_text; @@ -50,12 +47,7 @@ class BatchAuditProduct extends BatchAction public function handle(Request $request) { $status = $request->action == 1 ? ProductStatus::ON_SALE : ProductStatus::REFUSE; - - if ($request->type == 1) { - Product::whereIn('id', $this->getKey())->update(['status' => $status]); - } else { - IndustryProduct::whereIn('id', $this->getKey())->update(['status' => $status]); - } + Product::whereIn('id', $this->getKey())->update(['status' => $status]); return $this->response()->success('操作成功!')->refresh(); } @@ -75,7 +67,6 @@ class BatchAuditProduct extends BatchAction { return [ 'action' => $this->action, - 'type' => $this->type, ]; } } diff --git a/app/Admin/Controllers/ProductController.php b/app/Admin/Controllers/ProductController.php index 40023e7..161043f 100644 --- a/app/Admin/Controllers/ProductController.php +++ b/app/Admin/Controllers/ProductController.php @@ -33,8 +33,8 @@ class ProductController extends AdminController } $grid->batchActions([ - new BatchAuditProduct(null, 1, 1), - new BatchAuditProduct(null, 2, 1), + new BatchAuditProduct(null, 1), + new BatchAuditProduct(null, 2), ]); $grid->column('id')->sortable();