作者 lyh

gx

... ... @@ -149,20 +149,18 @@ class UserLogic extends BaseLogic
{
foreach ($this->param['id'] as $id){
$info = $this->model->read(['id'=>$id],['id','role_id']);
if($info['role_id'] != 0){
$rs = $this->model->del(['id'=>$id]);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
Common::del_user_cache($this->model, $id, 'A');
}else{
if($info['role_id'] == 0) {
//查看当前项目是否有其他的超级管理员
$roleInfo = $this->model->read(['id'=>['!=',$id],'role_id'=>0]);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($roleInfo, true) . PHP_EOL, FILE_APPEND);
if($roleInfo === false){
$roleInfo = $this->model->read(['id' => ['!=', $id], 'role_id' => 0]);
if ($roleInfo === false) {
$this->fail('唯一超级管理员,禁止删除');
}
}
$rs = $this->model->del(['id' => $id]);
if ($rs === false) {
$this->fail('系统错误,请联系管理员');
}
Common::del_user_cache($this->model, $id, 'A');
}
return $this->success();
}
... ...