addArgument('name', InputArgument::OPTIONAL, '余额账户转福利账户'); $this->addArgument('name', InputArgument::OPTIONAL, '会员合伙人回填订单号'); } protected function execute(InputInterface $input, OutputInterface $output): int { $payDetails = PayDetail::where('pay_category', 'PARTNER')->get()->toArray(); try { foreach ($payDetails as $payDetail) { if (!empty($payDetail['join_pay_object_json'])) { $payObjectJson = json_decode($payDetail['join_pay_object_json'], true); } // 查订单号 $payDetailOrder = PayDetail::where('join_pay_order_id', 'PARTNER') ->where('join_pay_member_id', $payDetail['join_pay_member_id']) ->first(); if (!empty($payDetailOrder->join_pay_object_json)) { $payObjectJson2 = json_decode($payDetailOrder->join_pay_object_json, true); if (isset($payObjectJson2['recharge_order_id'])) { continue; } if (isset($payObjectJson['order_id'])) { $payObjectJson2['recharge_order_id'] = $payObjectJson['order_id']; PayDetail::where('pay_id', $payDetailOrder->pay_id)->update([ 'join_pay_object_json' => json_encode($payObjectJson2) ]); } } echo "支付记录【" . $payDetail['pay_id'] . "】已处理完成\n"; } Db::commit(); return self::SUCCESS; } catch (\Exception $e) { dump($e->getMessage()); Db::rollBack(); return self::SUCCESS; } } }