44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
||
|
||
namespace Dipper\Sms\Messages;
|
||
|
||
use Dipper\Sms\Contracts\GatewayInterface;
|
||
|
||
class InstalledMessage extends Message
|
||
{
|
||
protected $attributes;
|
||
|
||
public function __construct(array $attributes)
|
||
{
|
||
$this->attributes = $attributes;
|
||
}
|
||
|
||
// 定义直接使用内容发送平台的内容
|
||
public function getContent(GatewayInterface $gateway = null)
|
||
{
|
||
return sprintf(
|
||
'【车友服务】尊敬的客户,您的设备(%s)安装订单于%s完成。详细信息:%s ,感谢您的使用。',
|
||
$this->attributes['imei'],
|
||
$this->attributes['created_at'],
|
||
$this->attributes['detail']
|
||
);
|
||
}
|
||
|
||
// 定义使用模板发送方式平台所需要的模板 ID
|
||
public function getTemplate(GatewayInterface $gateway = null)
|
||
{
|
||
$config = $gateway->getConfig();
|
||
return $config['template']['installed'];
|
||
}
|
||
|
||
// 模板参数
|
||
public function getData(GatewayInterface $gateway = null)
|
||
{
|
||
return [
|
||
'Device' => $this->attributes['imei'],
|
||
'Order' => $this->attributes['created_at'],
|
||
'DeviceInfo' => $this->attributes['detail'],
|
||
];
|
||
}
|
||
}
|