| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- /**
- * 通知的消费者
- * User: shish <shish@zhhinc.com>
- * Date: 2019/9/9 0009
- * Time: 14:54
- */
- namespace common\components\rabbitmq\consumer;
- use biz\merchant\services\MerchantService;
- use common\components\sms;
- use mikemadisonweb\rabbitmq\components\ConsumerInterface;
- use PhpAmqpLib\Message\AMQPMessage;
- class openShopInitConsumer implements ConsumerInterface
- {
-
- //开店初始化
- public function execute(AMQPMessage $msg)
- {
- echo 'aaa';
- $data = unserialize($msg->body);
- $merchantId = isset($data['merchantId']) ? $data['merchantId'] : 0;
- $return = MerchantService::openShopInit(['merchantId' => $merchantId]);
- if ($return == false) {
- //没有初始化成功短信通知管理员
- $merchant = MerchantService::getMerchantById($merchantId);
- $merchantName = $merchant['merchantName'];
- sms::freeSend(15280215347, "花店:{$merchantName}({$merchantId})初始化没有成功。", $merchant);
- }
- print_r($data);
- //return ConsumerInterface::MSG_REQUEUE;
- return ConsumerInterface::MSG_ACK;
- }
-
- }
|