Skip to content

Commit db6dcd1

Browse files
authored
Merge pull request #72 from teamones-open/2.0
modify: selectData 接口优化,移除count上限数据限制
2 parents 247151a + 2139056 commit db6dcd1

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/think/model/RelationModel.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2833,19 +2833,12 @@ public function selectData($options = [], $needFormat = true)
28332833
if (array_key_exists("page", $options) && (int)$options["page"][0] > 1) {
28342834
$isNotFirstPageOrNotCount = true;
28352835
} else {
2836-
$maxId = $this->max('id');
2837-
28382836
if ($this->isComplexFilter) {
28392837
$this->alias("`{$this->currentModuleCode}`");
28402838
}
28412839

2842-
if ($maxId > 100000) {
2843-
// 当单表数据量超过10万时候,不做count查询
2844-
$total = C("database.database_max_select_rows");
2845-
} else {
2846-
// 只有第一页才count total
2847-
$total = $this->where($filter)->count();
2848-
}
2840+
// 只有第一页才count total
2841+
$total = $this->where($filter)->cache(60)->count();
28492842
}
28502843
} else {
28512844
// 不需要count数据

0 commit comments

Comments
 (0)