ソースを参照

调起ios sdk的时候 传参全部改成单个字符串传参,避免json转换出现问题

gfgios 1 年間 前
コミット
414403b2a5

+ 0 - 1
GameClient/Assets/Game/HotUpdate/GameGlobal.cs

@@ -1,6 +1,5 @@
 using UnityEngine;
 using ET;
-using LitJson;
 
 namespace GFGGame
 {

+ 10 - 4
GameClient/Assets/Game/HotUpdate/Platform/QDDouYouManagerIos.cs

@@ -1,5 +1,4 @@
-using System;
-using ET;
+using ET;
 using UnityEngine;
 using GFGGame.Launcher;
 
@@ -50,6 +49,12 @@ namespace GFGGame
         {
             QDManager.PushRoleAction(DouYouRoleLogReportType.ExitGame);
         }
+        
+        // 辅助方法:处理空值
+        private static string HandleNullString(string value)
+        {
+            return string.IsNullOrEmpty(value) ? "" : value;
+        }
 
         public void Pay(int buyID, int count, string orderID, long price)
         {
@@ -80,7 +85,7 @@ namespace GFGGame
                 ItemCfg costItemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.costId);
                 if (costItemCfg == null)
                 {
-                    currencyName = $"货币_{shopCfg.costId}";
+                    currencyName = $"货币{shopCfg.costId}";
                 }
                 else
                 {
@@ -95,7 +100,7 @@ namespace GFGGame
             else
             {
                 //指定渠道商品id
-                currencyName = $"指定商品id_{shopCfg.costId}";
+                currencyName = $"指定商品id{shopCfg.costId}";
             }
             
             var zoneScene = GameGlobal.zoneScene;
@@ -134,6 +139,7 @@ namespace GFGGame
             string roleBalence = "0";
             string other = orderID + "|gfg|" + roleInfo.Id;
 
+            Debug.Log($"Ios ShowPay: cpOrderId:{cpOrderId} productPrice:{productPrice} productId:{productId} productName:{productName} productDesc:{productDesc} productCount:{productCount} exchangeRate:{exchangeRate} serverId:{serverId} serverName:{serverName} roleId:{roleId} roleName:{roleName} roleLevel:{roleLevel} roleVip:{roleVip} partyName:{partyName} roleBalence:{roleBalence} other:{other}");
             QDDouYouManagerInitIos.Instance.ShowPay(cpOrderId, productPrice, productId, productName, productDesc,
                 productCount, exchangeRate, currencyName, serverId, serverName, roleId, roleName, roleLevel, roleVip,
                 partyName, roleBalence, other);

+ 24 - 44
GameClient/Assets/Game/Launcher/Platform/QDDouYouManagerInitIos.cs

@@ -1,5 +1,4 @@
 using DouYouSdk;
-using LitJson;
 using UniFramework.Event;
 using UnityEngine;
 
@@ -78,29 +77,12 @@ namespace GFGGame.Launcher
             string serverName, string roleId, string roleName, string roleLevel, string roleVip, string partyName,
             string roleBalence, string ext)
         {
-            var data = new
-            {
-                cp_order_id = HandleNullString(cpOrderId),
-                product_price = HandleNullString(productPrice),
-                product_id = HandleNullString(productId),
-                product_name = HandleNullString(productName),
-                product_desc = HandleNullString(productDesc),
-                product_count = HandleNullString(productCount),
-                exchange_rate = HandleNullString(exchangeRate),
-                currency_name = HandleNullString(currencyName),
-                server_id = HandleNullString(serverId),
-                server_name = HandleNullString(serverName),
-                role_id = HandleNullString(roleId),
-                role_name = HandleNullString(roleName),
-                role_level = HandleNullString(roleLevel),
-                role_vip = HandleNullString(roleVip),
-                party_name = HandleNullString(partyName),
-                role_balance = HandleNullString(roleBalence),
-                ext = HandleNullString(ext)
-            };
-
-            string paymentJson = JsonMapper.ToJson(data);
-            douYouIosSDKHandler?.SdkPaymentWithJson(paymentJson);
+            Debug.Log(
+                $"QDDouYouManagerInitIos.ShowPay: cpOrderId:{cpOrderId} productPrice:{productPrice} productId:{productId} productName:{productName} productDesc:{productDesc} productCount:{productCount} exchangeRate:{exchangeRate} serverId:{serverId} serverName:{serverName} roleId:{roleId} roleName:{roleName} roleLevel:{roleLevel} roleVip:{roleVip} partyName:{partyName} roleBalence:{roleBalence} other:{ext}");
+
+            douYouIosSDKHandler.SdkPaymentWithJson(cpOrderId, productPrice, productId, productName, productDesc,
+                productCount, exchangeRate, currencyName, serverId, serverName, roleId, roleName, roleLevel, roleVip,
+                partyName, roleBalence, ext);
         }
 
         /// <summary>
@@ -118,20 +100,8 @@ namespace GFGGame.Launcher
         public void ReportRoleInfo(string type, string serverId, string serverName, string roleId, string roleName,
             string roleLevel, string roleVip, string partyName, string roleBalence)
         {
-            var data = new
-            {
-                type = HandleNullString(type),
-                server_id = HandleNullString(serverId),
-                server_name = HandleNullString(serverName),
-                role_id = HandleNullString(roleId),
-                role_name = HandleNullString(roleName),
-                role_level = HandleNullString(roleLevel),
-                role_vip = HandleNullString(roleVip),
-                party_name = HandleNullString(partyName),
-                role_balence = HandleNullString(roleBalence),
-            };
-            string roleJson = JsonMapper.ToJson(data);
-            douYouIosSDKHandler?.SDKRoleInfo(roleJson);
+            douYouIosSDKHandler?.SDKRoleInfo(type, serverId, serverName, roleId, roleName, roleLevel, roleVip,
+                partyName, roleBalence);
         }
 
         // 辅助方法:处理空值
@@ -164,17 +134,27 @@ namespace GFGGame.Launcher
             }
 
             //调起支付
