| 12345678910111213141516171819202122232425262728293031 |
- <?php
- namespace crmeb\services\async\task;
- use crmeb\repositories\ShortLetterRepositories;
- /**
- * 异步发短信
- */
- class AsyncSms extends Task {
- public function getCmd():string
- {
- return 'sms';
- }
- protected function _exec(array $params)
- {
- return ShortLetterRepositories::send(true, $params['phone'], $params['data'], $params['template']);
- }
- public static function push(string $phone, array $data, string $template)
- {
- $inst = new self();
- return $inst->put([
- 'phone' => $phone,
- 'data' => $data,
- 'template' => $template,
- ]);
- }
- }
|