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;