70 lines
1.6 KiB
PHP
70 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
use app\api\logic\SmsLogic;
|
|
use app\api\validate\SendSmsValidate;
|
|
|
|
|
|
/**
|
|
* 短信
|
|
* Class SmsController
|
|
* @package app\api\controller
|
|
*/
|
|
class SmsController extends BaseApiController
|
|
{
|
|
|
|
public array $notNeedLogin = ['sendCode','sendEmailNoLogin'];
|
|
|
|
|
|
/**
|
|
* @notes 发送短信验证码
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/9/21 17:29
|
|
*/
|
|
public function sendCode()
|
|
{
|
|
$params = (new SendSmsValidate())->post()->goCheck();
|
|
$result = SmsLogic::sendCode($params);
|
|
if (true === $result) {
|
|
return $this->success('captcha.sendSuccessfully');//发送成功
|
|
}
|
|
return $this->fail(SmsLogic::getError());
|
|
}
|
|
|
|
/**
|
|
* @notes 发送邮件
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/9/21 17:29
|
|
*/
|
|
public function sendEmail()
|
|
{
|
|
$params = $this->request->post();
|
|
$params['user_id'] = $this->userId;
|
|
$result = SmsLogic::sendEmail($params);
|
|
if (true === $result) {
|
|
return $this->success('captcha.sendSuccessfully');//发送成功
|
|
}
|
|
return $this->fail(SmsLogic::getError());
|
|
}
|
|
|
|
/**
|
|
* @notes 发送邮件
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/9/21 17:29
|
|
*/
|
|
public function sendEmailNoLogin()
|
|
{
|
|
$params = $this->request->post();
|
|
$result = SmsLogic::sendEmailNoLogin($params);
|
|
if (true === $result) {
|
|
return $this->success('captcha.sendSuccessfully');//发送成功
|
|
}
|
|
return $this->fail(SmsLogic::getError());
|
|
}
|
|
|
|
} |