Notice.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2015-2025 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace app\api\controller;
  11. use app\model\web\Notice as NoticeModel;
  12. /**
  13. * Class Notice
  14. * @package app\api\controller
  15. */
  16. class Notice extends BaseApi
  17. {
  18. /**
  19. * 基础信息
  20. */
  21. public function info()
  22. {
  23. $id = isset($this->params[ 'id' ]) ? $this->params[ 'id' ] : 0;
  24. if (empty($id)) {
  25. return $this->response($this->error('', 'REQUEST_ID'));
  26. }
  27. $notice = new NoticeModel();
  28. $info = $notice->getNoticeInfo([ [ 'id', '=', $id ], [ 'site_id', '=', $this->site_id ] ]);
  29. return $this->response($info);
  30. }
  31. public function lists()
  32. {
  33. $id_arr = isset($this->params[ 'id_arr' ]) ? $this->params[ 'id_arr' ] : '';//id数组
  34. $notice = new NoticeModel();
  35. $condition = [
  36. [ 'receiving_type', 'like', '%mobile%' ],
  37. [ 'site_id', '=', $this->site_id ],
  38. [ 'id', 'in', $id_arr ]
  39. ];
  40. $list = $notice->getNoticeList($condition);
  41. return $this->response($list);
  42. }
  43. public function page()
  44. {
  45. $page = isset($this->params[ 'page' ]) ? $this->params[ 'page' ] : 1;
  46. $page_size = isset($this->params[ 'page_size' ]) ? $this->params[ 'page_size' ] : PAGE_LIST_ROWS;
  47. $notice = new NoticeModel();
  48. $order = 'is_top desc,sort asc,create_time desc';
  49. $list = $notice->getNoticePageList([ [ 'receiving_type', 'like', '%mobile%' ], [ 'site_id', '=', $this->site_id ] ], $page, $page_size, $order);
  50. return $this->response($list);
  51. }
  52. }