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