Files
xk-api-yii/common/core/sms/PrescriptionRefuseMessage.php

40 lines
1.2 KiB
PHP
Raw Normal View History

2024-09-19 11:32:39 +08:00
<?php
namespace common\core\sms;
use Overtrue\EasySms\Contracts\GatewayInterface;
use Overtrue\EasySms\Message;
class PrescriptionRefuseMessage extends Message
{
protected $prescription;
protected $smsConfig;
public function __construct($prescription, $smsConfig)
{
$this->prescription = $prescription;
$this->smsConfig = $smsConfig;
}
// 定义直接使用内容发送平台的内容
public function getContent(GatewayInterface $gateway = null)
{
return sprintf('你的处方号为:%s 的处方未通过审核,驳回原因:%s请前往萧康云医小程序查看', $this->prescription['prescription_no'],$this->prescription['reason']);
}
// 定义使用模板发送方式平台所需要的模板 ID
public function getTemplate(GatewayInterface $gateway = null)
{
return $this->smsConfig['template_id'];
}
// 模板参数
public function getData(GatewayInterface $gateway = null)
{
return [
$this->smsConfig['template_variable'][0]=> $this->prescription['prescription_no'],
$this->smsConfig['template_variable'][1]=> $this->prescription['reason']
];
}
}