|
|
@@ -40,7 +40,7 @@ class PhoneCodeService extends BaseService
|
|
|
public static function verify($phone, $code, $memberId, $visitorId): void
|
|
|
{
|
|
|
$search = ['phone' => $phone, 'code' => $code];
|
|
|
- $phoneCode = static::$MODEL::where(static::getWhere($search))->first();
|
|
|
+ $phoneCode = static::$MODEL::where(static::getWhere($search))->orderByDesc('id')->first();
|
|
|
if (!$phoneCode) throw new Exception("验证码错误", HttpStatus::CUSTOM_ERROR);
|
|
|
$time = time();
|
|
|
if ($phoneCode->ext < $time) throw new Exception("验证码过期", HttpStatus::CUSTOM_ERROR);
|