作者 lyh

gx

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