Просмотр исходного кода

Merge branch 'master' into zhongqi-delivery

shish 8 месяцев назад
Родитель
Сommit
10097de1a7

+ 2 - 2
app-ghs/controllers/CustomController.php

@@ -681,7 +681,7 @@ class CustomController extends BaseController
                 $producer = Yii::$app->rabbitmq->getProducer('customProducer');
                 $msg = serialize(['type' => 'add_custom', 'name' => $name, 'mobile' => $mobile, 'sjId' => $this->sjId,
                     'shopId' => $this->shop->id, 'sjName' => $this->sj->name, 'staffId' => $this->shopAdminId]);
-                $producer->publish($msg, 'customExchange', 'customRoute');
+                $producer->publish($msg, 'customExchange', 'customRoute',['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
             } catch (\Exception $e) {
                 $msg = $e->getMessage();
                 $remind = "供货商创建新客户,生产消息报错 {$name} {$mobile} {$this->sj->name} {$msg}";
@@ -730,7 +730,7 @@ class CustomController extends BaseController
         try {
             $producer = Yii::$app->rabbitmq->getProducer('customProducer');
             $msg = serialize(['type' => 'pull_custom_from_other_shop', 'toShopId' => $toShopId, 'fromShopId' => $fromShopId]);
-            $producer->publish($msg, 'customExchange', 'customRoute');
+            $producer->publish($msg, 'customExchange', 'customRoute',['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
         } catch (\Exception $e) {
             $msg = $e->getMessage();
             $remind = "供货商拉取其他门店客户,生产消息报错 {$toShopId} {$fromShopId} {$msg}";

+ 3 - 8
app-ghs/controllers/TestController.php

@@ -45,14 +45,9 @@ class TestController extends BaseController
 
     public function actionRabbit()
     {
-        try{
-            GhsNotifyClass::newOrderNotify(3414434);
-            HdNotifyClass::newCgNotify(3456923);
-        }catch (\Exception $e){
-            $msg = $e->getMessage();
-            noticeUtil::push($msg, '15280215347');
-        }
-        echo '执行到了结束';
+        $producer = Yii::$app->rabbitmq->getProducer('stockProducer');
+        $msg = serialize(['type' => 'add', 'name' => 'shish']);
+        $producer->publish($msg, 'stockExchange', 'stockRoute', ['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
     }
 
     public function actionFx()

+ 0 - 7
app-pt/controllers/WxOpenController.php

@@ -241,13 +241,6 @@ class WxOpenController extends PublicController
                 xhMerchantService::updateById($id, $wxData);
                 MerchantExtendClass::updateByCondition(['sjId' => $id], ['wxAppId' => $authorizeAppId, 'wxAuth' => 1]);
 
-                //还没有完成初始化先进行初始化
-                if (isset($sjWxInfo['init']) && $sjWxInfo['init'] == 0) {
-                    $data = ['sjId' => $id];
-                    $producer = Yii::$app->rabbitmq->getProducer('openShopInitProducer');
-                    $msg = serialize($data);
-                    $producer->publish($msg, 'openShopInitExchange', 'openShopInitRoute');
-                }
                 echo 'ok';
             }
         }

+ 1 - 5
biz-hd/message/classes/InformAdminClass.php

@@ -67,11 +67,7 @@ class InformAdminClass extends BaseClass
         $data = array_merge($data, $respond);
 
         self::consumeInformQueue($data);
-
-//        $producer = Yii::$app->rabbitmq->getProducer('informProducer');
-//        $msg = serialize($data);
-//        $producer->publish($msg, 'informExchange', 'informRoute');
-
+        return true;
     }
 
     //宝贝售出提醒 ssh 2020.5.31

+ 1 - 4
biz-mall/message/classes/InformAdminClass.php

@@ -68,10 +68,7 @@ class InformAdminClass extends BaseClass
 
         self::consumeInformQueue($data);
 
-//        $producer = Yii::$app->rabbitmq->getProducer('informProducer');
-//        $msg = serialize($data);
-//        $producer->publish($msg, 'informExchange', 'informRoute');
-
+        return true;
     }
 
     //宝贝售出提醒 ssh 2020.5.31

+ 1 - 1
biz/common/classes/GhsNotifyClass.php

@@ -15,7 +15,7 @@ class GhsNotifyClass extends BaseClass
         try {
             $producer = Yii::$app->rabbitmq->getProducer('notifyProducer');
             $msg = serialize(['type' => 'ghs_new_order_notify', 'orderId' => $orderId]);
-            $producer->publish($msg, 'notifyExchange', 'notifyRoute');
+            $producer->publish($msg, 'notifyExchange', 'notifyRoute',['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
         } catch (\Exception $e) {
             $msg = $e->getMessage();
             $remind = "供货商新订单通知,生产消息报错 {$orderId} {$msg}";

+ 2 - 2
biz/common/classes/HdNotifyClass.php

@@ -14,7 +14,7 @@ class HdNotifyClass extends BaseClass
         try {
             $producer = Yii::$app->rabbitmq->getProducer('notifyProducer');
             $msg = serialize(['type' => 'hd_new_order_notify', 'orderId' => $orderId]);
-            $producer->publish($msg, 'notifyExchange', 'notifyRoute');
+            $producer->publish($msg, 'notifyExchange', 'notifyRoute',['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
         } catch (\Exception $e) {
             $msg = $e->getMessage();
             $remind = "花店新订单通知,生产消息报错 {$orderId} {$msg}";
@@ -27,7 +27,7 @@ class HdNotifyClass extends BaseClass
         try {
             $producer = Yii::$app->rabbitmq->getProducer('notifyProducer');
             $msg = serialize(['type' => 'hd_new_cg_notify', 'cgId' => $cgId]);
-            $producer->publish($msg, 'notifyExchange', 'notifyRoute');
+            $producer->publish($msg, 'notifyExchange', 'notifyRoute',['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
         } catch (\Exception $e) {
             $msg = $e->getMessage();
             $remind = "花店新采购单通知,生产消息报错 {$cgId} {$msg}";

+ 0 - 1
common/components/rabbitmq/customConsumer.php

@@ -48,7 +48,6 @@ class customConsumer implements ConsumerInterface
                     noticeUtil::push("客户的消费者报错,不存在的类型: {$type}");
                     $result = false;
             }
-
             if ($result) {
                 return ConsumerInterface::MSG_ACK;
             } else {

+ 2 - 0
common/components/rabbitmq/stockConsumer.php

@@ -38,6 +38,8 @@ class stockConsumer implements ConsumerInterface
             switch ($type) {
                 case 'add':
                     $result = true;
+                    echo '持久化OK---';
+                    print_r($data);
                     break;
                 default:
                     noticeUtil::push("库存的消费者报错,未知 type: {$type}");

+ 7 - 23
common/config/rabbitMQ.php

@@ -20,18 +20,17 @@ $rabbitMQ = [
         [
             'name' => 'customExchange',
             'type' => 'direct',
+            'durable' => true,
         ],
         [
             'name' => 'stockExchange',
             'type' => 'direct',
+            'durable' => true,
         ],
         [
             'name' => 'notifyExchange',
             'type' => 'direct',
-        ],
-        [
-            'name' => 'ex1',
-            'type' => 'direct'
+            'durable' => true,
         ]
     ],
 
@@ -39,21 +38,20 @@ $rabbitMQ = [
      * 队列
      */
     'queues' => [
-        [
-            'name' => 'queues1',
-            'passive' => false,
-        ],
         [
             'name' => 'customQueue',
             'passive' => false,
+            'durable' => true,
         ],
         [
             'name' => 'stockQueue',
             'passive' => false,
+            'durable' => true,
         ],
         [
             'name' => 'notifyQueue',
             'passive' => false,
+            'durable' => true,
         ],
     ],
 
@@ -76,12 +74,7 @@ $rabbitMQ = [
             'queue' => 'notifyQueue',
             'exchange' => 'notifyExchange',
             'routing_keys' => ['notifyRoute'],
-        ],
-        [
-            'queue' => 'queues1',
-            'exchange' => 'ex1',
-            'routing_keys' => ['route1'],
-        ],
+        ]
     ],
 
     /**
@@ -99,9 +92,6 @@ $rabbitMQ = [
         [
             //通知生产者
             'name' => 'notifyProducer',
-        ],
-        [
-            'name' => 'importDataProducer',
         ]
     ],
 
@@ -129,12 +119,6 @@ $rabbitMQ = [
             'callbacks' => [
                 'notifyQueue' => '\common\components\rabbitmq\notifyConsumer',
             ]
-        ],
-        [
-            'name' => 'importDataConsumer',
-            'callbacks' => [
-                'queues1' => '\common\components\rabbitmq\importDataConsumer',
-            ],
         ]
     ],
 ];