|
|
@ -23,6 +23,7 @@ use app\utility\UnqId; |
|
|
|
use think\facade\Config; |
|
|
|
use think\facade\Db; |
|
|
|
use think\facade\Log; |
|
|
|
use think\facade\Queue; |
|
|
|
use function Sodium\compare; |
|
|
|
use think\facade\Request; |
|
|
|
|
|
|
@ -637,4 +638,35 @@ class AdminService extends AdminBaseService |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function sendEmailOrSms($param) |
|
|
|
{ |
|
|
|
try { |
|
|
|
if (empty($param['user_id'])) { |
|
|
|
return $this->toData('400', '参数错误'); |
|
|
|
} |
|
|
|
if (!in_array($param['type'], [1,2])) { |
|
|
|
return $this->toData('400', '参数错误'); |
|
|
|
} |
|
|
|
|
|
|
|
// 发送邮件 |
|
|
|
if ($param['type'] == 1) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 发送短信 |
|
|
|
if ($param['type'] == 2) { |
|
|
|
// 推送短信 |
|
|
|
$to = '18582301860'; |
|
|
|
$content = '测试短信推送'; |
|
|
|
$accessKey = 'LTAI5tMYUS9asodB6n2qSL9Y'; |
|
|
|
$secret = 'TIMy9s5m7mHSPZN4uRahok4GRdWH1p'; |
|
|
|
(new \app\utility\SendSms())->send($to, $content, $accessKey, $secret); |
|
|
|
} |
|
|
|
|
|
|
|
return $this->toData('0', 'success'); |
|
|
|
} catch (\Exception $e) { |
|
|
|
return $this->toData('500', 'The system is busy.', [$e->getMessage(), $e->getTrace()]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|