Task.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace app\admin\controller\task;
  3. use app\common\controller\Backend;
  4. /**
  5. * 会员管理
  6. *
  7. * @icon fa fa-user
  8. */
  9. class Task extends Backend
  10. {
  11. protected $relationSearch = true;
  12. /**
  13. * @var \app\admin\model\User
  14. */
  15. protected $model = null;
  16. public function _initialize()
  17. {
  18. parent::_initialize();
  19. $this->model = model('Task');
  20. }
  21. /**
  22. * 查看
  23. */
  24. public function index()
  25. {
  26. //设置过滤方法
  27. $this->request->filter(['strip_tags']);
  28. if ($this->request->isAjax()) {
  29. //如果发送的来源是Selectpage,则转发到Selectpage
  30. if ($this->request->request('keyField')) {
  31. return $this->selectpage();
  32. }
  33. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  34. $total = $this->model
  35. ->with('user')
  36. ->where($where)
  37. ->order($sort, $order)
  38. ->count();
  39. $list = $this->model
  40. ->with('user')
  41. ->where($where)
  42. ->order($sort, $order)
  43. ->limit($offset, $limit)
  44. ->select();
  45. $result = array("total" => $total, "rows" => $list);
  46. return json($result);
  47. }
  48. return $this->view->fetch();
  49. }
  50. /**
  51. * 编辑
  52. */
  53. public function edit($ids = NULL)
  54. {
  55. $row = $this->model->get($ids);
  56. if (!$row)
  57. $this->error(__('No Results were found'));
  58. return parent::edit($ids);
  59. }
  60. }