| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace App\Console\Commands;
- use Illuminate\Console\Command;
- use App\Models\PaymentOrder as PaymentOrderModel;
- class PaymentOrder extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'payment:order';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '人工提现/人工充值订单24小时未处理的自动失败';
- /**
- * Execute the console command.
- *
- * @return int
- */
- public function handle()
- {
- //人工充值/提现订单
- $list = PaymentOrderModel::whereIn('status', [0,1,5])->whereIn('type', [3,4])->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-1 day')))->limit(200)->get();
- foreach ($list as $item) {
- $item->status = 3;
- $item->remark = '超时未处理,自动失败';
- $item->save();
- }
- // 代理人工充值同样 24 小时未处理自动失败;迁移未执行前跳过。
- if (!\Illuminate\Support\Facades\DB::getSchemaBuilder()->hasTable('agent_payment_orders')) return 0;
- \App\Models\Agent\AgentPaymentOrder::query()->whereIn('status', [0, 1, 5])->where('type', 3)
- ->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-1 day')))
- ->update(['status' => 3, 'remark' => '超时未处理,自动失败', 'updated_at' => date('Y-m-d H:i:s')]);
- }
- }
|