|
|
@@ -63,7 +63,7 @@ class LoginController extends Controller
|
|
|
if (mb_strlen($PhoneCode) > 6) {
|
|
|
return apiReturnFail(['web.verify.code_too_long', 'Phone code is too long']);
|
|
|
}
|
|
|
- $Phone = $this->normalizePhoneWithCountryCode($Phone, $RegisterLocation);
|
|
|
+ $Phone = $RegisterLocation.trim($Phone);
|
|
|
|
|
|
|
|
|
Log::info('验证电话开始' . $Phone);
|
|
|
@@ -120,7 +120,7 @@ class LoginController extends Controller
|
|
|
|
|
|
|
|
|
|
|
|
- $Phone = $this->normalizePhoneWithCountryCode($Phone, $RegisterLocation);
|
|
|
+ $Phone = $RegisterLocation.trim($Phone);
|
|
|
|
|
|
Log::info('绑定电话开始' . $Phone);
|
|
|
|
|
|
@@ -518,7 +518,7 @@ class LoginController extends Controller
|
|
|
return apiReturnFail(['web.verify.code_too_long', 'Phone code is too long']);
|
|
|
}
|
|
|
|
|
|
- $Phone = $this->normalizePhoneWithCountryCode($Phone, $RegisterLocation);
|
|
|
+ $Phone = $RegisterLocation.trim($Phone);
|
|
|
|
|
|
Log::info('验证电话开始' . $Phone);
|
|
|
|
|
|
@@ -550,7 +550,7 @@ class LoginController extends Controller
|
|
|
return $check;
|
|
|
}
|
|
|
$RegisterLocation = $request->country ?? env('COUNTRY_CODE','55');
|
|
|
- $user = GlobalUserInfo::getGameUserInfo("Phone", $this->normalizePhoneWithCountryCode($request->phone, $RegisterLocation));
|
|
|
+ $user = GlobalUserInfo::getGameUserInfo("Phone", $RegisterLocation . $request->phone);
|
|
|
if(!$user||empty($user)){
|
|
|
return $this->registerUser($request);
|
|
|
return apiReturnFail(['web.login.notfound', 'Erro de entrada, tente novamente!'], '', 2);
|
|
|
@@ -796,7 +796,7 @@ class LoginController extends Controller
|
|
|
if (strstr($request->account, '@')) {
|
|
|
$user = GlobalUserInfo::query()->where('RegionID', $config->isRegionUnique())->where("Email", $request->account)->first();
|
|
|
} else if (is_numeric($request->account)) {
|
|
|
- $user = GlobalUserInfo::query()->where('RegionID', $config->isRegionUnique())->where("Phone", $this->normalizePhoneWithCountryCode($request->account, $RegisterLocation))->first();
|
|
|
+ $user = GlobalUserInfo::query()->where('RegionID', $config->isRegionUnique())->where("Phone", $RegisterLocation . $request->account)->first();
|
|
|
} else {
|
|
|
$user = GlobalUserInfo::query()->where('RegionID', $config->isRegionUnique())->where("Accounts", $request->account)->first();
|
|
|
}
|
|
|
@@ -815,27 +815,14 @@ class LoginController extends Controller
|
|
|
|
|
|
}
|
|
|
|
|
|
- private function normalizePhoneWithCountryCode($Phone, $RegisterLocation = '1')
|
|
|
- {
|
|
|
- $Phone = preg_replace('/\D/s', '', trim((string)$Phone));
|
|
|
- $RegisterLocation = preg_replace('/\D/s', '', trim((string)$RegisterLocation));
|
|
|
-
|
|
|
- if ($Phone === '' || $RegisterLocation === '') {
|
|
|
- return $Phone;
|
|
|
- }
|
|
|
-
|
|
|
- if (str_starts_with($Phone, $RegisterLocation)) {
|
|
|
- return $Phone;
|
|
|
- }
|
|
|
-
|
|
|
- return $RegisterLocation . $Phone;
|
|
|
- }
|
|
|
-
|
|
|
private function checkPhone($Phone, $RegisterLocation = '1',Request $request=null)
|
|
|
{
|
|
|
- $OrgPhone=trim((string)$Phone);
|
|
|
- $Phone = $this->normalizePhoneWithCountryCode($Phone, $RegisterLocation);
|
|
|
+ $OrgPhone=$Phone;
|
|
|
// dd($RegisterLocation,$Phone,str_starts_with($Phone,$RegisterLocation),$Phone=explode($RegisterLocation,$Phone));
|
|
|
+ if(!empty($RegisterLocation)&&str_starts_with($Phone,$RegisterLocation)){
|
|
|
+
|
|
|
+ $Phone=$OrgPhone;
|
|
|
+ }
|
|
|
if (!empty($Phone)) {
|
|
|
// 验证规则
|
|
|
// Remove spaces and dashes from the input
|