Browse Source

调整sdk交互文件入参,不再用json来做入参. 会有问题

hexiaojie 1 year ago
parent
commit
e7abc055b8

+ 0 - 34
GameClient/Assets/Plugins/iOS/StraightPush.bundle.meta

@@ -1,34 +0,0 @@
-fileFormatVersion: 2
-guid: 836c245a0eccbd040820d9b4e4ce6ebb
-folderAsset: yes
-PluginImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  iconMap: {}
-  executionOrder: {}
-  defineConstraints: []
-  isPreloaded: 0
-  isOverridable: 0
-  isExplicitlyReferenced: 0
-  validateReferences: 1
-  platformData:
-  - first:
-      Any: 
-    second:
-      enabled: 0
-      settings: {}
-  - first:
-      Editor: Editor
-    second:
-      enabled: 0
-      settings:
-        DefaultValueInitialized: true
-  - first:
-      iPhone: iOS
-    second:
-      enabled: 1
-      settings:
-        AddToEmbeddedBinaries: false
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 34
GameClient/Assets/Plugins/iOS/StraightPush.framework.meta

@@ -1,34 +0,0 @@
-fileFormatVersion: 2
-guid: 946143179073e314394b751f0a18f935
-folderAsset: yes
-PluginImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  iconMap: {}
-  executionOrder: {}
-  defineConstraints: []
-  isPreloaded: 0
-  isOverridable: 0
-  isExplicitlyReferenced: 0
-  validateReferences: 1
-  platformData:
-  - first:
-      Any: 
-    second:
-      enabled: 0
-      settings: {}
-  - first:
-      Editor: Editor
-    second:
-      enabled: 0
-      settings:
-        DefaultValueInitialized: true
-  - first:
-      iPhone: iOS
-    second:
-      enabled: 1
-      settings:
-        AddToEmbeddedBinaries: false
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 2 - 2
GameClient/Assets/Plugins/iOS/StraightPush/SDKManager.h

@@ -16,7 +16,7 @@
 - (void)InitWithDigitMap:(NSString *)gameId ring:(NSString *)adId shouldLog:(BOOL)shouldLog;
 - (void)InitWithDigitMap:(NSString *)gameId ring:(NSString *)adId shouldLog:(BOOL)shouldLog;
 - (void)Login;
 - (void)Login;
 - (void)Logout;
 - (void)Logout;
-- (void)PaymentWithJson:(NSString *)paymentJson;
-- (void)RoleInfoWithJson:(NSString *)roleJson;
+- (void)PaymentWithJson:(NSDictionary *)paymentInfo;
+- (void)RoleInfoWithJson:(NSDictionary *)roleInfo;
 
 
 @end
 @end

+ 2 - 22
GameClient/Assets/Plugins/iOS/StraightPush/SDKManager.m

@@ -69,17 +69,7 @@
 }
 }
 
 
 // 调起支付
 // 调起支付
