first commit
This commit is contained in:
70
app/api/controller/SmsController.php
Normal file
70
app/api/controller/SmsController.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?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());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user