AsyncSms.php 645 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace crmeb\services\async\task;
  3. use crmeb\repositories\ShortLetterRepositories;
  4. /**
  5. * 异步发短信
  6. */
  7. class AsyncSms extends Task {
  8. public function getCmd():string
  9. {
  10. return 'sms';
  11. }
  12. protected function _exec(array $params)
  13. {
  14. return ShortLetterRepositories::send(true, $params['phone'], $params['data'], $params['template']);
  15. }
  16. public static function push(string $phone, array $data, string $template)
  17. {
  18. $inst = new self();
  19. return $inst->put([
  20. 'phone' => $phone,
  21. 'data' => $data,
  22. 'template' => $template,
  23. ]);
  24. }
  25. }