完成
This commit is contained in:
@@ -17,7 +17,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
use support\Log;
|
||||
use Webman\RedisQueue\Redis;
|
||||
|
||||
// 申请新短信模版
|
||||
// 申请新短信模版/营销短信发送
|
||||
class ApplySmsTemp extends Command
|
||||
{
|
||||
protected static $defaultName = 'applysmstemp';
|
||||
@@ -73,11 +73,25 @@ class ApplySmsTemp extends Command
|
||||
]);
|
||||
|
||||
$callback = function ($msg) use ($queue){
|
||||
$date_time = date('Y-m-d H:i:s');
|
||||
$data = $msg->body;
|
||||
Log::info('MQ收到消息[申请新短信模版]--->' . $data . '--->' . $date_time . "\n");
|
||||
// 发给队列
|
||||
Redis::send('apply.sms.temp', $data);
|
||||
Log::info('MQ收到消息[申请新短信模版/营销短信发送/微信模版消息]--->' . $data . "\n");
|
||||
$arr = explode(',', $data);
|
||||
if(is_array($arr)) {
|
||||
$type = $arr[2];
|
||||
if($type == 'applySmsTemp') {
|
||||
// 发给队列 短信模版审核
|
||||
Redis::send('apply.sms.temp', $data);
|
||||
}elseif ($type == 'sendMarkSms') {
|
||||
// 发给队列 营销短信发送
|
||||
Redis::send('send.mark.sms', $data);
|
||||
}elseif ($type == 'sendWechatTemp') {
|
||||
// 发给队列 发送微信模版消息
|
||||
Redis::send('send.wechat.temp', $data);
|
||||
}
|
||||
}else {
|
||||
Log::info('MQ收到消息[申请新短信模版/营销短信发送/微信模版消息]格式错误');
|
||||
return false;
|
||||
}
|
||||
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
|
||||
};
|
||||
$rabbit_channel->basic_consume($queue, '', false, false, false, false, $callback);
|
||||
|
||||
Reference in New Issue
Block a user