vd/vendor/dipper/sms/src/Messages/InstalledMessage.php
2018-12-25 10:51:10 +08:00

44 lines
1.2 KiB
PHP
Raw 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
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'],
];
}
}