controllerIndex.stub 825 B

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