Explorar o código

Merge branch 'master' into dev

shish hai 11 meses
pai
achega
b01a30e765

+ 8 - 0
app-ghs/controllers/ShopController.php

@@ -443,6 +443,14 @@ class ShopController extends BaseController
             if ($mainId == 1459 && $adminId == 2812) {
                 util::fail('收银专用账号,不允许切换门店');
             }
+            //淘花里中山店
+            if ($mainId == 16948 && $adminId == 17908) {
+                util::fail('收银专用账号,不允许切换门店');
+            }
+            //淘花里小榄店
+            if ($mainId == 72057 && $adminId == 69792) {
+                util::fail('收银专用账号,不允许切换门店');
+            }
         }
 
         $shopAdmin = $this->shopAdmin;

+ 8 - 0
app-hd/controllers/ShopController.php

@@ -216,6 +216,14 @@ class ShopController extends BaseController
             if ($mainId == 1459 && $adminId == 2812) {
                 util::fail('收银专用账号,不允许切换门店');
             }
+            //淘花里中山店
+            if ($mainId == 16948 && $adminId == 17908) {
+                util::fail('收银专用账号,不允许切换门店');
+            }
+            //淘花里小榄店
+            if ($mainId == 72057 && $adminId == 69792) {
+                util::fail('收银专用账号,不允许切换门店');
+            }
         }
 
         $shopAdmin = $this->shopAdmin;

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

@@ -183,6 +183,12 @@ class NoticeController extends PublicController
                 if (empty($has)) {
                     Yii::$app->redis->executeCommand('SETEX', [$myKey, 864000, 'has']);
                     $scan = ScanPayClass::getByCondition(['orderSn' => $orderSn], true);
+
+                    //微信通知
+                    $shopId = $scan->shopId ?? 0;
+                    $shop = ShopClass::getById($shopId, true);
+                    WxMessageClass::hdScanPayInform($shop, $scan);
+
                     ShopExtClass::hdScanPayReport($scan);
                 }
             }
@@ -499,6 +505,12 @@ class NoticeController extends PublicController
                     if (empty($has)) {
                         Yii::$app->redis->executeCommand('SETEX', [$myKey, 864000, 'has']);
                         $scan = ScanPayClass::getByCondition(['orderSn' => $orderSn], true);
+
+                        //微信通知
+                        $shopId = $scan->shopId ?? 0;
+                        $shop = ShopClass::getById($shopId, true);
+                        WxMessageClass::hdScanPayInform($shop, $scan);
+
                         ShopExtClass::hdScanPayReport($scan);
                     }
                 }

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

@@ -755,6 +755,51 @@ class WxMessageClass extends BaseClass
         }
     }
 
+    public static function hdScanPayInform($shop, $scan)
+    {
+        if (empty($shop)) {
+            return false;
+        }
+        $ptStyle = $shop->ptStyle;
+        $wxBase = WxOpenClass::getWxBase();
+        $wx = $wxBase[$ptStyle] ?? [];
+        $message = self::getAllByCondition(['ptStyle' => $ptStyle], null, '*', 'shortTemplateId');
+        $shortTempId = 'OPENTM207422813';//收入提醒
+        $tempId = $message[$shortTempId]['templateId'] ?? '';
+        if (empty($tempId)) {
+            return false;
+        }
+        $actPrice = $scan->actPrice;
+        $adminList = ShopAdminClass::getRemainAdmin($shop);
+        if (empty($adminList)) {
+            return false;
+        }
+        foreach ($adminList as $admin) {
+            $openId = $admin['openId'] ?? '';
+            if ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
+                $openId = $admin['ghsOpenId'] ?? '';
+            }
+            if (empty($openId)) {
+                continue;
+            }
+            $data = [
+                "touser" => $openId,
+                "template_id" => $tempId,
+                "url" => Yii::$app->params['ghsDomain'],
+                "data" => [
+                    "first" => ["value" => "您有新的收入。", "color" => "#173177"],
+                    "keyword1" => ["value" => $actPrice, "color" => "#173177"],
+                    "keyword2" => ["value" => '门店收入', "color" => "#173177"],
+                    "keyword3" => ["value" => date("Y-m-d H:i"), "color" => "#173177"],
+                    "remark" => ["value" => "点击查看详情", "color" => "#173177"]
+                ]
+            ];
+            $data['miniprogram']['appid'] = $wx['miniAppId'];
+            $data['miniprogram']['pagepath'] = 'admin/order/scanPay';
+            wxUtil::sendTaskInform($data, $wx, $ptStyle);
+        }
+    }
+
     //审核通过通知 ssh 20210530
     public static function applyPass($shop)
     {