...
|
...
|
@@ -178,6 +178,10 @@ class HouseAdmin extends Api |
|
|
empty($house_id) && $this->error('缺少必要参数');
|
|
|
$info = HouseAdminModel::where(['user_id'=>$this->auth->id,'house_id'=>$house_id])->field('id,nickname,avatar,mobile')
|
|
|
->find();
|
|
|
if(!$info){
|
|
|
$admin_user_id = House::where('id',$house_id)->value('admin_user_id');
|
|
|
$info = HouseAdminModel::where(['id'=>$admin_user_id,'user_id'=>$this->auth->id])->field('id,nickname,avatar,mobile')->find();
|
|
|
}
|
|
|
$info['avatar'] = cdnurl($info['avatar'],true);
|
|
|
$this->success('success',$info);
|
|
|
}
|
...
|
...
|
@@ -196,6 +200,10 @@ class HouseAdmin extends Api |
|
|
|
|
|
empty($house_id) && $this->error('缺少必要参数');
|
|
|
$admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]);
|
|
|
if(!$admin){
|
|
|
$house = House::get($house_id);
|
|
|
$admin = HouseAdminModel::get(['id'=>$house['admin_user_id'],'user_id'=>$this->auth->id]);
|
|
|
}
|
|
|
empty($admin) && $this->error('您不是该小区的管理员');
|
|
|
|
|
|
$admin->nickname = $nickname;
|
...
|
...
|
@@ -222,6 +230,10 @@ class HouseAdmin extends Api |
|
|
$this->error('手机号格式不正确');
|
|
|
}
|
|
|
$admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]);
|
|
|
if(!$admin){
|
|
|
$house = House::get($house_id);
|
|
|
$admin = HouseAdminModel::get(['id'=>$house['admin_user_id'],'user_id'=>$this->auth->id]);
|
|
|
}
|
|
|
empty($admin) && $this->error('您不是该小区的管理员');
|
|
|
// 检查手机号是否存在
|
|
|
$mobile_exists = HouseAdminModel::where('mobile',$mobile)
|
...
|
...
|
@@ -439,6 +451,10 @@ class HouseAdmin extends Api |
|
|
empty($post['title']) && $this->error('请填写公告标题');
|
|
|
empty($post['content']) && $this->error('请填写公告内容');
|
|
|
$admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$post['house_id']]);
|
|
|
if(!$admin){
|
|
|
$house = House::get($post['house_id']);
|
|
|
$admin = HouseAdminModel::get(['id'=>$house['admin_user_id'],'user_id'=>$this->auth->id]);
|
|
|
}
|
|
|
empty($admin) && $this->error('您不是该小区的管理员');
|
|
|
$count = HouseBoard::whereTime('createtime', 'week')
|
|
|
->where('house_id',$post['house_id'])
|
...
|
...
|
@@ -507,6 +523,10 @@ class HouseAdmin extends Api |
|
|
$this->error('缺少必要参数');
|
|
|
}
|
|
|
$admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]);
|
|
|
if(!$admin){
|
|
|
$house = House::get($house_id);
|
|
|
$admin = HouseAdminModel::get(['id'=>$house['admin_user_id'],'user_id'=>$this->auth->id]);
|
|
|
}
|
|
|
empty($admin) && $this->error('您不是该小区的管理员');
|
|
|
$info = HouseBoard::get(['house_id'=>$house_id,'id'=>$house_board_id]);
|
|
|
empty($info) && $this->error('公告信息不存在');
|
...
|
...
|
|