1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace app\admin\controller\dict;
- use app\common\controller\Backend;
- /**
- *
- *
- * @icon fa fa-circle-o
- */
- class Project extends Backend
- {
-
- /**
- * Project模型对象
- * @var \app\admin\model\dict\Project
- */
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\dict\Project;
- }
- /**
- * 查看
- */
- public function index()
- {
- //设置过滤方法
- $this->request->filter(['strip_tags']);
- if ($this->request->isAjax()) {
- //如果发送的来源是Selectpage,则转发到Selectpage
- if ($this->request->request('keyField')) {
- return $this->selectpage();
- }
- list($where, $sort, $order, $offset, $limit) = $this->buildparams($this->searchFields, true);
- $join = [
- ['constant c', 'p.exam_class_id = c.id', 'LEFT']
- ];
- $field = ['c.constant_value as exam_class','p.*'];
- $total = $this->model->alias('p')
- ->join($join)
- ->where($where)
- ->order($sort, $order)
- ->count();
- $list = $this->model->alias('p')
- ->join($join)
- ->where($where)
- ->order($sort, $order)
- ->limit($offset, $limit)
- ->field($field)
- ->select();
- $list = collection($list)->toArray();
- $result = array("total" => $total, "rows" => $list);
- return json($result);
- }
- return $this->view->fetch();
- }
-
- }
|