controllerindex.stub 853 B

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