-            public override void SdkPaymentWithJson(string paymentJson)
+            public override void SdkPaymentWithJson(string cpOrderId, string productPrice, string productId,
+                string productName,
+                string productDesc, string productCount, string exchangeRate, string currencyName, string serverId,
+                string serverName, string roleId, string roleName, string roleLevel, string roleVip, string partyName,
+                string roleBalence, string ext)
             {
-                base.SdkPaymentWithJson(paymentJson);
-                Debug.Log($"DouYouIosSDKHandler SdkPaymentWithJson. paymentJson:{paymentJson}");
+                base.SdkPaymentWithJson(cpOrderId, productPrice, productId, productName, productDesc,
+                    productCount, exchangeRate, currencyName, serverId, serverName, roleId, roleName, roleLevel,
+                    roleVip,
+                    partyName, roleBalence, ext);
+                Debug.Log(
+                    $"Ios ShowPay DouYouIosSDKHandler SdkPaymentWithJson: cpOrderId:{cpOrderId} productPrice:{productPrice} productId:{productId} productName:{productName} productDesc:{productDesc} productCount:{productCount} exchangeRate:{exchangeRate} serverId:{serverId} serverName:{serverName} roleId:{roleId} roleName:{roleName} roleLevel:{roleLevel} roleVip:{roleVip} partyName:{partyName} roleBalence:{roleBalence} other:{ext}");
             }
 
             //角色升级上报
