|
|
@@ -39,14 +39,14 @@ class TestController extends Controller
|
|
|
$query = new \yii\db\Query();
|
|
|
$query->select(['id', 'sendStatus']);
|
|
|
$query->from(Order::tableName());
|
|
|
- foreach ($query->batch() as $batch) {
|
|
|
- foreach ($batch as $order) {
|
|
|
- $id = $order['id'];
|
|
|
- \bizGhs\order\classes\OrderClass::updateById($id, ['sendStatus' => -4]);
|
|
|
- //echo $id . "\n";
|
|
|
+ $totalCount = 0;
|
|
|
+ foreach ($query->batch(3000) as $batch) {
|
|
|
+ $ids = array_column($batch, 'id');
|
|
|
+ \bizGhs\order\classes\OrderClass::updateByIds($ids, ['sendStatus' => -4]);
|
|
|
+ $totalCount += count($ids);
|
|
|
+ echo "已处理 " . $totalCount . " 条记录\n";
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
+ echo "全部完成!共处理 " . $totalCount . " 条记录\n";
|
|
|
}
|
|
|
|
|
|
public function actionSend()
|