shish %!s(int64=2) %!d(string=hai) anos
pai
achega
4c582c7bf2

+ 1 - 1
biz-ghs/order/classes/OrderClass.php

@@ -128,7 +128,7 @@ class OrderClass extends BaseClass
         if (empty($cgInfo)) {
             util::fail('没有找到采购信息');
         }
-        PurchaseClass::orderFh($cgInfo, $params, $allowRepeat);
+        PurchaseClass::orderFh($cgInfo, $params, $allowRepeat,true);
     }
 
     //订单发货子方法 ssh 20231119

+ 6 - 1
biz-hd/purchase/classes/PurchaseClass.php

@@ -77,8 +77,13 @@ class PurchaseClass extends BaseClass
     }
 
     //订单发货子方法 ssh 20231119
-    public static function orderFh($cg, $params, $allowRepeat = false)
+    public static function orderFh($cg, $params, $allowRepeat = false, $notice = false)
     {
+        if ($notice == true) {
+            $noticeText = json_encode(['id' => $cg->id]);
+            $noticeKey = "ghsKdNoticeHd";
+            Yii::$app->redis->executeCommand('LPUSH', [$noticeKey, $noticeText]);
+        }
         if ($cg->status == 3) {
             if ($allowRepeat == false) {
                 util::fail('订单已发货');

+ 22 - 0
console/controllers/MqController.php

@@ -2,6 +2,7 @@
 
 namespace console\controllers;
 
+use bizHd\purchase\classes\PurchaseClass;
 use bizHd\shop\classes\ShopClass;
 use biz\wx\classes\WxMessageClass;
 use yii\console\Controller;
@@ -32,4 +33,25 @@ class MqController extends Controller
         }
     }
 
+    //供货商开单通知花店 ssh 20231129
+    public function actionGhsKdNoticeHd()
+    {
+        $noticeKey = "ghsKdNoticeHd";
+        while ($count = Yii::$app->redis->executeCommand('LLEN', [$noticeKey])) {
+            $json = Yii::$app->redis->executeCommand('RPOP', [$noticeKey]);
+            if (!empty($json)) {
+                $arr = json_decode($json, true);
+                $id = $arr['id'] ?? 0;
+                if (!empty($id)) {
+                    $cg = PurchaseClass::getById($id, true);
+                    $shopId = $cg->shopId ?? 0;
+                    $shop = ShopClass::getById($shopId, true);
+                    if (!empty($shop)) {
+                        WxMessageClass::hdNewCgOrderInform($shop, $cg);
+                    }
+                }
+            }
+        }
+    }
+
 }