1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- /**
- * Niushop商城系统 - 团队十年电商经验汇集巨献!
- * =========================================================
- * Copy right 2015-2025 山西牛酷信息科技有限公司, 保留所有权利。
- * ----------------------------------------------
- * 官方网址: http://www.niushop.com.cn
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
- * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
- * =========================================================
- */
- namespace app\api\controller;
- use app\model\web\Notice as NoticeModel;
- use app\model\web\NoticeClass as NoticeClassModel;
- /**
- *
- * @author Administrator
- *
- */
- class Notice extends BaseApi
- {
-
- /**
- * 基础信息
- */
- public function info()
- {
- $id = isset($this->params['id']) ? $this->params['id'] : 0;
- if (empty($id)) {
- return $this->response($this->error('', 'REQUEST_ID'));
- }
- $notice = new NoticeModel();
- $info = $notice->getNoticeInfo([ [ 'id', '=', $id ] ],'id,title,content,show_number,create_time');
- $info['data']['create_time']=date('Y-m-d H:i:s', $info['data']['create_time']);
- $data['show_number'] = $info['data']['show_number']+1;
- $notice->editNotice($data, [ [ 'id', '=', $id ] ]);
- return $this->response($info);
- }
- /**
- * @return false|string
- * 公告列表
- */
- public function page()
- {
- $page = isset($this->params['page']) ? $this->params['page'] : 1;
- $page_size = isset($this->params['page_size']) ? $this->params['page_size'] : PAGE_LIST_ROWS;
- $n_class = isset($this->params['n_class']) ? $this->params['n_class'] : '';
- $notice = new NoticeModel();
- $condition = [];
- if(!empty($n_class)){
- $condition[] =['n_class','=',$n_class];
- }
- $list = $notice->getNoticePageList($condition, $page, $page_size,'id desc','id,title,content,create_time');
- foreach ($list['data']['list'] as $k=>$v){
- $list['data']['list'][$k]['create_time']=date('Y-m-d H:i:s', $list['data']['list'][$k]['create_time']);}
- return $this->response($list);
- }
- /**
- * @return false|string
- * 历史公告菜单
- */
- public function notice_class(){
- $page = isset($this->params['page']) ? $this->params['page'] : 1;
- $page_size = isset($this->params['page_size']) ? $this->params['page_size'] : PAGE_LIST_ROWS;
- $notice_class = new NoticeClassModel();
- $condition = [];
- $list = $notice_class->getNoticeClassPageList($condition, $page, $page_size);
- return $this->response($list);
- }
-
- }
|