瀏覽代碼

no message

Tree 2 周之前
父節點
當前提交
3325ce9cb3

+ 4 - 0
app/Game/Services/RouteService.php

@@ -72,6 +72,10 @@ class RouteService
     public static function clearChannelConfig(){
         self::$_ChannelConfig=null;
     }
+    /**
+     * @param Request|null $request
+     * @return WebRegionConfig|null
+     */
     public static function getRegionConfig()
     {
         $RegionID = $_REQUEST['regionid'] ?? '';

+ 5 - 0
app/Game/WebChannelConfig.php

@@ -2,6 +2,7 @@
 
 namespace App\Game;
 
+use App\Game\Services\RouteService;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Facades\Redis;
 define('SPECIAL_MODE_GUEST', 1);
@@ -97,6 +98,10 @@ class WebChannelConfig extends Model
         if(($this->SpecialMode&SPECIAL_MODE_REGION_UNIQUE)==SPECIAL_MODE_REGION_UNIQUE&&!empty($this->RegionID)){
             return $this->RegionID;
         }else{
+            $region_config=RouteService::getRegionConfig();
+            if($region_config&&$region_config->isAllChannelsUnique()){
+                return $region_config->RegionID;
+            }
             return "";
         }
     }

+ 5 - 1
app/Game/WebRegionConfig.php

@@ -12,10 +12,14 @@ class WebRegionConfig extends Model
     protected $connection = 'mysql';
 
     protected $fillable = [
-        'RegionID', 'DomainUrl', 'LogoUrl', 'IconUrl', 'BindChannels', 'GroupID', 'GameDesc','SuggestChannel', 'ThemeKey'
+        'RegionID', 'DomainUrl', 'LogoUrl', 'IconUrl', 'BindChannels', 'GroupID', 'GameDesc','SuggestChannel', 'ThemeKey' ,'AllChannelUnique'
     ];
 
     protected $casts = [
         'BindChannels' => 'json',
     ];
+    public function isAllChannelsUnique()
+    {
+        return intval($this->AllChannelUnique)==1;
+    }
 }

+ 3 - 2
app/Http/Controllers/Game/LoginController.php

@@ -151,9 +151,10 @@ class LoginController extends Controller
 //            ->where('PhoneNum', $Phone)
 ////            ->where('Channel', $user->Channel)
 //            ->orWhere('UserID', $user->UserID)
+
         $first = GlobalUserInfo::query()->where(function ($query) use ($Phone, $user, $config) {
-            $query->where(function ($q) use ($Phone, $config) {
-                $q->where('RegionID', $config->isRegionUnique())->where('Phone', $Phone);
+            $query->where(function ($q) use ($Phone, $user) {
+                $q->where('RegionID', $user->RegionID??"")->where('Phone', $Phone);
             })->orWhere(function ($q) use ($user) {
                 $q->where('UserID', $user->UserID)->where('Phone', '<>', '');
             });