12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace app\admin\controller;
- use app\common\controller\Backend;
- class UserCar extends Backend
- {
-
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\UserCar;
- }
-
-
- public function index()
- {
-
- $this->request->filter(['strip_tags', 'trim']);
- if ($this->request->isAjax()) {
-
- if ($this->request->request('keyField')) {
- return $this->selectpage();
- }
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
- $uc = 'user_car';
- $u = 'user';
- $uNickname = $u.'.nickname';
- $field = $uc.'.id,user_id,car_number,car_model,'.$uc.'.createtime,'.$uc.'.updatetime,'.$uNickname.' as `'.$uNickname.'`';
- $list = $this->model->alias($uc)->field($field)
- ->join($u,$u.'.id = '.$uc.'.user_id','LEFT')
- ->where($where)
- ->order($sort, $order)
- ->paginate($limit);
- $result = array("total" => $list->total(), "rows" => $list->items());
- return json($result);
- }
- return $this->view->fetch();
- }
- }
|