Преглед на файлове

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

大爷 преди 1 година
родител
ревизия
d0d28759fe
променени са 2 файла, в които са добавени 6 реда и са изтрити 6 реда
  1. 4 4
      DotNet/Hotfix/Scenes/Game/GameDouyinComponentSystem.cs
  2. 2 2
      DotNet/Hotfix/Scenes/Game/Handler/C2G_LoginGameHandler.cs

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

@@ -84,14 +84,14 @@ namespace ET.Server
         /// <returns></returns>
         /// <returns></returns>
         public static JObject GetRoomInfo(this GameDouyinComponent self, string token)
         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");
                 Log.Error($"InitRoomId...AccessToken为null");
                 return null;
                 return null;
             }
             }
             // 请求头
             // 请求头
             Dictionary<string, string> head = new Dictionary<string, string>();
             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();
             JObject param = new JObject();
             param.Add("token", token);
             param.Add("token", token);
@@ -134,7 +134,7 @@ namespace ET.Server
         /// <param name="roomId"></param>
         /// <param name="roomId"></param>
         public static void TopGifts(this GameDouyinComponent self, long roomId)
         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");
                 Log.Error($"TopGifts...AccessToken为null");
                 return;
                 return;
@@ -147,7 +147,7 @@ namespace ET.Server
             }
             }
             // 请求头
             // 请求头
             Dictionary<string, string> head = new Dictionary<string, string>();
             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();
             JObject param = new JObject();
             param.Add("room_id", roomId.ToString());
             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();
             Scene scene = session.DomainScene();
 
 
-            bool tokenIsNull = string.IsNullOrEmpty(request.Token.Trim());
+            bool tokenIsNull = string.IsNullOrEmpty(request.Token);
 
 
             // 预先创建数据
             // 预先创建数据
             PlayerInfo playerInfo = new PlayerInfo();
             PlayerInfo playerInfo = new PlayerInfo();
@@ -40,7 +40,7 @@ namespace ET.Server
             }
             }
             else
             else
             {
             {
-                JObject roomInfo = scene.GetComponent<GameDouyinComponent>().GetRoomInfo(request.Token.Trim());
+                JObject roomInfo = scene.GetComponent<GameDouyinComponent>().GetRoomInfo(request.Token);
 
 
                 if (roomInfo == null)
                 if (roomInfo == null)
                 {
                 {