|
|
@@ -1,18 +1,15 @@
|
|
|
<?php
|
|
|
|
|
|
namespace common\components;
|
|
|
-use biz\notice\classes\NoticeClass;
|
|
|
+
|
|
|
use biz\recharge\classes\RechargeClass;
|
|
|
use biz\renew\classes\RenewClass;
|
|
|
-use biz\shop\classes\ShopExtClass;
|
|
|
use biz\wx\classes\WxMessageClass;
|
|
|
use bizHd\order\classes\OrderClass;
|
|
|
-use bizHd\purchase\classes\PurchaseClass;
|
|
|
use bizHd\purchase\classes\PurchaseClearClass;
|
|
|
use bizHd\purchase\services\PurchaseService;
|
|
|
use bizHd\px\services\PxApplyService;
|
|
|
use Yii;
|
|
|
-use linslin\yii2\curl;
|
|
|
|
|
|
class payUtil
|
|
|
{
|
|
|
@@ -24,72 +21,45 @@ class payUtil
|
|
|
$has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
|
|
|
if (!empty($has)) {
|
|
|
Yii::info("支付回调短时间内出现重复通知,流水类型:{$capitalType} orderSn:{$orderSn}");
|
|
|
- //noticeUtil::push("支付回调短时间内出现重复通知:流水类型:{$capitalType} orderSn:{$orderSn}", '15280215347');
|
|
|
return false;
|
|
|
}
|
|
|
Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 4, 'has']);
|
|
|
|
|
|
- //流水类型列表
|
|
|
- switch ($capitalType) {
|
|
|
- case dict::getDict('capitalType', 'xhRecharge', 'id'):
|
|
|
- //商家充值
|
|
|
- $currentRecharge = RechargeClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
|
|
|
-
|
|
|
- //有发红包的通知供货商
|
|
|
- WxMessageClass::customRechargeInformGhs($currentRecharge);
|
|
|
- $customName = $currentRecharge->customName ?? '';
|
|
|
- $rechargeAmount = $currentRecharge->amount ?? 0;
|
|
|
- $rechargeAmount = floatval($rechargeAmount);
|
|
|
- noticeUtil::push("客户 {$customName} 充值{$rechargeAmount}元", '15280215347');
|
|
|
- break;
|
|
|
- case dict::getDict('capitalType', 'xhPurchase', 'id'):
|
|
|
- //零售采购
|
|
|
- PurchaseService::thirdPay($payWay, $orderSn, $totalFee, $attach, $transactionId);
|
|
|
-
|
|
|
- $cg = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
|
|
|
- if (isset($cg->onlinePay) && $cg->onlinePay == dict::getDict('onlinePay', 'yes')) {
|
|
|
- $saleId = $cg->saleId ?? 0;
|
|
|
- $order = \bizGhs\order\classes\OrderClass::getById($saleId, true);
|
|
|
- if (isset($order->needPrint) && $order->needPrint == dict::getDict('needPrint', 'noNeed')) {
|
|
|
- $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);
|
|
|
- }
|
|
|
- }
|
|
|
- //app新订单通知
|
|
|
- NoticeClass::ghsNewOrderNotice($order);
|
|
|
- }
|
|
|
- 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, $transactionId);
|
|
|
-
|
|
|
- //播放收款声音
|
|
|
- ShopExtClass::hdGatheringReport($orderSn);
|
|
|
- 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:
|
|
|
- }
|
|
|
+ //流水类型列表
|
|
|
+ switch ($capitalType) {
|
|
|
+ case dict::getDict('capitalType', 'xhRecharge', 'id'):
|
|
|
+ //商家充值
|
|
|
+ $currentRecharge = RechargeClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
|
|
|
+
|
|
|
+ //有发红包的通知供货商
|
|
|
+ WxMessageClass::customRechargeInformGhs($currentRecharge);
|
|
|
+ $customName = $currentRecharge->customName ?? '';
|
|
|
+ $rechargeAmount = $currentRecharge->amount ?? 0;
|
|
|
+ $rechargeAmount = floatval($rechargeAmount);
|
|
|
+ noticeUtil::push("客户 {$customName} 充值{$rechargeAmount}元", '15280215347');
|
|
|
+ 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, $transactionId);
|
|
|
+ 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:
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|