shish il y a 3 ans
Parent
commit
d1948a124e
1 fichiers modifiés avec 31 ajouts et 7 suppressions
  1. 31 7
      biz/shop/classes/ShopExtClass.php

+ 31 - 7
biz/shop/classes/ShopExtClass.php

@@ -16,17 +16,41 @@ class ShopExtClass extends BaseClass
 
     public static function orderCancelRemind($shopExt, $order)
     {
-        $lbSn = $order->fromType == 4 ? $shopExt->mtLbSn : $shopExt->makeLbSn;
-        $lbVersion = $order->fromType == 4 ? $shopExt->mtLbVersion : $shopExt->makeLbVersion;
         $sendNum = $order->sendNum ?? 0;
         $sound = $sendNum . '号单已被取消';
         if ($order->fromType == 4) {
             $mtSn = $order->thirdSn ?? 0;
             $sound = '美团' . $mtSn . '号单已被取消';
         }
-        $url = "https://speaker.17laimai.cn/notify.php?id={$lbSn}&token=HK1626595800&version={$lbVersion}&message=" . $sound;
-        $curl = new curl\Curl();
-        $curl->get($url);
+        $hasSh = 0;
+        $hasHs = 0;
+        $workList = WorkClass::getAllByCondition(['orderId' => $order->id], null, '*', null, true);
+        if (!empty($workList)) {
+            foreach ($workList as $work) {
+                if ($work->status == 2) {
+                    $sh = $work->sh ?? 0;
+                    if ($sh == 0) {
+                        $hasHs = 1;
+                    } else {
+                        $hasSh = 1;
+                    }
+                }
+            }
+        }
+        if ($hasHs == 1) {
+            $lbSn = $order->fromType == 4 ? $shopExt->mtLbSn : $shopExt->makeLbSn;
+            $lbVersion = $order->fromType == 4 ? $shopExt->mtLbVersion : $shopExt->makeLbVersion;
+            $url = "https://speaker.17laimai.cn/notify.php?id={$lbSn}&token=HK1626595800&version={$lbVersion}&message=" . $sound;
+            $curl = new curl\Curl();
+            $curl->get($url);
+        }
+        if ($hasSh == 1) {
+            $lbSn = $shopExt->lbSn ?? '';
+            $lbVersion = $shopExt->lbVersion;
+            $url = "https://speaker.17laimai.cn/notify.php?id={$lbSn}&token=HK1626595800&version={$lbVersion}&message=" . $sound;
+            $curl = new curl\Curl();
+            $curl->get($url);
+        }
     }
 
     //新的制作单提示
@@ -57,8 +81,8 @@ class ShopExtClass extends BaseClass
                 }
             }
             if ($sh == 1) {
-                $lbSn = $shopExt->lbSn??'';
-                $lbVersion = $shopExt->lbVersion??'';
+                $lbSn = $shopExt->lbSn ?? '';
+                $lbVersion = $shopExt->lbVersion ?? '';
                 if (!empty($lbSn)) {
                     $sound = "您有新的散花订单";
                     $reachDate = $order->reachDate ?? '';