shish 4 лет назад
Родитель
Сommit
d04df44550
2 измененных файлов с 94 добавлено и 1 удалено
  1. 7 0
      biz/market/classes/TjFlClass.php
  2. 87 1
      biz/wx/classes/WxMessageClass.php

+ 7 - 0
biz/market/classes/TjFlClass.php

@@ -4,6 +4,8 @@ namespace biz\market\classes;
 
 use biz\base\classes\BaseClass;
 use biz\hb\classes\HbClass;
+use biz\shop\classes\ShopClass;
+use biz\wx\classes\WxMessageClass;
 
 class TjFlClass extends BaseClass
 {
@@ -24,6 +26,7 @@ class TjFlClass extends BaseClass
         $ghsAvatar = $ghs->avatar ?? '';
         $ghsSjId = $ghs->sjId ?? 0;
         $ghsShopId = $ghs->shopId ?? 0;
+        $ghsShop = ShopClass::getById($ghsShopId, true);
         $customId = $ghs->customId ?? 0;
 
         $customName = $custom->name ?? '';
@@ -34,6 +37,7 @@ class TjFlClass extends BaseClass
 
         $sjId = $custom->sjId ?? 0;
         $shopId = $custom->shopId ?? 0;
+        $hdShop = ShopClass::getById($shopId, true);
 
         foreach ($flData as $item) {
 
@@ -72,6 +76,9 @@ class TjFlClass extends BaseClass
             }
 
         }
+
+        WxMessageClass::ghsCustomTjGetGiftInform($ghsShop, $custom, $beTjCustom);
+        WxMessageClass::hdTjGhsCustomGetGiftInform($hdShop, $ghs, $beTjCustom);
     }
 
 }

+ 87 - 1
biz/wx/classes/WxMessageClass.php

@@ -658,6 +658,92 @@ class WxMessageClass extends BaseClass
         }
     }
 
+    //供货商的客户介绍新客并且下单,获得红包通知商家 shish 20211027
+    public static function ghsCustomTjGetGiftInform($shop, $custom, $beTjCustom)
+    {
+        $shopId = $shop->id ?? 0;
+        $ptStyle = $shop->ptStyle ?? 0;
+        $wxBase = WxOpenClass::getWxBase();
+        $wx = $wxBase[$ptStyle] ?? [];
+        $message = self::getAllByCondition(['ptStyle' => $ptStyle], null, '*', 'shortTemplateId');
+        $shortTempId = 'OPENTM408238177';
+        $tempId = isset($message[$shortTempId]['templateId']) ? $message[$shortTempId]['templateId'] : '';
+        if (empty($tempId)) {
+            return false;
+        }
+        $customId = $custom->id ?? 0;
+        $customName = $custom->name ?? '';
+        $beTjCustomName = $beTjCustom->name ?? '';
+        $adminList = ShopAdminClass::getRemainAdmin($shopId);
+        if (empty($adminList)) {
+            return false;
+        }
+
+        foreach ($adminList as $admin) {
+            $openId = isset($admin['openId']) ? $admin['openId'] : '';
+            if (empty($openId)) {
+                continue;
+            }
+            $data = [
+                "touser" => $openId,
+                "template_id" => $tempId,
+                "url" => Yii::$app->params['ghsDomain'],
+                "data" => [
+                    "first" => ["value" => $beTjCustomName . " 推荐的客户 {$customName} 下单" . "获得推荐新客红包", "color" => "#173177"],
+                    "keyword1" => ["value" => "推荐新客红包", "color" => "#173177"],
+                    "keyword2" => ["value" => "已领取", "color" => "#173177"],
+                    "remark" => ["value" => '点击查看客户', "color" => "#173177"]
+                ]
+            ];
+            $data['miniprogram']['appid'] = $wx['miniAppId'];
+            $data['miniprogram']['pagepath'] = 'pagesClient/member/detail?id=' . $customId;
+            wxUtil::sendTaskInform($data, $wx, $ptStyle);
+        }
+    }
+
+    //花店推荐供货商客户获得红包 shish 20211027
+    public static function hdTjGhsCustomGetGiftInform($shop, $ghs, $beTjCustom)
+    {
+        $shopId = $shop->id ?? 0;
+        $ptStyle = $shop->ptStyle ?? 0;
+        $wxBase = WxOpenClass::getWxBase();
+        $wx = $wxBase[$ptStyle] ?? [];
+        $message = self::getAllByCondition(['ptStyle' => $ptStyle], null, '*', 'shortTemplateId');
+        $shortTempId = 'OPENTM408238177';
+        $tempId = isset($message[$shortTempId]['templateId']) ? $message[$shortTempId]['templateId'] : '';
+        if (empty($tempId)) {
+            return false;
+        }
+        $beTjCustomName = $beTjCustom->name ?? '';
+        $ghsName = $ghs->name ?? '';
+
+        $adminList = ShopAdminClass::getRemainAdmin($shopId);
+        if (empty($adminList)) {
+            return false;
+        }
+
+        foreach ($adminList as $admin) {
+            $openId = isset($admin['openId']) ? $admin['openId'] : '';
+            if (empty($openId)) {
+                continue;
+            }
+            $data = [
+                "touser" => $openId,
+                "template_id" => $tempId,
+                "url" => Yii::$app->params['ghsDomain'],
+                "data" => [
+                    "first" => ["value" => "您推荐的客户 {$beTjCustomName} 在 {$ghsName} 下单" . "获得推荐新客红包", "color" => "#173177"],
+                    "keyword1" => ["value" => "推荐新客红包", "color" => "#173177"],
+                    "keyword2" => ["value" => "已获得", "color" => "#173177"],
+                    "remark" => ["value" => '点击查看客户', "color" => "#173177"]
+                ]
+            ];
+            $data['miniprogram']['appid'] = $wx['miniAppId'];
+            $data['miniprogram']['pagepath'] = 'admin/coupon/couponList';
+            wxUtil::sendTaskInform($data, $wx, $ptStyle);
+        }
+    }
+
     //供应商新客户通知 shish 20210909
     public static function newGhsCustomInform($shop, $custom, $introduce)
     {
@@ -681,7 +767,7 @@ class WxMessageClass extends BaseClass
         $first = '';
         if (!empty($introduce)) {
             $introName = $introduce->name ?? '';
-            $first = "客户由【{$introName}】介绍";
+            $first = "客户由【{$introName}】介绍";
         }
         foreach ($adminList as $admin) {
             $openId = isset($admin['openId']) ? $admin['openId'] : '';