hospital-applets-api/app/Amqp/Producer/SendSubMessageProducer.php

47 lines
1.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types=1);
namespace App\Amqp\Producer;
use App\Model\SubTemplate;
use Hyperf\Amqp\Annotation\Producer;
use Hyperf\Amqp\Message\ProducerMessage;
/**
* 订阅消息推送
*/
#[Producer(exchange: 'amqp.direct', routingKey: 'SendSubMessage')]
class SendSubMessageProducer extends ProducerMessage
{
/**
* @param array $data
* [
* "sub_data" => [
* "push_user_id" // 用户id被推送者
* "wx_template_id" // 推送的模版id
* "params" => [ // 推送所需的参数
* "page" // 跳转页面
* "data" => [
* "key1" => "value1" // 入参数据结构
* ]
* ],
* ]
* "sms_data" => [ // 短信所需的参数,如订阅发送失败需发送短信
* "template_code" => "SMS_123",
* "template_param" => [
* // 参数不确定,主要看短信模版的不同
* ],
* "scene_desc" => "场景描述",
* "phone" => "手机号",
* "user_id" => "用户id被推送者"
* ]
* ]
*/
public function __construct(array $data)
{
$this->payload = $data;
}
}