|
@@ -178,6 +178,10 @@ class HouseAdmin extends Api |
|
@@ -178,6 +178,10 @@ class HouseAdmin extends Api |
178
|
empty($house_id) && $this->error('缺少必要参数');
|
178
|
empty($house_id) && $this->error('缺少必要参数');
|
179
|
$info = HouseAdminModel::where(['user_id'=>$this->auth->id,'house_id'=>$house_id])->field('id,nickname,avatar,mobile')
|
179
|
$info = HouseAdminModel::where(['user_id'=>$this->auth->id,'house_id'=>$house_id])->field('id,nickname,avatar,mobile')
|
180
|
->find();
|
180
|
->find();
|
|
|
181
|
+ if(!$info){
|
|
|
182
|
+ $admin_user_id = House::where('id',$house_id)->value('admin_user_id');
|
|
|
183
|
+ $info = HouseAdminModel::where(['id'=>$admin_user_id,'user_id'=>$this->auth->id])->field('id,nickname,avatar,mobile')->find();
|
|
|
184
|
+ }
|
181
|
$info['avatar'] = cdnurl($info['avatar'],true);
|
185
|
$info['avatar'] = cdnurl($info['avatar'],true);
|
182
|
$this->success('success',$info);
|
186
|
$this->success('success',$info);
|
183
|
}
|
187
|
}
|
|
@@ -196,6 +200,10 @@ class HouseAdmin extends Api |
|
@@ -196,6 +200,10 @@ class HouseAdmin extends Api |
196
|
|
200
|
|
197
|
empty($house_id) && $this->error('缺少必要参数');
|
201
|
empty($house_id) && $this->error('缺少必要参数');
|
198
|
$admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]);
|
202
|
$admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]);
|
|
|
203
|
+ if(!$admin){
|
|
|
204
|
+ $house = House::get($house_id);
|
|
|
205
|
+ $admin = HouseAdminModel::get(['id'=>$house['admin_user_id'],'user_id'=>$this->auth->id]);
|
|
|
206
|
+ }
|
199
|
empty($admin) && $this->error('您不是该小区的管理员');
|
207
|
empty($admin) && $this->error('您不是该小区的管理员');
|
200
|
|
208
|
|
201
|
$admin->nickname = $nickname;
|
209
|
$admin->nickname = $nickname;
|
|
@@ -222,6 +230,10 @@ class HouseAdmin extends Api |
|
@@ -222,6 +230,10 @@ class HouseAdmin extends Api |
222
|
$this->error('手机号格式不正确');
|
230
|
$this->error('手机号格式不正确');
|
223
|
}
|
231
|
}
|
224
|
$admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]);
|
232
|
$admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]);
|
|
|
233
|
+ if(!$admin){
|
|
|
234
|
+ $house = House::get($house_id);
|
|
|
235
|
+ $admin = HouseAdminModel::get(['id'=>$house['admin_user_id'],'user_id'=>$this->auth->id]);
|
|
|
236
|
+ }
|
225
|
empty($admin) && $this->error('您不是该小区的管理员');
|
237
|
empty($admin) && $this->error('您不是该小区的管理员');
|
226
|
// 检查手机号是否存在
|
238
|
// 检查手机号是否存在
|
227
|
$mobile_exists = HouseAdminModel::where('mobile',$mobile)
|
239
|
$mobile_exists = HouseAdminModel::where('mobile',$mobile)
|
|
@@ -439,6 +451,10 @@ class HouseAdmin extends Api |
|
@@ -439,6 +451,10 @@ class HouseAdmin extends Api |
439
|
empty($post['title']) && $this->error('请填写公告标题');
|
451
|
empty($post['title']) && $this->error('请填写公告标题');
|
440
|
empty($post['content']) && $this->error('请填写公告内容');
|
452
|
empty($post['content']) && $this->error('请填写公告内容');
|
441
|
$admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$post['house_id']]);
|
453
|
$admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$post['house_id']]);
|
|
|
454
|
+ if(!$admin){
|
|
|
455
|
+ $house = House::get($post['house_id']);
|
|
|
456
|
+ $admin = HouseAdminModel::get(['id'=>$house['admin_user_id'],'user_id'=>$this->auth->id]);
|
|
|
457
|
+ }
|
442
|
empty($admin) && $this->error('您不是该小区的管理员');
|
458
|
empty($admin) && $this->error('您不是该小区的管理员');
|
443
|
$count = HouseBoard::whereTime('createtime', 'week')
|
459
|
$count = HouseBoard::whereTime('createtime', 'week')
|
444
|
->where('house_id',$post['house_id'])
|
460
|
->where('house_id',$post['house_id'])
|
|
@@ -507,6 +523,10 @@ class HouseAdmin extends Api |
|
@@ -507,6 +523,10 @@ class HouseAdmin extends Api |
507
|
$this->error('缺少必要参数');
|
523
|
$this->error('缺少必要参数');
|
508
|
}
|
524
|
}
|
509
|
$admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]);
|
525
|
$admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$house_id]);
|
|
|
526
|
+ if(!$admin){
|
|
|
527
|
+ $house = House::get($house_id);
|
|
|
528
|
+ $admin = HouseAdminModel::get(['id'=>$house['admin_user_id'],'user_id'=>$this->auth->id]);
|
|
|
529
|
+ }
|
510
|
empty($admin) && $this->error('您不是该小区的管理员');
|
530
|
empty($admin) && $this->error('您不是该小区的管理员');
|
511
|
$info = HouseBoard::get(['house_id'=>$house_id,'id'=>$house_board_id]);
|
531
|
$info = HouseBoard::get(['house_id'=>$house_id,'id'=>$house_board_id]);
|
512
|
empty($info) && $this->error('公告信息不存在');
|
532
|
empty($info) && $this->error('公告信息不存在');
|