顾客找回密码

This commit is contained in:
TL 2022-07-07 17:32:24 +08:00
parent 57a20d363b
commit c67a46362e
2 changed files with 7 additions and 1 deletions

View File

@ -41,6 +41,11 @@ class VerifyCodeRepo
return VerifyCode::query()->where('account', $account)->first();
}
public static function deleteByAccount($account)
{
return VerifyCode::query()->where('account', $account)->delete();
}
/**
* @param $id
* @return void

View File

@ -52,6 +52,7 @@ class AccountService
public static function sendVerifyCodeForForgotten($email, $type) {
$code = str_pad(mt_rand(10, 999999), 6, '0', STR_PAD_LEFT);
VerifyCodeRepo::deleteByAccount($email);
VerifyCodeRepo::create([
'account' => $email,
'code' => $code,
@ -90,6 +91,6 @@ class AccountService
throw new \Exception("找回密码类型错误");
}
CustomerRepo::update($customer, ['password' => $password]);
$verifyCode->delete();
}
}