| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace addons\LuckyGroup\common\logic\notify;
- use Overtrue\EasySms\Contracts\GatewayInterface;
- use Overtrue\EasySms\Message;
- class SmsMessage extends Message
- {
- protected $data;
- protected $template_id;
- protected $mall_id;
- protected $mall_sms;
- public function __construct($content)
- {
- $this->data = $content['data'];
- parent::__construct();
- $this->template_id = $content['template'];
- $this->mall_sms = $content['mall_sms'];
- }
- // 定义使用模板发送方式平台所需要的模板 ID
- public function getTemplate(GatewayInterface $gateway = null)
- {
- return $this->template_id;
- }
- // 模板参数
- public function getData(GatewayInterface $gateway = null)
- {
- $data = [];
- foreach ($this->data as $key => $value) {
- $data[$key] = $value;
- }
- if ($this->mall_sms == 'submail') {
- $data['project'] = $this->template_id;
- }
- return $data;
- }
- }
|