mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]修复搜索时,分页参数空格字符异常
This commit is contained in:
parent
39695b0229
commit
7b680ff619
@ -81,9 +81,10 @@ class BasicAdmin extends Controller
|
|||||||
* @param bool $isPage 是启用分页
|
* @param bool $isPage 是启用分页
|
||||||
* @param bool $isDisplay 是否直接输出显示
|
* @param bool $isDisplay 是否直接输出显示
|
||||||
* @param bool $total 总记录数
|
* @param bool $total 总记录数
|
||||||
|
* @param array $result
|
||||||
* @return array|string
|
* @return array|string
|
||||||
*/
|
*/
|
||||||
protected function _list($dbQuery = null, $isPage = true, $isDisplay = true, $total = false)
|
protected function _list($dbQuery = null, $isPage = true, $isDisplay = true, $total = false, $result = [])
|
||||||
{
|
{
|
||||||
$db = is_null($dbQuery) ? Db::name($this->table) : (is_string($dbQuery) ? Db::name($dbQuery) : $dbQuery);
|
$db = is_null($dbQuery) ? Db::name($this->table) : (is_string($dbQuery) ? Db::name($dbQuery) : $dbQuery);
|
||||||
// 列表排序默认处理
|
// 列表排序默认处理
|
||||||
@ -102,15 +103,12 @@ class BasicAdmin extends Controller
|
|||||||
$fields = $db->getTableFields($db->getTable());
|
$fields = $db->getTableFields($db->getTable());
|
||||||
in_array('sort', $fields) && $db->order('sort asc');
|
in_array('sort', $fields) && $db->order('sort asc');
|
||||||
}
|
}
|
||||||
$result = [];
|
|
||||||
if ($isPage) {
|
if ($isPage) {
|
||||||
$rows = intval($this->request->get('rows', cookie('rows')));
|
$rows = intval($this->request->get('rows', cookie('rows')));
|
||||||
cookie('rows', $rows >= 10 ? $rows : 20);
|
cookie('rows', $rows >= 10 ? $rows : 20);
|
||||||
$page = $db->paginate($rows, $total, ['query' => $this->request->get()]);
|
$page = $db->paginate($rows, $total, ['query' => $this->request->get('', '', 'urlencode')]);
|
||||||
$result['list'] = $page->all();
|
list($pattern, $replacement) = [['|href="(.*?)"|', '|pagination|'], ['data-open="$1"', 'pagination pull-right']];
|
||||||
$pattern = ['|href="(.*?)"|', '|pagination|'];
|
list($result['list'], $result['page']) = [$page->all(), preg_replace($pattern, $replacement, $page->render())];
|
||||||
$replacement = ['data-open="$1" href="javascript:void(0);"', 'pagination pull-right'];
|
|
||||||
$result['page'] = preg_replace($pattern, $replacement, $page->render());
|
|
||||||
} else {
|
} else {
|
||||||
$result['list'] = $db->select();
|
$result['list'] = $db->select();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user