diff --git a/lang/zh-cn.php b/lang/zh-cn.php index 6e89f01a..911c1e75 100644 --- a/lang/zh-cn.php +++ b/lang/zh-cn.php @@ -65,4 +65,5 @@ return [ 'bind attr has exists' => '模型的属性已经存在', 'relation data not exists' => '关联数据不存在', 'relation not support' => '关联不支持', + 'chunk not support order' => 'Chunk不支持调用order方法', ]; diff --git a/library/think/db/Query.php b/library/think/db/Query.php index f19cdc2e..2dff6863 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -16,6 +16,7 @@ use think\Cache; use think\Collection; use think\Config; use think\Db; +use think\App; use think\db\exception\BindParamException; use think\db\exception\DataNotFoundException; use think\db\exception\ModelNotFoundException; @@ -2568,6 +2569,7 @@ class Query * @param string $column 分批处理的字段名 * @param string $order 排序规则 * @return boolean + * @throws DbException */ public function chunk($count, $callback, $column = null, $order = 'asc') { @@ -2582,6 +2584,7 @@ class Query $column = $column[0]; } if (isset($options['order'])) { + App::$debug && throw new DbException('chunk not support call order'); unset($options['order']); } $bind = $this->bind;