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

合并分支 'heshupeng' 到 'master'

Heshupeng



查看合并请求 !409
... ... @@ -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('公告信息不存在');
... ...
... ... @@ -335,11 +335,12 @@ class HouseBoard extends Api
if(empty($house_id)){
$this->error('缺少必要参数');
}
$admin_user_id = Db::name('house')->where('id',$house_id)->value('admin_user_id');
$data = Db::name('house_admin')
->alias('a')
->join('user b','a.user_id = b.id')
->where('a.house_id',$house_id)
->whereOr('a.id',$admin_user_id)
->field('a.user_id,b.avatar,b.nickname')
->order('a.is_direct')
->select();
... ...