shish 3 vuotta sitten
vanhempi
commit
3cafd27212
2 muutettua tiedostoa jossa 48 lisäystä ja 0 poistoa
  1. 7 0
      app-hd/controllers/CgRefundController.php
  2. 41 0
      biz/wx/classes/WxMessageClass.php

+ 7 - 0
app-hd/controllers/CgRefundController.php

@@ -2,12 +2,14 @@
 
 namespace hd\controllers;
 
+use biz\wx\classes\WxMessageClass;
 use bizGhs\notify\classes\NotifyClass;
 use bizGhs\order\classes\RefundOrderClass;
 use bizHd\cg\classes\CgRefundClass;
 use bizHd\cg\classes\CgRefundItemClass;
 use bizHd\cg\services\CgRefundService;
 use bizHd\purchase\classes\PurchaseClass;
+use bizHd\shop\classes\ShopClass;
 use common\components\imgUtil;
 use Yii;
 use common\components\util;
@@ -112,6 +114,11 @@ class CgRefundController extends BaseController
             $saleRefund = RefundOrderClass::getById($saleRefundId, true);
             if (!empty($saleRefund)) {
                 NotifyClass::addRefundApplyNotify($saleRefund);
+                $saleShopId = $saleRefund->shopId ?? 0;
+                $saleShop = Shopclass::getById($saleShopId, true);
+                if (!empty($saleShop)) {
+                    WxMessageClass::ghsHasNewRefundApplyInform($saleShop, $saleRefund);
+                }
             }
 
             util::success($respond);

+ 41 - 0
biz/wx/classes/WxMessageClass.php

@@ -38,6 +38,7 @@ class WxMessageClass extends BaseClass
                 'OPENTM411530050' => '充值成功提醒',
                 'OPENTM408238177' => '反馈进度通知',
                 'OPENTM203447669' => '新客户加入通知',
+                'ZHH202308150025' => '退款申请处理通知',
             ],
             //供货商
             dict::getDict('ptStyle', 'ghs') => [
@@ -57,6 +58,7 @@ class WxMessageClass extends BaseClass
                 'OPENTM203447669' => '新客户加入通知',
                 'OPENTM411530050' => '充值成功提醒',
                 'OPENTM408238177' => '反馈进度通知',
+                'ZHH202308150025' => '退款申请处理通知',
             ],
             //商城
             dict::getDict('ptStyle', 'mall') => [
@@ -116,6 +118,45 @@ class WxMessageClass extends BaseClass
         }
     }
 
+    //供货商有新的退款申请 ssh 20230815
+    public static function ghsHasNewRefundApplyInform($shop, $refund)
+    {
+        $ptStyle = $shop->ptStyle;
+        $wxBase = WxOpenClass::getWxBase();
+        $wx = $wxBase[$ptStyle] ?? [];
+        $message = self::getAllByCondition(['ptStyle' => $ptStyle], null, '*', 'shortTemplateId');
+        $shortTempId = 'ZHH202308150025';
+        $tempId = isset($message[$shortTempId]['templateId']) ? $message[$shortTempId]['templateId'] : '';
+        if (empty($tempId)) {
+            return false;
+        }
+        $adminList = ShopAdminClass::getRemainAdmin($shop);
+        if (empty($adminList)) {
+            return false;
+        }
+        foreach ($adminList as $admin) {
+            $openId = isset($admin['openId']) ? $admin['openId'] : '';
+            if ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
+                $openId = isset($admin['ghsOpenId']) ? $admin['ghsOpenId'] : '';
+            }
+            $data = [
+                "touser" => $openId,
+                "template_id" => $tempId,
+                "url" => Yii::$app->params['ghsDomain'],
+                "data" => [
+                    "amount1" => ["value" => '10元'],
+                    "thing7" => ["value" => '张三'],
+                    "time10" => ["value" => '2022-02-30 11:21:30'],
+                    "thing2" => ["value" => '退货退款'],
+                    "character_string3" => ["value" => '2023060900000001'],
+                ]
+            ];
+            $data['miniprogram']['appid'] = $wx['miniAppId'];
+            $data['miniprogram']['pagepath'] = 'pagesOrder/detail?id=1';
+            wxUtil::sendTaskInform($data, $wx, $ptStyle);
+        }
+    }
+
     //供货商新订单通知 ssh 20210529
     public static function ghsHasNewOrderInform($shop, $order)
     {