redis->executeCommand('GET', [$cacheKey]); if (!empty($has)) { Yii::info("第三方3秒内重复通知:{$capitalType} {$orderSn}"); noticeUtil::push("第三方支付回调,3秒内重复通知:{$capitalType} {$orderSn}", '15280215347'); return false; } Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 3, 'has']); $connection = Yii::$app->db; $transaction = $connection->beginTransaction(); try { //流水类型列表 switch ($capitalType) { case dict::getDict('capitalType', 'xhRecharge', 'id'): //商家充值 RechargeClass::thirdPay($payWay, $orderSn, $totalFee, $attach); break; case dict::getDict('capitalType', 'xhPurchase', 'id'): //零售采购 PurchaseService::thirdPay($payWay, $orderSn, $totalFee, $attach, $transactionId); break; case dict::getDict('capitalType', 'hdPurchaseClear', 'id'): //零售结帐 PurchaseClearClass::thirdPay($payWay, $orderSn, $totalFee, $attach); break; case dict::getDict('capitalType', 'xhOrder', 'id'): //花粉下单 OrderClass::thirdPay($payWay, $orderSn, $totalFee, $attach); break; case dict::getDict('capitalType', 'xhRenew', 'id'): //商家续期 RenewClass::thirdPay($payWay, $orderSn, $totalFee, $attach); break; case dict::getDict('capitalType', 'pxApply', 'id'): //培训报名 PxApplyService::thirdPay($payWay, $orderSn, $totalFee, $attach); break; default: } $transaction->commit(); //收款声音播放 shish 202010726 if ($capitalType == dict::getDict('capitalType', 'xhOrder', 'id')) { $order = OrderClass::getByCondition(['orderSn' => $orderSn], true); if (isset($order->fromType) && $order->fromType == dict::getDict("fromType", "shop")) { $shopId = $order->shopId ?? 0; $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], true); if (isset($shopExt->lbSn) && !empty($shopExt->lbSn)) { $actPrice = floatval($order->actPrice) ?? 0; $payWay = $order->payWay ?? dict::getDict('payWay', 'wxPay'); $sound = $payWay == dict::getDict('payWay', 'wxPay') ? "微信收款{$actPrice}元" : "支付宝收款{$actPrice}元"; $url = "https://speaker.17laimai.cn/notify.php?id={$shopExt->lbSn}&token=HK1626595800&version=3&message=" . $sound; $curl = new curl\Curl(); $curl->get($url); } } } } catch (Exception $exception) { $transaction->rollBack(); util::fail("支付回调处理失败 orderSn:{$orderSn} capitalType:{$capitalType}"); } } }