海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
751 B

4 years ago
4 years ago
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Http\Controllers\Controller;
  4. use App\Models\Notice;
  5. /**
  6. * 公告
  7. * Class NoticeController
  8. * @package App\Http\Controllers\Api
  9. */
  10. class NoticeController extends Controller
  11. {
  12. // 公告列表
  13. public function index()
  14. {
  15. $list = Notice::query()->where('agent_id', $this->agent_id)
  16. ->status()
  17. ->select(['title', 'updated_at'])
  18. ->orderBy('id', 'DESC')
  19. ->simplePaginate(15);
  20. return $this->success($list);
  21. }
  22. public function show()
  23. {
  24. $id = (int)request()->input('id');
  25. $data = Notice::where('agent_id', $this->agent_id)->status()->find($id);
  26. if (!$data) {
  27. return $this->error('公告不存在或已删除');
  28. }
  29. return $this->success($data);
  30. }
  31. }