From 18aa14924e4c7ed709388690898d7a1d2dcebdac Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 31 Aug 2017 16:15:24 +0800 Subject: [PATCH] =?UTF-8?q?chunk=E6=96=B9=E6=B3=95=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lang/zh-cn.php | 1 + library/think/db/Query.php | 3 +++ 2 files changed, 4 insertions(+) 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;