47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?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;
|
|
}
|
|
|
|
}
|