shish 9 months ago
parent
commit
71f3550093
1 changed files with 0 additions and 45 deletions
  1. 0 45
      common/components/rabbitmq/informConsumer.php

+ 0 - 45
common/components/rabbitmq/informConsumer.php

@@ -1,45 +0,0 @@
-<?php
-/**
- * 通知的消费者
- * User: ssh <ssh@zhhinc.com>
- * Date: 2019/9/9 0009
- * Time: 14:54
- */
-
-namespace common\components\rabbitmq;
-
-use bizHd\message\services\InformAdminService;
-use bizHd\message\services\InformUserService;
-use mikemadisonweb\rabbitmq\components\ConsumerInterface;
-use PhpAmqpLib\Message\AMQPMessage;
-
-class informConsumer implements ConsumerInterface
-{
-	
-	/**
-	 * ConsumerInterface::MSG_ACK - Acknowledge message (mark as processed) and drop it from the queue
-	 * ConsumerInterface::MSG_REJECT - Reject and drop message from the queue
-	 * ConsumerInterface::MSG_REQUEUE - Reject and requeue message in RabbitMQ
-	 */
-	public function execute(AMQPMessage $msg)
-	{
-		$data = unserialize($msg->body);
-		print_r($data);
-//		return ConsumerInterface::MSG_ACK;
-		$userType = $data['userType'];
-		if ($userType == 'user') {
-//			$return = InformUserService::consumeInformQueue($data);
-//			if ($return) {
-//				return ConsumerInterface::MSG_ACK;
-//			}
-		}
-		if ($userType == 'admin') {
-			$return = InformAdminService::consumeInformQueue($data);
-			if ($return) {
-				return ConsumerInterface::MSG_ACK;
-			}
-		}
-		return ConsumerInterface::MSG_REQUEUE;
-	}
-	
-}