CustomMessage.php 679 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace iBrand\Sms\Test;
  3. use Overtrue\EasySms\Message;
  4. use Overtrue\EasySms\Contracts\GatewayInterface;
  5. class CustomMessage extends Message
  6. {
  7. protected $code;
  8. protected $gateways = ['yuntongxun'];
  9. public function __construct($code)
  10. {
  11. $this->code = $code;
  12. }
  13. // 定义直接使用内容发送平台的内容
  14. public function getContent(GatewayInterface $gateway = null)
  15. {
  16. }
  17. // 定义使用模板发送方式平台所需要的模板 ID
  18. public function getTemplate(GatewayInterface $gateway = null)
  19. {
  20. return '5589';
  21. }
  22. // 模板参数
  23. public function getData(GatewayInterface $gateway = null)
  24. {
  25. return [
  26. $this->code,
  27. 'mock-data-2',
  28. ];
  29. }
  30. }