海南旅游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.

34 lines
727 B

  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. ->select(['title', 'updated_at'])
  17. ->orderBy('id', 'DESC')
  18. ->simplePaginate(15);
  19. return $this->success($list);
  20. }
  21. public function show()
  22. {
  23. $id = (int)request()->input('id');
  24. $data = Notice::where('agent_id', $this->agent_id)->find($id);
  25. if (!$data) {
  26. return $this->error('公告不存在或已删除');
  27. }
  28. return $this->success($data);
  29. }
  30. }