PPPPPPP пре 4 недеља
родитељ
комит
cd34952921

+ 30 - 28
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',55);
 
         $user=$request->user();
         if($user){
@@ -69,32 +69,34 @@ class SendCodeController
             ->get();
 
         //默认
-        $SendCodeConfigType=3;
-//        if ($SendCodeConfig->count() > 1) {
-//
-//            $redis_key=$phone."_".$Channel;
-//            if (Redis::exists($redis_key)) {
-//                $currentCodeType = (int)Redis::get($redis_key);
-//                if($currentCodeType==100){
-//                    //两个通道都发了,不能再发了
-////                    return apiReturnFail(['web.verify.no_wrong_later','Your number is incorrect or temporarily unavailable, please try again later']);
-//                    $currentCodeType=1;
-//                }
-//                $SendCodeConfigType = $this->CodeType[$currentCodeType];
-////                Redis::set($redis_key, $this->CodeType[$currentCodeType]);
-//                Redis::set($redis_key, $SendCodeConfigType);
-//                Redis::expire($redis_key, 3600);
-//                Log::info('补发验证码通道:'.$SendCodeConfigType);
-//                Util::WriteLog('phone_error',$phone);
-//            } else {
-//                // 默认 codeType 1 天一泓短信
-//                // 默认 codeType 3 plants
-//                Redis::set($redis_key, $SendCodeConfigType);
-//                Redis::expire($redis_key, 3600);
-//            }
-//        } else {
-//            $SendCodeConfigType = (int)$SendCodeConfig->where('Status', 1)->first()->Type ?? 1;
-//        }
+        $SendCodeConfigType = rand(0,100)>50?3:1;
+
+        $SendCodeConfigType=1;
+        if ($SendCodeConfig->count() > 1) {
+
+            $redis_key=$phone."_".$Channel;
+            if (Redis::exists($redis_key)) {
+                $currentCodeType = (int)Redis::get($redis_key);
+                if($currentCodeType==100){
+                    //两个通道都发了,不能再发了
+//                    return apiReturnFail(['web.verify.no_wrong_later','Your number is incorrect or temporarily unavailable, please try again later']);
+                    $currentCodeType=1;
+                }
+                $SendCodeConfigType = $this->CodeType[$currentCodeType];
+//                Redis::set($redis_key, $this->CodeType[$currentCodeType]);
+                Redis::set($redis_key, $SendCodeConfigType);
+                Redis::expire($redis_key, 3600);
+                Log::info('补发验证码通道:'.$SendCodeConfigType);
+                Util::WriteLog('phone_error',$phone);
+            } else {
+                // 默认 codeType 1 天一泓短信
+                // 默认 codeType 3 plants
+                Redis::set($redis_key, $SendCodeConfigType);
+                Redis::expire($redis_key, 3600);
+            }
+        } else {
+            $SendCodeConfigType = (int)$SendCodeConfig->where('Status', 1)->first()->Type ?? 1;
+        }
 //        $SendCodeConfigType = 1;
 //        $redis->get(self::PHONE_SEND_LASTCONFIG_PREFIX . $phone);
         Log::info('发送验证码渠道:'.$SendCodeConfigType);
@@ -116,7 +118,7 @@ class SendCodeController
             'pt'=>'Olá, {{code}} (OTP) para sua verificação de celular',
             'es'=>'Hola, {{code}} (OTP) para tu verificación móvil ',
             'ru'=>'ривет, {{code}} (OTP) для проверки вашего мобильного телефона',
-//            'zh'=>'您好,{{code}} (OTP),您的手機驗證碼 24680com',
+            //            'zh'=>'您好,{{code}} (OTP),您的手機驗證碼 24680com',
         ];
         $Content = $lang['en'];
         $locale=GlobalUserInfo::getLocale();

+ 2 - 2
app/Models/GamePhoneVerityCode.php

@@ -16,7 +16,7 @@ class GamePhoneVerityCode extends Model
         $now = date('Y-m-d H:i:s');
         $query = DB::connection('write')->table('QPTreasureDB.dbo.GamePhoneVerityCode')
             ->where('PhoneNum',$PhoneNum)
-            ->first();
+            ->exists();
 
 
         $pack=Util::getPackageByURL();
@@ -24,7 +24,7 @@ class GamePhoneVerityCode extends Model
         if ($query) {
             DB::connection('write')->table('QPTreasureDB.dbo.GamePhoneVerityCode')
                 ->where('PhoneNum',$PhoneNum)
-                ->update(['UserID'=>$UserID,'Code'=>$query->Code,'CreateDate'=>$now,'Channel'=>$pack['channel']]);
+                ->update(['UserID'=>$UserID,'Code'=>$Code,'CreateDate'=>$now,'Channel'=>$pack['channel']]);
 
         }else{
             $data = [

+ 11 - 11
app/Notification/TelegramBot.php

@@ -16,16 +16,16 @@ class TelegramBot
     public $telegram;
     public function __construct(){
         try {
-            $telegram = new Telegram(self::api_key, self::username);
-
-            $mysql=['host' => env('DB_MYSQL_HOST', '127.0.0.1'),
-                'port' => env('DB_MYSQL_PORT', '3306'),
-                'database' => 'telegram',
-                'user' => env('DB_MYSQL_USERNAME'),
-                'password' => env('DB_MYSQL_PASSWORD'),  ];
-            $telegram->enableMySql($mysql);
-
-            $this->telegram=$telegram;
+//            $telegram = new Telegram(self::api_key, self::username);
+//
+//            $mysql=['host' => env('DB_MYSQL_HOST', '127.0.0.1'),
+//                'port' => env('DB_MYSQL_PORT', '3306'),
+//                'database' => 'telegram',
+//                'user' => env('DB_MYSQL_USERNAME'),
+//                'password' => env('DB_MYSQL_PASSWORD'),  ];
+//            $telegram->enableMySql($mysql);
+//
+//            $this->telegram=$telegram;
 ////            $result = $this->telegram->setWebhook("https://".$_SERVER["HTTP_HOST"]."/api/telehook");
 //            $allowed_updates = [
 //                Update::TYPE_MESSAGE,
@@ -40,7 +40,7 @@ class TelegramBot
 
 
         }catch (TelegramException $e){
-            Util::WriteLog('telegram','error:'.$e->getMessage());
+//            Util::WriteLog('telegram','error:'.$e->getMessage());
         }
     }
     public function handle(){

+ 1 - 1
config/app.php

@@ -66,7 +66,7 @@ return [
      */
 
 //    'timezone'        => 'PRC',
-    'timezone'        => env('APP_TIMEZONE', 'America/New_York'), # ÃÀ¹ú¶«²¿Ê±Çø (EST/EDT)
+    'timezone'        => env('APP_TIMEZONE', 'America/New_York'), #
 
     /*
     |--------------------------------------------------------------------------