mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
chunk方法添加异常处理
This commit is contained in:
@@ -65,4 +65,5 @@ return [
|
|||||||
'bind attr has exists' => '模型的属性已经存在',
|
'bind attr has exists' => '模型的属性已经存在',
|
||||||
'relation data not exists' => '关联数据不存在',
|
'relation data not exists' => '关联数据不存在',
|
||||||
'relation not support' => '关联不支持',
|
'relation not support' => '关联不支持',
|
||||||
|
'chunk not support order' => 'Chunk不支持调用order方法',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ use think\Cache;
|
|||||||
use think\Collection;
|
use think\Collection;
|
||||||
use think\Config;
|
use think\Config;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
|
use think\App;
|
||||||
use think\db\exception\BindParamException;
|
use think\db\exception\BindParamException;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\ModelNotFoundException;
|
use think\db\exception\ModelNotFoundException;
|
||||||
@@ -2568,6 +2569,7 @@ class Query
|
|||||||
* @param string $column 分批处理的字段名
|
* @param string $column 分批处理的字段名
|
||||||
* @param string $order 排序规则
|
* @param string $order 排序规则
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
* @throws DbException
|
||||||
*/
|
*/
|
||||||
public function chunk($count, $callback, $column = null, $order = 'asc')
|
public function chunk($count, $callback, $column = null, $order = 'asc')
|
||||||
{
|
{
|
||||||
@@ -2582,6 +2584,7 @@ class Query
|
|||||||
$column = $column[0];
|
$column = $column[0];
|
||||||
}
|
}
|
||||||
if (isset($options['order'])) {
|
if (isset($options['order'])) {
|
||||||
|
App::$debug && throw new DbException('chunk not support call order');
|
||||||
unset($options['order']);
|
unset($options['order']);
|
||||||
}
|
}
|
||||||
$bind = $this->bind;
|
$bind = $this->bind;
|
||||||
|
|||||||
Reference in New Issue
Block a user