Quellcode durchsuchen

收款播放声音

shish vor 5 Jahren
Ursprung
Commit
c7ac393946
2 geänderte Dateien mit 26 neuen und 3 gelöschten Zeilen
  1. 1 0
      biz-ghs/ws/services/WsService.php
  2. 25 3
      common/components/payUtil.php

+ 1 - 0
biz-ghs/ws/services/WsService.php

@@ -19,6 +19,7 @@ class WsService
     //到账通知 $adminId 为 shopAdminId
     public static function arrivalNotice($adminId, $money, $payWay)
     {
+        //暂时关闭通知,请勿打开 shish 20210726
         return true;
         $payment = $payWay == dict::getDict('payWay', 'alipay') ? '支付宝' : '微信';
         $msg = $payment . '收款' . $money . '元';

+ 25 - 3
common/components/payUtil.php

@@ -4,11 +4,13 @@ namespace common\components;
 
 use biz\recharge\classes\RechargeClass;
 use biz\renew\classes\RenewClass;
+use biz\shop\classes\ShopExtClass;
 use bizHd\order\classes\OrderClass;
 use bizHd\purchase\classes\PurchaseClearClass;
 use bizHd\purchase\services\PurchaseService;
 use bizHd\px\services\PxApplyService;
 use Yii;
+use linslin\yii2\curl;
 
 class payUtil
 {
@@ -16,14 +18,15 @@ class payUtil
     public static function thirdPay($payWay, $capitalType, $orderSn, $totalFee, $attach, $transactionId = '')
     {
 
-        //2秒内不允许第三方重复通知
+        //3秒内不允许第三方重复通知
         $cacheKey = 'third_pay_' . $orderSn;
         $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
         if (!empty($has)) {
-            Yii::info("第三方2秒内重复通知:{$capitalType} {$orderSn}");
+            Yii::info("第三方3秒内重复通知:{$capitalType} {$orderSn}");
+            noticeUtil::push("第三方支付回调,3秒内重复通知:{$capitalType} {$orderSn}", '15280215347');
             return false;
         }
-        Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 2, 'has']);
+        Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 3, 'has']);
 
 
         $connection = Yii::$app->db;
@@ -60,6 +63,25 @@ class payUtil
             }
 
             $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 = $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();