| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\admin\controller\general;
- use app\common\controller\Backend;
- /**
- * 文件管理
- *
- * @icon fa fa-circle-o
- */
- class Announcement extends Backend
- {
- /**
- * Banner模型对象 茶说、公告、合成公告、轮播图
- * @var \app\admin\model\Banner
- */
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\common\model\AnnouncementModel;
- $this->view->assign("typeList", $this->model ::getTypeList());
- }
- /**
- * 查
- * @return string|Json
- * @throws \think\Exception
- * @throws DbException
- */
- public function index()
- {
- //设置过滤方法
- $this->request->filter(['strip_tags', 'trim']);
- if (false === $this->request->isAjax()) {
- return $this->view->fetch();
- }
- //如果发送的来源是 Selectpage,则转发到 Selectpage
- if ($this->request->request('keyField')) {
- return $this->selectpage();
- }
- [$where, $sort, $order, $offset, $limit] = $this->buildparams();
- $map = [];
- $type = $this->request->param('type_id/d');
- if($type > 0) $map['type_id'] = $type;
- $list = $this->model
- ->where($where)->where($map)
- ->order($sort, $order)
- ->paginate($limit);
- $result = ['total' => $list->total(), 'rows' => $list->items()];
- return json($result);
- }
-
- }
|