1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-07-24 08:51:43 +08:00
xiaochong0302 5384cb8c87 优化
2020-05-06 20:14:50 +08:00

38 lines
870 B
PHP

<?php
namespace App\Services\Frontend\Account;
use App\Models\Account as AccountModel;
use App\Services\Frontend\Service;
use App\Validators\Account as AccountValidator;
use App\Validators\Verify as VerifyValidator;
class RegisterByEmail extends Service
{
public function handle()
{
$post = $this->request->getPost();
$verifyValidator = new VerifyValidator();
$verifyValidator->checkEmailCode($post['email'], $post['verify_code']);
$accountValidator = new AccountValidator();
$data = [];
$data['email'] = $accountValidator->checkEmail($post['email']);
$data['password'] = $accountValidator->checkPassword($post['password']);
$accountValidator->checkIfEmailTaken($post['email']);
$account = new AccountModel();
$account->create($data);
return $account;
}
}