mirror of https://gitee.com/karson/fastadmin.git
37 lines
1.1 KiB
Plaintext
37 lines
1.1 KiB
Plaintext
|
|
/**
|
|
* 查看
|
|
*/
|
|
public function index()
|
|
{
|
|
//当前是否为关联查询
|
|
$this->relationSearch = {%relationSearch%};
|
|
//设置过滤方法
|
|
$this->request->filter(['strip_tags']);
|
|
if ($this->request->isAjax())
|
|
{
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
$total = $this->model
|
|
{%relationWithList%}
|
|
->where($where)
|
|
->order($sort, $order)
|
|
->count();
|
|
|
|
$list = $this->model
|
|
{%relationWithList%}
|
|
->where($where)
|
|
->order($sort, $order)
|
|
->limit($offset, $limit)
|
|
->select();
|
|
|
|
foreach ($list as $row) {
|
|
{%visibleFieldList%}
|
|
{%relationVisibleFieldList%}
|
|
}
|
|
$list = collection($list)->toArray();
|
|
$result = array("total" => $total, "rows" => $list);
|
|
|
|
return json($result);
|
|
}
|
|
return $this->view->fetch();
|
|
} |