From c368d4e44cbb00741497df873fd405e01b7ec052 Mon Sep 17 00:00:00 2001 From: chen <569922982@qq.com> Date: Sat, 27 Oct 2018 11:02:30 +0800 Subject: [PATCH] =?UTF-8?q?ChenPay=20=E6=94=AF=E4=BB=98=E5=AE=9D=E9=A2=91?= =?UTF-8?q?=E7=B9=81=E9=97=AE=E9=A2=98=E6=9B=B4=E6=96=B0=20-=20=E6=9C=89?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=83=85=E5=86=B5=E4=B8=8B=E6=89=8D=E6=98=AF?= =?UTF-8?q?10=E7=A7=92=E4=B8=80=E6=AC=A1=E7=9A=84=E9=A2=91=E7=8E=87=20?= =?UTF-8?q?=E6=9D=9C=E7=BB=9D=E6=94=AF=E4=BB=98=E5=AE=9D=E9=A3=8E=E6=8E=A7?= =?UTF-8?q?=20-=20=E6=97=A0=E8=AE=A2=E5=8D=95=E6=83=85=E5=86=B5=E4=B8=8B2?= =?UTF-8?q?=E5=88=86=E9=92=9F=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/Gateway/ChenPay.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Services/Gateway/ChenPay.php b/app/Services/Gateway/ChenPay.php index 7e283eda..84ef4381 100644 --- a/app/Services/Gateway/ChenPay.php +++ b/app/Services/Gateway/ChenPay.php @@ -195,9 +195,16 @@ class ChenPay extends AbstractPayment { $GLOBALS['AliSum'] = 1; $GLOBALS['AliType'] = true; + $GLOBALS['AliStatus'] = time(); \ChenPay\Pay::Listen($this->listenInterval, function () { $that = new ChenPay(); $log = ""; + $tradeCount = Paylist::where('status', 0)->where('type', 1)->where('datetime', '>', time())->count(); + if ($GLOBALS['AliStatus'] > time() && $tradeCount == 0) { + $log .= "支付宝监听暂停中[" . date('Y-m-d H:i:s') . "]\n"; + file_put_contents(__DIR__ . "/../../storage/logs/chenpay.log", $log, FILE_APPEND); + return; + } try { $run = (new \ChenPay\AliPay($that->getConfig('AliPay_Cookie')))->getData($GLOBALS['AliType'])->DataHandle(); $tradeAll = Paylist::where('status', 0)->where('type', 1)->where('datetime', '>', time())->orderBy('id', 'desc')->get(); @@ -212,6 +219,7 @@ class ChenPay extends AbstractPayment $that->sendSunMail(1); $GLOBALS['AliType'] = !$GLOBALS['AliType']; $GLOBALS['AliSum']++; + $GLOBALS['AliStatus'] = time() + 2 * 60; } catch (\ChenPay\PayException\PayException $e) { if ($e->getCode() == 445) $that->sendMail(1); $log .= "支付宝监听" . $e->getMessage() . "[" . date('Y-m-d H:i:s') . "]\n";