| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace common\components;
- use biz\renew\classes\RenewClass;
- use biz\wx\classes\WxMessageClass;
- use bizGhs\custom\classes\CustomRechargeClass;
- use bizHd\ljh\classes\LjhApplyClass;
- use bizHd\order\classes\OrderClass;
- use bizHd\order\classes\ScanPayClass;
- use bizHd\purchase\classes\PurchaseClearClass;
- use bizHd\purchase\services\PurchaseService;
- use bizHd\px\services\PxApplyService;
- use bizHd\recharge\classes\RechargeClass;
- use Yii;
- class payUtil
- {
- public static function thirdPay($payWay, $capitalType, $orderSn, $totalFee, $attach, $transactionId = '')
- {
- //4秒内不允许第三方重复通知
- $cacheKey = 'third_pay_' . $orderSn;
- $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
- if (!empty($has)) {
- Yii::info("支付回调短时间内出现重复通知,流水类型:{$capitalType} orderSn:{$orderSn}");
- return false;
- }
- Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 4, 'has']);
- //流水类型列表
- 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, $transactionId);
- break;
- case dict::getDict('capitalType', 'xhOrder', 'id'):
- //散客下单
- OrderClass::thirdPay($payWay, $orderSn, $totalFee, $attach, $transactionId);
- break;
- case dict::getDict('capitalType', 'scanPay', 'id'):
- //扫码付款
- ScanPayClass::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;
- case dict::getDict('capitalType', 'ljhApply', 'id'):
- //零交会报名
- LjhApplyClass::thirdPay($payWay, $orderSn, $totalFee, $attach, $transactionId);
- break;
- case dict::getDict('capitalType', 'customRechargeToGhs', 'id'):
- //客户向供货商充值销账
- CustomRechargeClass::thirdPay($payWay, $orderSn, $totalFee, $attach, $transactionId);
- break;
- default:
- }
- }
- }
|