mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-28 13:21:37 +08:00
42 lines
990 B
PHP
42 lines
990 B
PHP
<?php
|
|
|
|
namespace App\Services\Frontend\Account;
|
|
|
|
use App\Models\Account as AccountModel;
|
|
use App\Repos\User as UserRepo;
|
|
use App\Services\Frontend\Service as FrontendService;
|
|
use App\Validators\Account as AccountValidator;
|
|
use App\Validators\Verify as VerifyValidator;
|
|
|
|
class RegisterByPhone extends FrontendService
|
|
{
|
|
|
|
public function handle()
|
|
{
|
|
$post = $this->request->getPost();
|
|
|
|
$verifyValidator = new VerifyValidator();
|
|
|
|
$verifyValidator->checkSmsCode($post['phone'], $post['verify_code']);
|
|
|
|
$accountValidator = new AccountValidator();
|
|
|
|
$data = [];
|
|
|
|
$data['phone'] = $accountValidator->checkPhone($post['phone']);
|
|
|
|
$accountValidator->checkIfPhoneTaken($post['phone']);
|
|
|
|
$data['password'] = $accountValidator->checkPassword($post['password']);
|
|
|
|
$account = new AccountModel();
|
|
|
|
$account->create($data);
|
|
|
|
$userRepo = new UserRepo();
|
|
|
|
return $userRepo->findById($account->id);
|
|
}
|
|
|
|
}
|