index.stub 791 B

123456789101112131415161718192021222324252627
  1. /**
  2. * 查看
  3. */
  4. public function index()
  5. {
  6. $this->request->filter(['strip_tags', 'trim']);
  7. // 如果是select则转发到select方法,若select未重写,其实还是继续执行index
  8. if ($this->request->param('select')) {
  9. $this->select();
  10. }
  11. list($where, $alias, $limit, $order) = $this->queryBuilder();
  12. $res = $this->model
  13. ->withJoin($this->withJoinTable, $this->withJoinType)
  14. ->alias($alias)
  15. ->where($where)
  16. ->order($order)
  17. ->paginate($limit);
  18. {%relationVisibleFields%}
  19. $this->success('', [
  20. 'list' => $res->items(),
  21. 'total' => $res->total(),
  22. 'remark' => get_route_remark(),
  23. ]);
  24. }