正在显示
1 个修改的文件
包含
7 行增加
和
1 行删除
@@ -362,7 +362,9 @@ class HouseAdmin extends Api | @@ -362,7 +362,9 @@ class HouseAdmin extends Api | ||
362 | { | 362 | { |
363 | $house_id = $this->request->param('house_id'); | 363 | $house_id = $this->request->param('house_id'); |
364 | empty($house_id) && $this->error('缺少必要参数'); | 364 | empty($house_id) && $this->error('缺少必要参数'); |
365 | - $count = HouseBoard::whereTime('createtime', 'week')->count(); | 365 | + $count = HouseBoard::whereTime('createtime', 'week') |
366 | + ->where('house_id',$house_id) | ||
367 | + ->count(); | ||
366 | $times = $count >= 2 ? 0 : 2-$count; | 368 | $times = $count >= 2 ? 0 : 2-$count; |
367 | $this->success('success',compact('times')); | 369 | $this->success('success',compact('times')); |
368 | } | 370 | } |
@@ -392,6 +394,10 @@ class HouseAdmin extends Api | @@ -392,6 +394,10 @@ class HouseAdmin extends Api | ||
392 | empty($post['content']) && $this->error('请填写公告内容'); | 394 | empty($post['content']) && $this->error('请填写公告内容'); |
393 | $admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$post['house_id']]); | 395 | $admin = HouseAdminModel::get(['user_id'=>$this->auth->id,'house_id'=>$post['house_id']]); |
394 | empty($admin) && $this->error('您不是该小区的管理员'); | 396 | empty($admin) && $this->error('您不是该小区的管理员'); |
397 | + $count = HouseBoard::whereTime('createtime', 'week') | ||
398 | + ->where('house_id',$post['house_id']) | ||
399 | + ->count(); | ||
400 | + $count >= 2 && $this->error('本周发布次数已用完'); | ||
395 | (new HouseBoard)->allowField(true)->save(array_merge([ | 401 | (new HouseBoard)->allowField(true)->save(array_merge([ |
396 | 'admin_user_id' => $this->auth->id | 402 | 'admin_user_id' => $this->auth->id |
397 | ],$post)); | 403 | ],$post)); |
-
请 注册 或 登录 后发表评论