shish před 4 roky
rodič
revize
822bfff9c0

+ 3 - 0
app-hd/controllers/NoticeController.php

@@ -2,6 +2,7 @@
 
 namespace hd\controllers;
 
+use biz\shop\classes\ShopExtClass;
 use bizGhs\order\classes\RefundOrderClass;
 use bizHd\cg\classes\CgRefundClass;
 use bizHd\wx\classes\WxOpenClass;
@@ -48,6 +49,8 @@ class NoticeController extends PublicController
             //支付成功后续流程
             payUtil::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
             $transaction->commit();
+            //花店采购供应商端播放声音
+            ShopExtClass::hdCgGhsReport($orderSn);
             echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
         } catch (\Exception $e) {
             $transaction->rollBack();

+ 5 - 0
app-mall/controllers/NoticeController.php

@@ -9,6 +9,7 @@ use common\components\payUtil;
 use Yii;
 use common\components\util;
 use common\components\dict;
+use biz\shop\classes\ShopExtClass;
 
 class NoticeController extends PublicController
 {
@@ -110,6 +111,10 @@ class NoticeController extends PublicController
             //支付成功后续流程
             payUtil::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach);
             $transaction->commit();
+
+            //播放收款声音
+            ShopExtClass::hdGatheringReport($orderSn);
+
             echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
         } catch (\Exception $e) {
             $transaction->rollBack();

+ 1 - 1
app-mall/controllers/OrderController.php

@@ -38,7 +38,7 @@ class OrderController extends BaseController
         $expireTime = $now + 1800;
         $post['deadline'] = $expireTime;
         //商城
-        $post['fromType'] = 2;
+        $post['fromType'] = dict::getDict('fromType', 'mall');
         $productJson = $post['product'] ?? '';
         if (empty($productJson) && empty($groupId)) {
             util::fail('请选择商品');

+ 2 - 0
biz-hd/order/classes/OrderClass.php

@@ -241,6 +241,7 @@ class OrderClass extends BaseClass
         $shopAdminId = $order->shopAdminId ?? 0;
         $shopAdminName = $order->shopAdminName ?? '';
         $sjId = $order->sjId;
+        $fromType = $order->fromType ?? 1;
         $event = !empty($shopAdminId) ? '员工开单' : '客户下单';
         $capital = [
             'capitalType' => $capitalType,
@@ -254,6 +255,7 @@ class OrderClass extends BaseClass
             'shopAdminId' => $shopAdminId,
             'shopAdminName' => $shopAdminName,
             'amount' => $realPrice,
+            'fromType' => $fromType,
             'mainId' => $mainId,
         ];
         ShopCapitalClass::addCapital($capital);

+ 27 - 0
biz/shop/classes/ShopExtClass.php

@@ -2,7 +2,9 @@
 
 namespace biz\shop\classes;
 
+use biz\notice\classes\NoticeClass;
 use bizHd\order\classes\OrderClass;
+use bizHd\purchase\classes\PurchaseClass;
 use common\components\dict;
 use linslin\yii2\curl;
 use biz\base\classes\BaseClass;
@@ -12,6 +14,31 @@ class ShopExtClass extends BaseClass
 
     public static $baseFile = '\biz\shop\models\ShopExt';
 
+    //花店采购供应商端播放声音
+    public static function hdCgGhsReport($orderSn)
+    {
+
+        $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);
+        }
+    }
+
     //零售花店收款声音播放 ssh 20220423
     public static function hdGatheringReport($orderSn)
     {

+ 36 - 66
common/components/payUtil.php

@@ -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:
+        }
 
     }
 

+ 2 - 1
sql.sql

@@ -1012,4 +1012,5 @@ ALTER TABLE xhGhs ADD mainId INT NOT NULL DEFAULT 0 COMMENT '中央id' AFTER `sh
 ALTER TABLE xhOrder ADD `getStaffId` INT NOT NULL DEFAULT 0 COMMENT '收款人id' AFTER `shopAdminName`;
 ALTER TABLE xhOrder ADD `getStaffName` VARCHAR(30) NOT NULL DEFAULT '' COMMENT '收款人名称' AFTER `getStaffId`;
 ALTER TABLE xhPlantCgItem ADD goodsSn CHAR(30) NOT NULL DEFAULT '' COMMENT '编号' AFTER `goodsId`;
-ALTER TABLE xhGoodsCategory CHANGE `goodsName` `name` VARCHAR(200) NOT NULL DEFAULT '' COMMENT '商品名称';
+ALTER TABLE xhGoodsCategory CHANGE `goodsName` `name` VARCHAR(200) NOT NULL DEFAULT '' COMMENT '商品名称';
+ALTER TABLE `xhShopCapital` ADD `ptStyle` TINYINT NOT NULL DEFAULT 1 COMMENT '平台类型' AFTER `mainId`;