Kaynağa Gözat

消息队列

shish 3 yıl önce
ebeveyn
işleme
0d18cc401d

+ 4 - 1
app-ghs/controllers/OrderController.php

@@ -1068,7 +1068,10 @@ class OrderController extends BaseController
                 $shop = ShopClass::getById($shopId, true);
                 if (!empty($shop)) {
                     //花店采购供货商端收到微信通知
-                    WxMessageClass::ghsHasNewOrderInform($shop, $order);
+                    //WxMessageClass::ghsHasNewOrderInform($shop, $order);
+                    $noticeText = json_encode(['shopId' => $shopId, 'orderId' => $saleId]);
+                    $noticeKey = "hdCgNoticeGhs";
+                    Yii::$app->redis->executeCommand('LPUSH', [$noticeKey, $noticeText]);
                 }
                 //订单生成时唤起在线打印
                 if (isset($order->needPrint) && $order->needPrint == dict::getDict('needPrint', 'need')) {

+ 22 - 0
console/controllers/MessageController.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace console\controllers;
+
+use yii\console\Controller;
+use Yii;
+
+class MessageController extends Controller
+{
+
+    //花店采购通知供货商 ssh 20230805
+    public function actionHdCgNoticeGhs()
+    {
+        $noticeKey = "hdCgNoticeGhs";
+        $json = Yii::$app->redis->executeCommand('RPOP', [$noticeKey]);
+        if (!empty($json)) {
+            $arr = json_decode($json, true);
+            print_r($arr);
+        }
+    }
+
+}