在使用TP6的paginateX大数据分页时有一个很严重的问题,可能是BUG。70万数据,带条件搜索,类似使用where(‘status’,1)的时候如果搜索结果为0条,则thinkphp直接抛出异常:“不支持的分页索引字段类型”(not support type)。如果是搜索结果不为空,则正常。
具体解决办法是:
修改框架文件\vendor\topthink\think-orm\src\db\BaseQuery.php
if (is_numeric($result)) {
$lastId = 'asc' == $sort ? ($result - 1) + ($page - 1) $listRows : ($result + 1) - ($page - 1) $listRows;
} else {
$lastId=0;
//throw new Exception('not support type');
}