From a45d2f07741de0f873edaa0f23704f89e2273398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Fri, 19 Mar 2021 15:47:40 +0800 Subject: [PATCH] Update UserTransfer.php --- app/data/command/UserTransfer.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/data/command/UserTransfer.php b/app/data/command/UserTransfer.php index 6535be4a1..b54252bfe 100644 --- a/app/data/command/UserTransfer.php +++ b/app/data/command/UserTransfer.php @@ -29,13 +29,17 @@ class UserTransfer extends Command * @param Input $input * @param Output $output * @return void + * @throws Exception * @throws \think\db\exception\DbException */ protected function execute(Input $input, Output $output) { $map = [['type', 'in', ['wechat_banks', 'wechat_wallet']], ['status', 'in', [3, 4]]]; + [$total, $count, $error] = [$this->app->db->name('DataUserTransfer')->where($map)->count(), 0, 0]; foreach ($this->app->db->name('DataUserTransfer')->where($map)->cursor() as $vo) try { + $this->queue->message($total, ++$count, "开始处理订单 {$vo['code']} 提现"); if ($vo['status'] === 3) { + $this->queue->message($total, $count, "尝试处理订单 {$vo['code']} 打款", 1); if ($vo['type'] === 'wechat_banks') { $result = $this->createTransferBank($vo); } else { @@ -55,6 +59,7 @@ class UserTransfer extends Command ]); } } elseif ($vo['status'] === 4) { + $this->queue->message($total, $count, "刷新提现订单 {$vo['code']} 状态", 1); if ($vo['type'] === 'wechat_banks') { $this->queryTransferBank($vo); } else { @@ -62,11 +67,13 @@ class UserTransfer extends Command } } } catch (\Exception $exception) { - $this->output->writeln("提现 {$vo['code']} 失败,{$exception->getMessage()}"); + $error++; + $this->queue->message($total, $count, "处理提现订单 {$vo['code']} 失败,{$exception->getMessage()}"); $this->app->db->name('DataUserTransfer')->where(['code' => $vo['code']])->update([ 'change_time' => date('Y-m-d H:i:s'), 'change_desc' => $exception->getMessage(), ]); } + $this->setQueueSuccess("此次共处理 {$total} 笔提现操作,处理失败 {$error} 笔。"); } /**