From 51af4de335d47dc3019bb5bddc991871fd13d63b Mon Sep 17 00:00:00 2001 From: liapples Date: Mon, 27 Sep 2021 16:56:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=85=81=E8=AE=B8=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E9=9D=9E=E8=87=AA=E5=B7=B1=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/AdminSupplier/Controllers/ProductController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/AdminSupplier/Controllers/ProductController.php b/app/AdminSupplier/Controllers/ProductController.php index 1777ad5..9aae812 100644 --- a/app/AdminSupplier/Controllers/ProductController.php +++ b/app/AdminSupplier/Controllers/ProductController.php @@ -66,7 +66,12 @@ class ProductController extends AdminController protected function detail($id) { return Show::make($id, new Product(), function (Show $show) { - $show->field('id'); + //不允许查看非自己的数据 + if ($show->model()->supplier_id != Admin::user()->id) { + Admin::exit('数据不存在'); + } + + $show->field('id'); $show->field('supplier_id'); $show->field('category_id'); $show->field('title');