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

小区管理员优化

... ... @@ -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);
}
... ...
... ... @@ -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();
... ...