mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-23 03:50:56 +08:00
171 lines
3.7 KiB
PHP
171 lines
3.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Web\Controllers;
|
|
|
|
use App\Http\Web\Services\Account as AccountService;
|
|
use App\Services\Frontend\Account\EmailUpdate as EmailUpdateService;
|
|
use App\Services\Frontend\Account\PasswordReset as PasswordResetService;
|
|
use App\Services\Frontend\Account\PasswordUpdate as PasswordUpdateService;
|
|
use App\Services\Frontend\Account\PhoneUpdate as PhoneUpdateService;
|
|
|
|
/**
|
|
* @RoutePrefix("/account")
|
|
*/
|
|
class AccountController extends Controller
|
|
{
|
|
|
|
/**
|
|
* @Get("/register", name="web.account.register")
|
|
*/
|
|
public function registerAction()
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
* @Get("/login", name="web.account.login")
|
|
*/
|
|
public function loginAction()
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
* @Get("/logout", name="web.account.logout")
|
|
*/
|
|
public function logoutAction()
|
|
{
|
|
$service = new AccountService();
|
|
|
|
$service->logout();
|
|
|
|
$this->response->redirect(['for' => 'web.index']);
|
|
}
|
|
|
|
/**
|
|
* @Get("/password/reset", name="web.account.reset_pwd")
|
|
*/
|
|
public function resetPasswordAction()
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
* @Post("/phone/register", name="web.account.register_by_phone")
|
|
*/
|
|
public function registerByPhoneAction()
|
|
{
|
|
$service = new AccountService();
|
|
|
|
$service->registerByPhone();
|
|
|
|
$content = [
|
|
'location' => $this->request->getHTTPReferer(),
|
|
'msg' => '注册账户成功',
|
|
];
|
|
|
|
return $this->jsonSuccess($content);
|
|
}
|
|
|
|
/**
|
|
* @Post("/email/register", name="web.account.register_by_email")
|
|
*/
|
|
public function registerByEmailAction()
|
|
{
|
|
$service = new AccountService();
|
|
|
|
$service->registerByPhone();
|
|
|
|
$content = [
|
|
'msg' => '注册账户成功',
|
|
];
|
|
|
|
return $this->jsonSuccess($content);
|
|
}
|
|
|
|
/**
|
|
* @Post("/password/login", name="web.account.login_by_pwd")
|
|
*/
|
|
public function loginByPasswordAction()
|
|
{
|
|
$service = new AccountService();
|
|
|
|
$service->loginByPassword();
|
|
|
|
return $this->jsonSuccess();
|
|
}
|
|
|
|
/**
|
|
* @Post("/verify/login", name="web.account.login_by_verify")
|
|
*/
|
|
public function loginByVerifyAction()
|
|
{
|
|
$service = new AccountService();
|
|
|
|
$service->loginByVerify();
|
|
|
|
return $this->jsonSuccess();
|
|
}
|
|
|
|
/**
|
|
* @Post("/password/email/reset", name="web.account.reset_pwd_by_email")
|
|
*/
|
|
public function resetPasswordByEmailAction()
|
|
{
|
|
$service = new PasswordResetService();
|
|
|
|
$service->handle();
|
|
|
|
return $this->jsonSuccess(['msg' => '重置密码成功']);
|
|
}
|
|
|
|
/**
|
|
* @Post("/password/phone/reset", name="web.account.reset_pwd_by_phone")
|
|
*/
|
|
public function resetPasswordByPhoneAction()
|
|
{
|
|
$service = new PasswordResetService();
|
|
|
|
$service->handle();
|
|
|
|
return $this->jsonSuccess(['msg' => '重置密码成功']);
|
|
}
|
|
|
|
/**
|
|
* @Post("/phone/update", name="web.account.update_phone")
|
|
*/
|
|
public function updatePhoneAction()
|
|
{
|
|
$service = new PhoneUpdateService();
|
|
|
|
$service->handle();
|
|
|
|
return $this->jsonSuccess(['msg' => '更新手机成功']);
|
|
}
|
|
|
|
/**
|
|
* @Post("/email/update", name="web.account.update_email")
|
|
*/
|
|
public function updateEmailAction()
|
|
{
|
|
$service = new EmailUpdateService();
|
|
|
|
$service->handle();
|
|
|
|
return $this->jsonSuccess(['msg' => '更新邮箱成功']);
|
|
}
|
|
|
|
/**
|
|
* @Post("/password/update", name="web.account.update_password")
|
|
*/
|
|
public function updatePasswordAction()
|
|
{
|
|
$service = new PasswordUpdateService();
|
|
|
|
$service->handle();
|
|
|
|
return $this->jsonSuccess(['msg' => '更新密码成功']);
|
|
}
|
|
|
|
}
|