shish před 8 měsíci
rodič
revize
fab950f496

+ 0 - 41
common/components/rabbitmq/commonConsumer.php

@@ -1,41 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: ssh <ssh@zhhinc.com>
- * Date: 2019/9/9 0009
- * Time: 14:54
- */
-
-namespace common\components\rabbitmq;
-
-use mikemadisonweb\rabbitmq\components\ConsumerInterface;
-use PhpAmqpLib\Message\AMQPMessage;
-
-class commonConsumer implements ConsumerInterface
-{
-	/**
-	 * @param AMQPMessage $msg
-	 * @return bool
-	 */
-	public function execute(AMQPMessage $msg)
-	{
-		$data = unserialize($msg->body);
-		print_r($data);
-		print_r('PrintMsgConsumer done! ');
-		
-		if ($data['status'] == 200) {
-			print_r('suceess ');
-			return ConsumerInterface::MSG_ACK;
-		} elseif ($data['status'] == 500) {
-			sleep(5);
-			print_r('faile ');
-			return ConsumerInterface::MSG_REQUEUE;
-		}
-		/**
-		 * 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
-		 */
-	}
-	
-}

+ 0 - 35
common/components/rabbitmq/importDataConsumer.php

@@ -1,35 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: ssh <ssh@zhhinc.com>
- * Date: 2019/9/9 0009
- * Time: 14:54
- */
-
-namespace common\components\rabbitmq;
-
-use mikemadisonweb\rabbitmq\components\ConsumerInterface;
-use PhpAmqpLib\Message\AMQPMessage;
-
-class importDataConsumer implements ConsumerInterface
-{
-
-	/**
-	 * 消费队列
-	 * @param AMQPMessage $msg
-	 * @return bool
-	 */
-	public function execute(AMQPMessage $msg)
-	{
-		$data = unserialize($msg->body);
-		print_r($data);
-        print_r('ImportDataConsumer done! ');
-
-		//有什么东西可以放到队列里去
-		//微信模板消息
-		//新商家注册后的开店流程
-
-		return ConsumerInterface::MSG_ACK;
-	}
-
-}

+ 0 - 37
common/components/rabbitmq/openShopInitConsumer.php

@@ -1,37 +0,0 @@
-<?php
-/**
- * 通知的消费者
- * User: ssh <ssh@zhhinc.com>
- * Date: 2019/9/9 0009
- * Time: 14:54
- */
-
-namespace common\components\rabbitmq;
-
-
-use biz\sj\services\MerchantService;
-use bizHd\wx\services\WxOpenService;
-use common\components\sms;
-use mikemadisonweb\rabbitmq\components\ConsumerInterface;
-use PhpAmqpLib\Message\AMQPMessage;
-
-class openShopInitConsumer implements ConsumerInterface
-{
-	
-	//开店初始化
-	public function execute(AMQPMessage $msg)
-	{
-		$data = unserialize($msg->body);
-		$sjId = isset($data['sjId']) ? $data['sjId'] : 0;
-		$return = MerchantService::openShopInit(['sjId' => $sjId]);
-		if ($return == false) {
-			//没有初始化成功短信通知管理员
-			$merchant = MerchantService::getMerchantById($sjId);
-			$name = $merchant['name'];
-			$adminMobile = WxOpenService::getAdminMobile();
-			sms::freeSend($adminMobile, "花店:{$name}({$sjId})初始化没有成功。", $merchant);
-		}
-		return ConsumerInterface::MSG_ACK;
-	}
-
-}

+ 0 - 41
common/components/rabbitmq/printMsgConsumer.php

@@ -1,41 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: ssh <ssh@zhhinc.com>
- * Date: 2019/9/9 0009
- * Time: 14:54
- */
-
-namespace common\components\rabbitmq;
-
-use mikemadisonweb\rabbitmq\components\ConsumerInterface;
-use PhpAmqpLib\Message\AMQPMessage;
-
-class printMsgConsumer implements ConsumerInterface
-{
-	/**
-	 * @param AMQPMessage $msg
-	 * @return bool
-	 */
-	public function execute(AMQPMessage $msg)
-	{
-		$data = unserialize($msg->body);
-		print_r($data);
-        print_r('PrintMsgConsumer done! ');
-
-        if($data['status'] == 200){
-            print_r('suceess ');
-            return ConsumerInterface::MSG_ACK;
-        }elseif($data['status'] == 500){
-            sleep(5);
-            print_r('faile ');
-            return ConsumerInterface::MSG_REQUEUE;
-        }
-		/**
-         * 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
-         */
-	}
-
-}