添加绑定用户功能

This commit is contained in:
wangxiaowei 2024-10-08 14:19:00 +08:00
parent 48e51a87b7
commit 076a7c8dd3

@ -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;