perf: 邮箱验证优化流程提示

This commit is contained in:
韦荣超
2022-03-07 14:38:40 +08:00
parent c1bdd079cf
commit a9f28dfb47
3 changed files with 16 additions and 7 deletions

View File

@@ -602,12 +602,14 @@ class UsersController extends AbstractController
}
// 如果已经校验过
if (intval($res->status) === 1)
return Base::retError('链接已经使用过');
return Base::retError('链接已经使用过',['code' => 2]);
$oldTime = strtotime($res->created_at);
$time = time();
//24个小时失效
if (abs($time - $oldTime) > 86400) {
$user = User::whereUserid($res->userid)->first();
UserEmailVerification::userEmailSend($user);
return Base::retError("链接已失效");
}
UserEmailVerification::where('code', $data['code'])