Explorar el Código

Merge branch 'master' into zhongqi-delivery

shish hace 7 meses
padre
commit
1bf81aec49

+ 16 - 2
biz/common/classes/GhsNotifyClass.php

@@ -15,10 +15,24 @@ 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',['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
+            $producer->publish($msg, 'notifyExchange', 'notifyRoute', ['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
         } catch (\Exception $e) {
             $msg = $e->getMessage();
-            $remind = "供货商新订单通知,生产消息报错 {$orderId} {$msg}";
+            $remind = "批发,新订单通知,生产消息端报错 {$orderId} {$msg}";
+            noticeUtil::push($remind, '15280215347');
+        }
+    }
+
+    //跑腿异常通知
+    public static function ptErrorNotify($orderId, $event)
+    {
+        try {
+            $producer = Yii::$app->rabbitmq->getProducer('notifyProducer');
+            $msg = serialize(['type' => 'ghs_pt_error', 'orderId' => $orderId, 'event' => $event]);
+            $producer->publish($msg, 'notifyExchange', 'notifyRoute', ['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
+        } catch (\Exception $e) {
+            $msg = $e->getMessage();
+            $remind = "批发,跑腿异常通知,生产消息端报错 {$orderId} {$msg}";
             noticeUtil::push($remind, '15280215347');
         }
     }

+ 17 - 4
biz/common/classes/HdNotifyClass.php

@@ -14,10 +14,10 @@ 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',['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
+            $producer->publish($msg, 'notifyExchange', 'notifyRoute', ['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
         } catch (\Exception $e) {
             $msg = $e->getMessage();
-            $remind = "花店新订单通知,生产消息报错 {$orderId} {$msg}";
+            $remind = "零售,新订单通知,生产消息端报错 {$orderId} {$msg}";
             noticeUtil::push($remind, '15280215347');
         }
     }
@@ -27,10 +27,23 @@ 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',['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
+            $producer->publish($msg, 'notifyExchange', 'notifyRoute', ['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
         } catch (\Exception $e) {
             $msg = $e->getMessage();
-            $remind = "花店新采购单通知,生产消息报错 {$cgId} {$msg}";
+            $remind = "零售,新采购单通知,生产消息端报错 {$cgId} {$msg}";
+            noticeUtil::push($remind, '15280215347');
+        }
+    }
+
+    public static function ptErrorNotify($orderId, $event)
+    {
+        try {
+            $producer = Yii::$app->rabbitmq->getProducer('notifyProducer');
+            $msg = serialize(['type' => 'hd_pt_error', 'orderId' => $orderId, 'event' => $event]);
+            $producer->publish($msg, 'notifyExchange', 'notifyRoute', ['delivery_mode' => 2, 'content_type' => 'application/octet-stream']);
+        } catch (\Exception $e) {
+            $msg = $e->getMessage();
+            $remind = "零售,跑腿异常通知,生产消息端报错 {$orderId} {$msg}";
             noticeUtil::push($remind, '15280215347');
         }
     }

+ 0 - 8
common/components/bookHd.php

@@ -17,8 +17,6 @@ class bookHd
             ['title' => '添加修改分类', 'id' => 'hd_category'],
             ['title' => '花束和分类的排序', 'id' => 'hd_order'],
             ['title' => '分享相册和商城', 'id' => 'hd_share'],
-            ['title' => '自动计算跑腿费', 'id' => 'hd_auto_calc_send_cost'],
-            ['title' => '一键发跑腿', 'id' => 'hd_one_key_send'],
             ['title' => '搞充值活动', 'id' => 'hd_recharge'],
             ['title' => '登记客户生日', 'id' => 'hd_birthday'],
             ['title' => '收款码', 'id' => 'hd_gathering_code'],
@@ -56,12 +54,6 @@ class bookHd
         'hd_share' => [
             ['style' => 'video', 'value' => 'jc/hd_share.mp4'],
         ],
-        'hd_auto_calc_send_cost' => [
-            ['style' => 'video', 'value' => 'jc/hd_auto_calc_send_cost.mp4'],
-        ],
-        'hd_one_key_send' => [
-            ['style' => 'video', 'value' => 'jc/hd_one_key_send.mp4'],
-        ],
         'hd_recharge' => [
             ['style' => 'video', 'value' => 'jc/hd_recharge.mp4'],
         ],

+ 0 - 8
common/components/bookPfHd.php

@@ -17,8 +17,6 @@ class bookPfHd
             ['title' => '添加修改分类', 'id' => 'hd_category'],
             ['title' => '花束和分类的排序', 'id' => 'hd_order'],
             ['title' => '分享相册和商城', 'id' => 'hd_share'],
-            ['title' => '自动计算跑腿费', 'id' => 'hd_auto_calc_send_cost'],
-            ['title' => '一键发跑腿', 'id' => 'hd_one_key_send'],
             ['title' => '搞充值活动', 'id' => 'hd_recharge'],
             ['title' => '登记客户生日', 'id' => 'hd_birthday'],
             ['title' => '收款码', 'id' => 'hd_gathering_code'],
@@ -56,12 +54,6 @@ class bookPfHd
         'hd_share' => [
             ['style' => 'video', 'value' => 'jc/hd_share.mp4'],
         ],
-        'hd_auto_calc_send_cost' => [
-            ['style' => 'video', 'value' => 'jc/hd_auto_calc_send_cost.mp4'],
-        ],
-        'hd_one_key_send' => [
-            ['style' => 'video', 'value' => 'jc/hd_one_key_send.mp4'],
-        ],
         'hd_recharge' => [
             ['style' => 'video', 'value' => 'jc/hd_recharge.mp4'],
         ],

+ 26 - 0
common/components/rabbitmq/notifyConsumer.php

@@ -54,6 +54,14 @@ class notifyConsumer implements ConsumerInterface
                     //花店的新采购单通知
                     $result = $this->hdNewCgNotify($data);
                     break;
+                case 'ghs_pt_error':
+                    //供货商跑腿异常通知
+                    $result = $this->ghsPtErrorAction($data);
+                    break;
+                    break;
+                case 'hd_pt_error':
+                    //花店跑腿异常通知
+                    break;
                 default:
                     noticeUtil::push("通知的消费者提示:Unknown notify type: {$type}", '15280215347');
                     $result = false;
@@ -70,6 +78,24 @@ class notifyConsumer implements ConsumerInterface
         }
     }
 
+    private function ghsPtErrorAction($data)
+    {
+        $orderId = $data['orderId'] ?? 0;
+        $event = $data['event'] ?? '';
+        $order = OrderClass::getById($orderId, true);
+        if (!empty($order)) {
+            $sendNum = $order->sendNum ?? '';
+            $result = $event . ',取货号:' . $sendNum;
+            $customName = $order->customName ?? '';
+            $shopId = $order->shopId ?? '';
+            $shop = ShopClass::getById($shopId, true);
+            if (!empty($shop)) {
+                WxMessageClass::expressErrorInform($shop, $customName, $orderId, $result);
+            }
+        }
+        return true;
+    }
+
     private function ghsNewOrderNotify($data)
     {
         $orderId = $data['orderId'] ?? 0;