From 076a7c8dd35bb8f5d1045df169e994e3fba83d43 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Tue, 8 Oct 2024 14:19:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=91=E5=AE=9A=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/LocalStoreLogic.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/api/logic/LocalStoreLogic.php b/app/api/logic/LocalStoreLogic.php index 594729c2..7e674439 100644 --- a/app/api/logic/LocalStoreLogic.php +++ b/app/api/logic/LocalStoreLogic.php @@ -503,6 +503,13 @@ class LocalStoreLogic extends Logic throw new \Exception('请为用户分配权限'); } + $model = new LocalStoreBind(); + + $in = $model->where(['lstore_id' => $post['lstore_id'], 'bind_user_id' => $post['user']['id'], 'is_unbind' => 0])->find(); + if (!empty($in)) { + throw new \Exception('已绑定该用户'); + } + $data = array(); foreach ($post['user']['rule'] as $k => &$v) { $data[$k]['lstore_id'] = $post['lstore_id']; @@ -511,7 +518,6 @@ class LocalStoreLogic extends Logic $data[$k]['bind_time'] = time(); } - $model = new LocalStoreBind(); $result = $model->insertAll($data); if ($result) { return true;