From 7e33e17d2fca63226c4ccfef8f5b5c974cf882d1 Mon Sep 17 00:00:00 2001 From: weizong song Date: Mon, 24 May 2021 14:12:12 +0800 Subject: [PATCH] up --- .../Commands/SyncWeixinRechargeState.php | 63 +++++++++++++++++++ app/Libs/WxMicroPay.class.php | 2 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 app/Console/Commands/SyncWeixinRechargeState.php diff --git a/app/Console/Commands/SyncWeixinRechargeState.php b/app/Console/Commands/SyncWeixinRechargeState.php new file mode 100644 index 0000000..87933ef --- /dev/null +++ b/app/Console/Commands/SyncWeixinRechargeState.php @@ -0,0 +1,63 @@ +where("id", ">", $last_id)->whereNull("paid_at")->where("payment", "weixin")->whereRaw()->limit($threshold)->get(); + if (!$recharges->count()) { + cache(['last_sync_weixin_recharge_id' => null], now()->addSeconds(90)); + echo "nothing"; + return; + } + + foreach ($recharges as $recharge) { + $result = (new WxMicroPay())->manualQuery($recharge); + dump($result); + } + + cache(['last_sync_weixin_recharge_id' => $recharges->last()->id], now()->addSeconds(90)); + } +} diff --git a/app/Libs/WxMicroPay.class.php b/app/Libs/WxMicroPay.class.php index e61a78f..9c1c5fb 100644 --- a/app/Libs/WxMicroPay.class.php +++ b/app/Libs/WxMicroPay.class.php @@ -56,7 +56,7 @@ class WxMicroPay extends WxPayCommon //查询支付结果 try { $out_trade_no = $this->parameters["out_trade_no"]; - $query_times = 10; + $query_times = 15; while ($query_times > 0) { $query_result = $this->orderQuery($out_trade_no); if ($query_result["return_code"] != "SUCCESS" && $result["result_code"] != "SUCCESS") {