作者 何书鹏
1 个管道 的构建 通过 耗费 1 秒

bug修改

@@ -196,6 +196,10 @@ class HouseAdmin extends Api @@ -196,6 +196,10 @@ class HouseAdmin extends Api
196 196
197 empty($house_id) && $this->error('缺少必要参数'); 197 empty($house_id) && $this->error('缺少必要参数');
198 $admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]); 198 $admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]);
  199 + if(!$admin){
  200 + $house = House::get($house_id);
  201 + $admin = HouseAdminModel::get(['id'=>$house['admin_user_id'],'user_id'=>$this->auth->id]);
  202 + }
199 empty($admin) && $this->error('您不是该小区的管理员'); 203 empty($admin) && $this->error('您不是该小区的管理员');
200 204
201 $admin->nickname = $nickname; 205 $admin->nickname = $nickname;
@@ -222,6 +226,10 @@ class HouseAdmin extends Api @@ -222,6 +226,10 @@ class HouseAdmin extends Api
222 $this->error('手机号格式不正确'); 226 $this->error('手机号格式不正确');
223 } 227 }
224 $admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]); 228 $admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]);
  229 + if(!$admin){
  230 + $house = House::get($house_id);
  231 + $admin = HouseAdminModel::get(['id'=>$house['admin_user_id'],'user_id'=>$this->auth->id]);
  232 + }
225 empty($admin) && $this->error('您不是该小区的管理员'); 233 empty($admin) && $this->error('您不是该小区的管理员');
226 // 检查手机号是否存在 234 // 检查手机号是否存在
227 $mobile_exists = HouseAdminModel::where('mobile',$mobile) 235 $mobile_exists = HouseAdminModel::where('mobile',$mobile)
@@ -439,6 +447,10 @@ class HouseAdmin extends Api @@ -439,6 +447,10 @@ class HouseAdmin extends Api
439 empty($post['title']) && $this->error('请填写公告标题'); 447 empty($post['title']) && $this->error('请填写公告标题');
440 empty($post['content']) && $this->error('请填写公告内容'); 448 empty($post['content']) && $this->error('请填写公告内容');
441 $admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$post['house_id']]); 449 $admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$post['house_id']]);
  450 + if(!$admin){
  451 + $house = House::get($post['house_id']);
  452 + $admin = HouseAdminModel::get(['id'=>$house['admin_user_id'],'user_id'=>$this->auth->id]);
  453 + }
442 empty($admin) && $this->error('您不是该小区的管理员'); 454 empty($admin) && $this->error('您不是该小区的管理员');
443 $count = HouseBoard::whereTime('createtime', 'week') 455 $count = HouseBoard::whereTime('createtime', 'week')
444 ->where('house_id',$post['house_id']) 456 ->where('house_id',$post['house_id'])
@@ -507,6 +519,10 @@ class HouseAdmin extends Api @@ -507,6 +519,10 @@ class HouseAdmin extends Api
507 $this->error('缺少必要参数'); 519 $this->error('缺少必要参数');
508 } 520 }
509 $admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]); 521 $admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]);
  522 + if(!$admin){
  523 + $house = House::get($house_id);
  524 + $admin = HouseAdminModel::get(['id'=>$house['admin_user_id'],'user_id'=>$this->auth->id]);
  525 + }
510 empty($admin) && $this->error('您不是该小区的管理员'); 526 empty($admin) && $this->error('您不是该小区的管理员');
511 $info = HouseBoard::get(['house_id'=>$house_id,'id'=>$house_board_id]); 527 $info = HouseBoard::get(['house_id'=>$house_id,'id'=>$house_board_id]);
512 empty($info) && $this->error('公告信息不存在'); 528 empty($info) && $this->error('公告信息不存在');