controllerindex.stub 941 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * 查看
  3. */
  4. public function index()
  5. {
  6. //当前是否为关联查询
  7. $this->relationSearch = {%relationSearch%};
  8. //设置过滤方法
  9. $this->request->filter(['strip_tags', 'htmlspecialchars']);
  10. if ($this->request->isAjax())
  11. {
  12. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  13. $total = $this->model
  14. {%relationWith%}
  15. ->where($where)
  16. ->order($sort, $order)
  17. ->count();
  18. $list = $this->model
  19. {%relationWith%}
  20. ->where($where)
  21. ->order($sort, $order)
  22. ->limit($offset, $limit)
  23. ->select();
  24. $result = array("total" => $total, "rows" => $list);
  25. return json($result);
  26. }
  27. return $this->view->fetch();
  28. }