-- (void)PaymentWithJson:(NSString *)paymentJson {
-    NSData *jsonData = [paymentJson dataUsingEncoding:NSUTF8StringEncoding];
-    NSError *jsonError;
-    NSDictionary *paymentInfo = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&jsonError];
-    
-    if (jsonError) {
-        NSLog(@"JSON解析失败: %@", jsonError);
-        [self sendErrorToUnity:jsonError gameObject:"IosReceiverGameObj" methodName:"RoleInfoReportError"];
-        return;
-    }
-    
+- (void)PaymentWithJson:(NSDictionary *)paymentInfo {
     [[PullInter bringInstance] hexSlabBlock:paymentInfo focusedBlock:^(NSDictionary *params) {
     [[PullInter bringInstance] hexSlabBlock:paymentInfo focusedBlock:^(NSDictionary *params) {
         if (self.shouldLog) {
         if (self.shouldLog) {
             NSLog(@"支付成功:%@", params);
             NSLog(@"支付成功:%@", params);
@@ -94,17 +84,7 @@
 }
 }
 
 
 // 角色升级上报
 // 角色升级上报
-- (void)RoleInfoWithJson:(NSString *)roleJson {
-    NSData *jsonData = [roleJson dataUsingEncoding:NSUTF8StringEncoding];
-    NSError *jsonError;
-    NSDictionary *roleInfo = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&jsonError];
-    
-    if (jsonError) {
-        NSLog(@"JSON解析失败: %@", jsonError);
-        [self sendErrorToUnity:jsonError gameObject:"IosReceiverGameObj" methodName:"RoleInfoReportError"];
-        return;
-    }
-    
+- (void)RoleInfoWithJson:(NSDictionary *)roleInfo {
     [[PullInter bringInstance] georgianDrumBlock:roleInfo focusedBlock:^(NSDictionary *params) {
     [[PullInter bringInstance] georgianDrumBlock:roleInfo focusedBlock:^(NSDictionary *params) {
         if (self.shouldLog) {
         if (self.shouldLog) {
             NSLog(@"角色升级上报成功:%@", params);
             NSLog(@"角色升级上报成功:%@", params);

+ 39 - 8
GameClient/Assets/Plugins/iOS/StraightPush/SDKManagerExt.mm

@@ -17,14 +17,45 @@ void __ImportLogout() {
 [[SDKManager sharedInstance] Logout];
 [[SDKManager sharedInstance] Logout];
 }
 }
 
 
-void __ImportPaymentWithJson(const char *paymentJson) {
-NSString *paymentJsonStr = [NSString stringWithUTF8String:paymentJson];
-[[SDKManager sharedInstance] PaymentWithJson:paymentJsonStr];
-}
-
-void __ImportRoleInfoWithJson(const char *roleJson) {
-NSString *roleJsonStr = [NSString stringWithUTF8String:roleJson];
-[[SDKManager sharedInstance] RoleInfoWithJson:roleJsonStr];
+void __ImportPaymentWithJson(const char *cpOrderId, const char *productPrice, const char *productId, const char *productName,
+            const char *productDesc, const char *productCount, const char *exchangeRate, const char *currencyName, const char *serverId,
+            const char *serverName, const char *roleId, const char *roleName, const char *roleLevel, const char *roleVip, const char *partyName,
+            const char *roleBalence, const char *ext) {
+                NSDictionary *bayInfo = @{
+                @"product_id": productId ?: @"",
+                @"product_price" :productPrice ?: @"",
+                @"product_name" :productName ?: @"",
+                @"role_id" : roleId ?: @"",
+                @"role_name" : roleName ?: @"",
+                @"role_level" : roleLevel ?: @"",
+                @"server_id" : serverId ?: @"",
+                @"server_name": serverName ?: @"",
+                @"role_vip" : roleVip ?: @"",
+                @"party_name" : partyName ?: @"",
+                @"role_balence" : roleBalence ?: @"",
+                @"cp_order_id" : cpOrderId ?: @"",
+                @"product_count" : productCount ?: @"",
+                @"product_desc" : productDesc ?: @"",
+                @"exchange_rate" : exchangeRate ?: @"",
+                @"currency_name" : currencyName ?: @"",
+                @"ext" : ext ?: @"",
+            };
+          [[SDKManager sharedInstance] PaymentWithJson:bayInfo];
 }
 }
 
 
+void __ImportRoleInfoWithJson(const char *type, const char *serverId, const char *serverName, const char *roleId, const char *roleName,
+            const char *roleLevel, const char *roleVip, const char *partyName, const char *roleBalence) {
+            NSDictionary *roleInfo = @{
+            @"type" : type ?: @"",
+            @"server_id" : serverId ?: @"",
+            @"server_name" :serverName ?: @"",
+            @"role_id" : roleId ?: @"",
+            @"role_name" : roleName ?: @"",
+            @"role_level" : roleLevel ?: @"",
+            @"role_vip" : roleVip ?: @"",
+            @"party_name" :partyName ?: @"",
+            @"role_balence" : roleBalence ?: @"" 
+        };
+        [[SDKManager sharedInstance] RoleInfoWithJson:roleInfo];
+    }
 }
 }

+ 0 - 8
GameClient/Assets/Plugins/iOS/TrackingIOSDK.xcframework.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: d151cd60caba549248280692b3bf42e2
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: