Ken 3 zile în urmă
părinte
comite
3d5e46ba42
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      app/Services/PhoneCodeService.php

+ 1 - 1
app/Services/PhoneCodeService.php

@@ -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);