123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace app\services\message\sms;
- use app\services\BaseServices;
- use app\services\serve\ServeServices;
- use think\exception\ValidateException;
- class SmsSendServices extends BaseServices
- {
-
- public function send(bool $switch, $phone, array $data, string $template)
- {
- if ($switch && $phone) {
-
- $services = app()->make(ServeServices::class);
- $res = $services->sms()->send($phone, $template, $data);
- if ($res === false) {
- throw new ValidateException($services->getError());
- }
- return true;
- } else {
- return false;
- }
- }
- }
|