Identity.php 947 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\admin\controller\commission;
  3. use app\common\controller\Backend;
  4. use app\common\model\commission\Identity as IdentityModel;
  5. class Identity extends Backend
  6. {
  7. protected $model = null;
  8. protected $searchFields = 'id,name';
  9. public function _initialize()
  10. {
  11. parent::_initialize();
  12. $this->model = new IdentityModel();
  13. }
  14. public function index()
  15. {
  16. if (!$this->request->isAjax()) {
  17. return $this->view->fetch();
  18. }
  19. if ($this->request->request('keyField')) {
  20. return $this->selectpage();
  21. }
  22. [$where, $sort, $order, $offset, $limit] = $this->buildparams();
  23. $list = $this->model
  24. ->where($where)
  25. ->order($sort, $order)
  26. ->paginate($limit);
  27. $result = ['total' => $list->total(), 'rows' => $list->items()];
  28. return json($result);
  29. }
  30. }