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.
126 lines
3.1 KiB
126 lines
3.1 KiB
<?php
|
|
|
|
namespace app\home\controller;
|
|
|
|
use app\home\service\LoginService;
|
|
use think\App;
|
|
use think\response\Json;
|
|
|
|
class Login extends HomeBaseController
|
|
{
|
|
|
|
/**
|
|
* @desc 发送短信验证码 未登录邮箱验证码可共用 如 注册的验证码可以用户来在忘记密码处使用 但必须是同一个邮箱 且只能使用一次
|
|
* @return Json
|
|
*/
|
|
public function sendEmail(): Json
|
|
{
|
|
$returnData = (new LoginService())->sendEmail($this->request->post());
|
|
return json($returnData);
|
|
}
|
|
|
|
/**
|
|
* @desc 邮箱注册
|
|
* @return Json
|
|
* @throws \Psr\SimpleCache\InvalidArgumentException
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function registerEmail(): Json
|
|
{
|
|
$returnData = (new LoginService())->registerEmail($this->request->post());
|
|
return json($returnData);
|
|
}
|
|
|
|
/**
|
|
* @desc 登陆接口
|
|
* @return Json
|
|
*/
|
|
public function loginEmail(): Json
|
|
{
|
|
$returnData = (new LoginService())->loginEmail($this->request->post());
|
|
return json($returnData);
|
|
}
|
|
|
|
/**
|
|
* #desc 发送短信验证码
|
|
* @return Json
|
|
*/
|
|
public function sendSms(): Json
|
|
{
|
|
$returnData = (new LoginService())->sendSms($this->request->post());
|
|
return json($returnData);
|
|
}
|
|
|
|
|
|
/**
|
|
* @desc @desc 短信注册
|
|
* @return Json
|
|
* @throws \Psr\SimpleCache\InvalidArgumentException
|
|
*/
|
|
public function registerSms(): Json
|
|
{
|
|
$returnData = (new LoginService())->registerSms($this->request->post());
|
|
return json($returnData);
|
|
}
|
|
|
|
/**
|
|
* @desc 短信验证码登陆
|
|
* @return Json
|
|
* @throws \Psr\SimpleCache\InvalidArgumentException
|
|
*/
|
|
public function loginSms(): Json
|
|
{
|
|
$returnData = (new LoginService())->loginSms($this->request->post());
|
|
return json($returnData);
|
|
}
|
|
|
|
/**
|
|
* @desc 忘记密码 根据邮箱设置密码
|
|
* @return Json
|
|
* @throws \Psr\SimpleCache\InvalidArgumentException
|
|
*/
|
|
public function resetPasswordByEmail(): Json
|
|
{
|
|
$returnData = (new LoginService())->resetPasswordByEmail($this->request->post());
|
|
return json($returnData);
|
|
}
|
|
|
|
/**
|
|
* @desc 忘记密码 根据短信设置密码
|
|
* @return Json
|
|
*/
|
|
public function resetPasswordBySms(): Json
|
|
{
|
|
$returnData = (new LoginService())->resetPasswordBySms($this->request->post());
|
|
return json($returnData);
|
|
}
|
|
|
|
/**
|
|
* @desc 手机号登陆
|
|
* @return Json
|
|
*/
|
|
public function phoneLogin(): Json
|
|
{
|
|
$returnData = (new LoginService())->phoneLogin($this->request->post());
|
|
return json($returnData);
|
|
}
|
|
|
|
/**
|
|
* 免密码登录
|
|
* @return Json
|
|
*/
|
|
public function autoLogin():Json
|
|
{
|
|
$returnData = (new LoginService())->autoLogin($this->request->post());
|
|
return json($returnData);
|
|
}
|
|
public function getIP():Json
|
|
{
|
|
$returnData = (new LoginService())->getIP();
|
|
return json($returnData);
|
|
}
|
|
|
|
|
|
}
|