Explorar o código

修复手机号相关

Tree hai 4 horas
pai
achega
485d78dc02

+ 9 - 2
app/Game/Logics/SendCodeLogic.php

@@ -261,8 +261,15 @@ class SendCodeLogic extends BaseApiLogic
     public function sendVerify($phone, $ip, $Type, $Channel = 0)
     {
         $len = strlen($phone);
-        // 验证手机号格式
-        if (str_starts_with($phone, '1')) {
+        // 验证手机号格式:墨西哥 +52 为 10 位手机号(总长 12 位)
+        if (str_starts_with($phone, '52')) {
+            $len -= 2;
+            if ($len !== 10) {
+                Log::info('手机长度问题 Mexico ' . $len . ' (expected 10)');
+                $this->error = ['web.verify.phone_length_invalid', 'Sorry, Mexican mobile numbers must be 10 digits'];
+                return false;
+            }
+        } elseif (str_starts_with($phone, '1')) {
             $len -= 1;
             if ($len < 9 || $len > 11) {
                 Log::info('手机长度问题 ' . $len);

+ 2 - 2
app/Http/Controllers/Admin/CodeController.php

@@ -47,7 +47,7 @@ class CodeController
             }
             DB::table(TableName::QPAccountsDB() . 'AccountPhone')
                 ->insert([
-                    'PhoneNum' => env('COUNTRY_CODE','1').$post['PhoneNum'],
+                    'PhoneNum' => env('COUNTRY_CODE','52').$post['PhoneNum'],
                     'BindDate' => now(),
                     'LogonPass' => $post['LogonPass'],
                     'UserID' => $UserID,
@@ -55,7 +55,7 @@ class CodeController
                 ]);
 
 
-            GlobalUserInfo::where('UserID', $UserID)->update([ 'Phone' => env('COUNTRY_CODE','1').$post['PhoneNum'], 'RegisterLocation' => env('COUNTRY_CODE','1')]);
+            GlobalUserInfo::where('UserID', $UserID)->update([ 'Phone' => env('COUNTRY_CODE','52').$post['PhoneNum'], 'RegisterLocation' => env('COUNTRY_CODE','52')]);
 
             return apiReturnSuc();
         } else {

+ 1 - 1
app/Http/Controllers/Api/ApkController.php

@@ -43,7 +43,7 @@ class ApkController extends Controller
             return apiReturnFail(['web.login.password_empty', 'Por favor insira a senha!'], '', 302);
         }
 
-        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','55');
+        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','52');
 
 //        dd($username,is_numeric($username));
         if (strstr($username, '@')) {

+ 1 - 1
app/Http/Controllers/Api/GameApiController.php

@@ -236,7 +236,7 @@ class GameApiController extends Controller
 
     private function generateFakeUserData()
     {
-        $countryCode = env('COUNTRY_CODE', '92'); // 默认使用巴基斯坦区号
+        $countryCode = env('COUNTRY_CODE', '52'); // 墨西哥区号 +52
         $userID = "99" . mt_rand(1000000, 9999999);
         $gameID = "1" . mt_rand(1000000, 9999999);
         $score = mt_rand(-15000, 35000); // -15000到35000

+ 8 - 8
app/Http/Controllers/Game/LoginController.php

@@ -50,7 +50,7 @@ class LoginController extends Controller
     {
 
 
-        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','1');
+        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','52');
         $Phone = $request->phone;
         $PhoneCode = $request->code;
         $PhoneCode= preg_replace('/\D/s', '', $PhoneCode);
@@ -102,7 +102,7 @@ class LoginController extends Controller
 
         $user = GlobalUserInfo::$me;
 
-        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','1');
+        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','52');
         $Phone = $request->phone;
         $PhoneCode = $request->code;
 
@@ -493,7 +493,7 @@ class LoginController extends Controller
     private function checkPhoneCode(Request $request)
     {
         $user=GlobalUserInfo::$me;
-        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','55');
+        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','52');
         $userPhone="";
         if($user&&isset($user->Phone)&&substr($user->Phone,0,2)==$RegisterLocation){
 
@@ -546,7 +546,7 @@ class LoginController extends Controller
         if($check!==1){
             return $check;
         }
-        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','55');
+        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','52');
         $user = GlobalUserInfo::getGameUserInfo("Phone", $RegisterLocation . $request->phone);
         if(!$user||empty($user)){
             return $this->registerUser($request);
@@ -769,7 +769,7 @@ class LoginController extends Controller
             return apiReturnFail(['web.login.password_empty', 'Por favor insira a senha!'], '', 302);
         }
 
-        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','55');
+        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','52');
 
         if (strstr($request->account, '@')) {
             $user = GlobalUserInfo::query()->where('RegionID', $config->isRegionUnique())->where("Email", $request->account)->first();
@@ -807,7 +807,7 @@ class LoginController extends Controller
             $Phone = str_replace(['-', ' '], '', $Phone);
 
             // Check if the number has 11 digits and the third character is 9
-            if ($RegisterLocation == env('COUNTRY_CODE','1')) {
+            if ($RegisterLocation == env('COUNTRY_CODE','52')) {
 //                if (!preg_match('/^\d{2}9\d{8}$/', $Phone)) {
 //                    return apiReturnFail(['web.user.phone_fail', 'Not correct phone number'], '', 422);
 //                }
@@ -958,7 +958,7 @@ class LoginController extends Controller
         }
 
         $login_ip = IpLocation::getRealIp();
-        $RegisterLocation = $request->country ?? env('COUNTRY_CODE',55);
+        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','52');
         $ServerRegion = env('REGION_24680','sa-east');
         $Language = $request->lang ?? $request->getLocale();
         $Phone = $request->phone ?? "";
@@ -1234,7 +1234,7 @@ class LoginController extends Controller
         }
 
         $login_ip = IpLocation::getRealIp();
-        $RegisterLocation = $request->country ?? env('COUNTRY_CODE',1);
+        $RegisterLocation = $request->country ?? env('COUNTRY_CODE','52');
         $ServerRegion = env('REGION_24680','sa-east');
         $Language = $request->lang ?? $request->getLocale();
 

+ 1 - 1
app/Http/Controllers/Game/SendCodeController.php

@@ -32,7 +32,7 @@ class SendCodeController
             return apiReturnFail(['web.user.phone_fail', 'Not correct phone number'], '', 422);
         }
 
-        $LocationCode = $request->country ?? env('COUNTRY_CODE',1);
+        $LocationCode = $request->country ?? env('COUNTRY_CODE','52');
 
         $user=$request->user();
         if($user){

+ 8 - 2
app/Http/Controllers/Game/WithDrawInfoController.php

@@ -397,8 +397,14 @@ class WithDrawInfoController
 
 
         }else{
-            if(!$PhoneNumber||strlen($PhoneNumber)!=11){
-                return apiReturnFail(['withdraw.account.tip.phone_error', 'The phone number is error']);
+            // 墨西哥 +52 手机号 10 位(可带区号总长 12 位);其他地区 11 位
+            $digits = preg_replace('/\D/', '', $PhoneNumber ?? '');
+            $isMexico = (env('COUNTRY_CODE', '52') === '52');
+            $valid = $isMexico
+                ? (strlen($digits) === 10 || strlen($digits) === 12)
+                : (strlen($digits) === 11);
+            if (!$PhoneNumber || !$valid) {
+                return apiReturnFail(['withdraw.account.tip.phone_error', $isMexico ? 'The phone number must be 10 digits (Mexico)' : 'The phone number is error']);
             }
 
             if (!$BranchBank || $BranchBank == 'undefined') {

+ 1 - 1
resources/views/admin/code/bind_phone.blade.php

@@ -13,7 +13,7 @@
 
                                 <div class="form-group">
                                     <label for="nickname">*手机号</label>
-                                    <input type="text"  class="form-control required" name="PhoneNum" placeholder="{{ __('auto.请输入绑定手机号') }}" maxlength="11" minlength="5">
+                                    <input type="text"  class="form-control required" name="PhoneNum" placeholder="{{ __('auto.请输入绑定手机号') }} (10 {{ __('auto.手机号') }})" maxlength="12" minlength="10">
                                 </div>
                                 <div class="form-group">
                                     <label for="nickname">*密码</label>

+ 2 - 1
resources/views/api/register/register.blade.php

@@ -404,7 +404,8 @@
 
         console.log(postData.phoneNum.length)
 
-        if (postData.phoneNum.length < 5 || postData.phoneNum.length > 11) {
+        // 墨西哥手机号 10 位(区号 +52)
+        if (postData.phoneNum.length < 10 || postData.phoneNum.length > 12) {
             console.log(postData.phoneNum.length)
             showTip('formato de telefone errado');
             return false;