Browse Source

【游戏服】修改null exception;删除无意义的Trim

大爷 1 year ago
parent
commit
d0d28759fe

+ 4 - 4
DotNet/Hotfix/Scenes/Game/GameDouyinComponentSystem.cs

@@ -84,14 +84,14 @@ namespace ET.Server
         /// <returns></returns>
         public static JObject GetRoomInfo(this GameDouyinComponent self, string token)
         {
-            if (string.IsNullOrEmpty(self.AccessToken.Trim()))
+            if (string.IsNullOrEmpty(self.AccessToken))
             {
                 Log.Error($"InitRoomId...AccessToken为null");
                 return null;
             }
             // 请求头
             Dictionary<string, string> head = new Dictionary<string, string>();
-            head.Add("X-Token", self.AccessToken.Trim());
+            head.Add("X-Token", self.AccessToken);
             // 参数
             JObject param = new JObject();
             param.Add("token", token);
@@ -134,7 +134,7 @@ namespace ET.Server
         /// <param name="roomId"></param>
         public static void TopGifts(this GameDouyinComponent self, long roomId)
         {
-            if (string.IsNullOrEmpty(self.AccessToken.Trim()))
+            if (string.IsNullOrEmpty(self.AccessToken))
             {
                 Log.Error($"TopGifts...AccessToken为null");
                 return;
@@ -147,7 +147,7 @@ namespace ET.Server
             }
             // 请求头
             Dictionary<string, string> head = new Dictionary<string, string>();
-            head.Add("x-token", self.AccessToken.Trim());
+            head.Add("x-token", self.AccessToken);
             // 参数
             JObject param = new JObject();
             param.Add("room_id", roomId.ToString());

+ 2 - 2
DotNet/Hotfix/Scenes/Game/Handler/C2G_LoginGameHandler.cs

@@ -23,7 +23,7 @@ namespace ET.Server
 
             Scene scene = session.DomainScene();
 
-            bool tokenIsNull = string.IsNullOrEmpty(request.Token.Trim());
+            bool tokenIsNull = string.IsNullOrEmpty(request.Token);
 
             // 预先创建数据
             PlayerInfo playerInfo = new PlayerInfo();
@@ -40,7 +40,7 @@ namespace ET.Server
             }
             else
             {
-                JObject roomInfo = scene.GetComponent<GameDouyinComponent>().GetRoomInfo(request.Token.Trim());
+                JObject roomInfo = scene.GetComponent<GameDouyinComponent>().GetRoomInfo(request.Token);
 
                 if (roomInfo == null)
                 {