You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.6 KiB
71 lines
1.6 KiB
<?php
|
|
declare (strict_types=1);
|
|
|
|
namespace app\api\controller;
|
|
|
|
use edward\captcha\facade\CaptchaApi;
|
|
use service\ActionLog;
|
|
|
|
class Test extends Common
|
|
{
|
|
/**
|
|
* 邮件发送测试
|
|
*
|
|
* @return \think\Response
|
|
*/
|
|
public function sendMail()
|
|
{
|
|
//配置smtp信息
|
|
$transport = new \Swift_SmtpTransport('smtp.exmail.qq.com', 25);
|
|
$transport->setUsername('service@huamill.com');
|
|
$transport->setPassword('Jiabaiyan1018');
|
|
|
|
//实例化mailer
|
|
$mailer = new \Swift_Mailer($transport);
|
|
|
|
//邮件内容
|
|
$message = new \Swift_Message('测试swiftmailer邮件类');
|
|
$message->setContentType('text/html');
|
|
$message->setFrom(['service@huamill.com' => 'cloud']);
|
|
$message->setTo('243993898@qq.com');
|
|
$message->setBody('这是邮件内容,收到请勿回复');
|
|
|
|
//发送邮件
|
|
$result = $mailer->send($message);
|
|
|
|
halt($result);
|
|
}
|
|
|
|
/**
|
|
* 发送短信验证码
|
|
* @param int $phone
|
|
*/
|
|
public function sendSms(string $phone = '')
|
|
{
|
|
halt(CaptchaApi::createSMS($phone));
|
|
}
|
|
|
|
public function checkSms(string $code = '', string $phone = '')
|
|
{
|
|
halt(CaptchaApi::checkSMS($code, $phone));
|
|
}
|
|
|
|
/**
|
|
* 日志类测试
|
|
* @Log [sys_name] 在 [sys_time]新增插件数据
|
|
*/
|
|
public function writeLog()
|
|
{
|
|
//手动写入日志数据
|
|
ActionLog::getInstance()->write();
|
|
}
|
|
|
|
/**
|
|
* composer require jenssegers/agent 获取系统信息,访问终端判断、系统设备等信息
|
|
*/
|
|
public function systemInfo()
|
|
{
|
|
echo 'system';
|
|
}
|
|
|
|
}
|
|
|