-            public override void SDKRoleInfo(string roleJson)
+            public override void SDKRoleInfo(string type, string serverId, string serverName, string roleId, string roleName,
+                string roleLevel, string roleVip, string partyName, string roleBalence)
             {
-                base.SDKRoleInfo(roleJson);
-                Debug.Log($"DouYouIosSDKHandler SDKRoleInfo. roleJson:{roleJson}");
+                base.SDKRoleInfo(type, serverId, serverName, roleId, roleName, roleLevel, roleVip,
+                    partyName, roleBalence);
+                Debug.Log($"DouYouIosSDKHandler SDKRoleInfo. type:{type} serverId:{serverId} serverName:{serverName} roleId:{roleId} roleName:{roleName} roleLevel:{roleLevel} roleVip:{roleVip} partyName:{partyName} roleBalence:{roleBalence}");
             }
 
             /// <summary>

+ 20 - 8
GameClient/Assets/ThirdParty/DouYou/AbDouYouSDKIosHandler.cs

@@ -15,10 +15,14 @@ namespace DouYouSdk
         private static extern void __ImportLogout();
 
         [DllImport("__Internal", EntryPoint="__ImportPaymentWithJson")]
-        private static extern void __ImportPaymentWithJson(string paymentJson);
+        private static extern void __ImportPaymentWithJson(string cpOrderId, string productPrice, string productId, string productName,
+            string productDesc, string productCount, string exchangeRate, string currencyName, string serverId,
+            string serverName, string roleId, string roleName, string roleLevel, string roleVip, string partyName,
+            string roleBalence, string ext);
 
         [DllImport("__Internal", EntryPoint="__ImportRoleInfoWithJson")]
-        private static extern void __ImportRoleInfoWithJson(string roleJson);
+        private static extern void __ImportRoleInfoWithJson(string type, string serverId, string serverName, string roleId, string roleName,
+            string roleLevel, string roleVip, string partyName, string roleBalence);
 
         //实例化sdk
         public virtual void SDKInitWithDigitMap(string gameId, string adId, bool shouldLog)
@@ -42,17 +46,25 @@ namespace DouYouSdk
         }
 
         //调起支付
-        public virtual void SdkPaymentWithJson(string paymentJson)
+        public virtual void SdkPaymentWithJson(string cpOrderId, string productPrice, string productId, string productName,
+            string productDesc, string productCount, string exchangeRate, string currencyName, string serverId,
+            string serverName, string roleId, string roleName, string roleLevel, string roleVip, string partyName,
+            string roleBalence, string ext)
         {
-            __ImportPaymentWithJson(paymentJson);
-            Debug.Log($"SdkPaymentWithJson. paymentJson:{paymentJson}");
+            __ImportPaymentWithJson(cpOrderId, productPrice, productId, productName, productDesc,
+                productCount, exchangeRate, currencyName, serverId, serverName, roleId, roleName, roleLevel, roleVip,
+                partyName, roleBalence, ext);
+            Debug.Log($"调起支付 SdkPaymentWithJson: cpOrderId:{cpOrderId} productPrice:{productPrice} productId:{productId} productName:{productName} productDesc:{productDesc} productCount:{productCount} exchangeRate:{exchangeRate} serverId:{serverId} serverName:{serverName} roleId:{roleId} roleName:{roleName} roleLevel:{roleLevel} roleVip:{roleVip} partyName:{partyName} roleBalence:{roleBalence} other:{ext}");
+
         }
 
         //角色升级上报
-        public virtual void SDKRoleInfo(string roleJson)
+        public virtual void SDKRoleInfo(string type, string serverId, string serverName, string roleId, string roleName,
+            string roleLevel, string roleVip, string partyName, string roleBalence)
         {
-            __ImportRoleInfoWithJson(roleJson);
-            Debug.Log($"SDKRoleInfo. roleJson:{roleJson}");
+            __ImportRoleInfoWithJson(type, serverId, serverName, roleId, roleName, roleLevel, roleVip,
+                partyName, roleBalence);
+            Debug.Log($"角色上报 SDKRoleInfo. type:{type} serverId:{serverId} serverName:{serverName} roleId:{roleId} roleName:{roleName} roleLevel:{roleLevel} roleVip:{roleVip} partyName:{partyName} roleBalence:{roleBalence}");
         }
 
         //监听回调====================================