Notice.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace app\shopapi\controller;
  11. use app\model\web\Notice as NoticeModel;
  12. /**
  13. * 网站公告
  14. * Class Notice
  15. * @package app\shopapi\controller
  16. */
  17. class Notice extends BaseApi
  18. {
  19. public function lists()
  20. {
  21. $page = isset($this->params[ 'page' ]) ? $this->params[ 'page' ] : 1;
  22. $limit = isset($this->params[ 'page_size' ]) ? $this->params[ 'page_size' ] : PAGE_LIST_ROWS;
  23. $condition = [];
  24. $receiving_type = isset($this->params[ 'receiving_type' ]) ? $this->params[ 'receiving_type' ] : 'shop';
  25. if ($receiving_type) {
  26. $condition[] = [ 'receiving_type', 'like', '%' . $receiving_type . '%' ];
  27. }
  28. $notice = new NoticeModel();
  29. $list = $notice->getNoticePageList($condition, $page, $limit);
  30. return $this->response($list);
  31. }
  32. public function detail()
  33. {
  34. $id = isset($this->params[ 'id' ]) ? $this->params[ 'id' ] : 0;
  35. $notice = new NoticeModel();
  36. $info = $notice->getNoticeInfo([ [ 'id', '=', $id ] ]);
  37. return $this->response($info);
  38. }
  39. }