shish 8 meses atrás
pai
commit
6860e93e2f
1 arquivos alterados com 21 adições e 78 exclusões
  1. 21 78
      common/components/rabbitmq/notifyConsumer.php

+ 21 - 78
common/components/rabbitmq/notifyConsumer.php

@@ -29,116 +29,59 @@ class notifyConsumer implements ConsumerInterface
             // 反序列化消息体
             $data = unserialize($msg->body);
             if (!is_array($data)) {
-                Yii::error("Invalid notify message format: {$msg->body}", 'rabbitmq.notify');
+                noticeUtil::push("通知的消费者报错:Invalid notify message format: {$msg->body}", '15280215347');
                 return ConsumerInterface::MSG_REJECT;
             }
             // 根据通知类型分发处理
             $type = $data['type'] ?? null;
             switch ($type) {
-                case 'order_new':
-                    $result = $this->handleNewOrderNotify($data);
+                case 'ghs_new_order':
+                    //供货商的新订单通知
+                    $result = $this->ghsNewOrder($data);
                     break;
-                case 'customer_new':
-                    $result = $this->handleNewCustomerNotify($data);
+                case 'hd_new_order':
+                    //花店的新订单通知
+                    $result = $this->hdNewOrder($data);
                     break;
-                case 'customer_recharge':
-                    $result = $this->handleCustomerRechargeNotify($data);
-                    break;
-                case 'customer_writeoff':
-                    $result = $this->handleCustomerWriteoffNotify($data);
-                    break;
-                case 'delivery_status':
-                    $result = $this->handleDeliveryStatusNotify($data);
+                case 'hd_new_cg_order':
+                    //花店的新采购单通知
+                    $result = $this->hdNewCgOrder($data);
                     break;
                 default:
-                    Yii::warning("Unknown notify type: {$type}", 'rabbitmq.notify');
+                    noticeUtil::push("通知的消费者提示:Unknown notify type: {$type}", '15280215347');
                     $result = false;
             }
-
             if ($result) {
-                Yii::info("Notify message processed successfully", 'rabbitmq.notify');
                 return ConsumerInterface::MSG_ACK;
             } else {
-                Yii::error("Notify message processing failed", 'rabbitmq.notify');
+                noticeUtil::push("通知的消费者提示:Notify message processing failed", '15280215347');
                 return ConsumerInterface::MSG_REQUEUE;
             }
-
         } catch (\Exception $e) {
-            Yii::error("Notify consumer exception: " . $e->getMessage(), 'rabbitmq.notify');
+            noticeUtil::push("Notify consumer exception: " . $e->getMessage(), '15280215347');
             return ConsumerInterface::MSG_REQUEUE;
         }
     }
 
-    /**
-     * 处理新订单通知
-     *
-     * @param array $data 消息数据,包含 order_id, customer_id 等
-     * @return bool 处理结果
-     */
-    private function handleNewOrderNotify($data)
+    private function ghsNewOrder($data)
     {
-        // TODO: 实现新订单通知业务逻辑
-        // 调用对应的 Service 或 Class 层处理
-        // 例如: 发送短信、推送通知、邮件等
         $msg = $data['msg'] ?? '';
         noticeUtil::push($msg, '15280215347');
         return true;
     }
 
-    /**
-     * 处理新客户通知
-     *
-     * @param array $data 消息数据,包含 customer_id 等
-     * @return bool 处理结果
-     */
-    private function handleNewCustomerNotify($data)
+    private function hdNewOrder($data)
     {
-        // TODO: 实现新客户通知业务逻辑
-        // 调用对应的 Service 或 Class 层处理
-        // 例如: 发送欢迎短信、邮件等
-        return true;
-    }
-
-    /**
-     * 处理客户充值通知
-     *
-     * @param array $data 消息数据,包含 customer_id, amount, recharge_no 等
-     * @return bool 处理结果
-     */
-    private function handleCustomerRechargeNotify($data)
-    {
-        // TODO: 实现客户充值通知业务逻辑
-        // 调用对应的 Service 或 Class 层处理
-        // 例如: 发送充值成功通知、更新余额等
-        return true;
-    }
-
-    /**
-     * 处理客户销账通知
-     *
-     * @param array $data 消息数据,包含 customer_id, amount, writeoff_no 等
-     * @return bool 处理结果
-     */
-    private function handleCustomerWriteoffNotify($data)
-    {
-        // TODO: 实现客户销账通知业务逻辑
-        // 调用对应的 Service 或 Class 层处理
-        // 例如: 发送销账成功通知、更新账户信息等
+        $msg = $data['msg'] ?? '';
+        noticeUtil::push($msg, '15280215347');
         return true;
     }
 
-    /**
-     * 处理配送状态变更通知
-     *
-     * @param array $data 消息数据,包含 order_id, status, status_desc 等
-     * @return bool 处理结果
-     */
-    private function handleDeliveryStatusNotify($data)
+    private function hdNewCgOrder($data)
     {
-        // TODO: 实现配送状态变更通知业务逻辑
-        // 调用对应的 Service 或 Class 层处理
-        // 例如: 发送配送状态更新通知
+        $msg = $data['msg'] ?? '';
+        noticeUtil::push($msg, '15280215347');
         return true;
     }
-}
 
+}