lizhihui

更新190214版本

1 #import <Foundation/Foundation.h> 1 #import <Foundation/Foundation.h>
2 #import "OtherSetting.h" 2 #import "OtherSetting.h"
3 3
4 -@interface RailwayHaiBaoJuheBaseModel : NSObject 4 +@interface HNYouaiHaiBaoJuheBaseModel : NSObject
5 5
6 -- (NSString *)RailwayHaiBaoJuheObjectToJsonString; 6 +- (NSString *)HNYouaiHaiBaoJuheObjectToJsonString;
7 - (NSMutableString *)paramAddToString; 7 - (NSMutableString *)paramAddToString;
8 - (id)initWithDiction:(NSDictionary *)diction; 8 - (id)initWithDiction:(NSDictionary *)diction;
9 9
......
...@@ -11,7 +11,7 @@ typedef NS_ENUM(NSInteger, DGLoggerLevel) ...@@ -11,7 +11,7 @@ typedef NS_ENUM(NSInteger, DGLoggerLevel)
11 ELogError 11 ELogError
12 }; 12 };
13 13
14 -@interface RailwayHaiBaoJuheDGLogger : NSObject 14 +@interface HNYouaiHaiBaoJuheDGLogger : NSObject
15 15
16 + (void)showLog:(NSString *)fmt,...; 16 + (void)showLog:(NSString *)fmt,...;
17 17
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
15 - (void)initChecker; 15 - (void)initChecker;
16 - (void)startCheck:(HaiBaoJuheLoginInfo *)loginInfo; 16 - (void)startCheck:(HaiBaoJuheLoginInfo *)loginInfo;
17 - (void) createOrder:(HaiBaoJuheCreateOrderInfo *)gzyazfInfo; 17 - (void) createOrder:(HaiBaoJuheCreateOrderInfo *)gzyazfInfo;
18 -- (void) RailwayHaiBaoJuhereportOpen; 18 +- (void) HNYouaiHaiBaoJuhereportOpen;
19 -- (void) RailwayHaiBaoJuhereportSDKOpen; 19 +- (void) HNYouaiHaiBaoJuhereportSDKOpen;
20 -- (void)RailwayHaiBaoJuhehandleFirstOpenApp:(NSString*) path; 20 +- (void)HNYouaiHaiBaoJuhehandleFirstOpenApp:(NSString*) path;
21 - (void) reportEnter:(HaiBaoJuheReportInfo *)reInfo; 21 - (void) reportEnter:(HaiBaoJuheReportInfo *)reInfo;
22 -- (void) RailwayHaiBaoJuheReport:(NSString *)_action :(HaiBaoJuheReportInfo *)reInfo; 22 +- (void) HNYouaiHaiBaoJuheReport:(NSString *)_action :(HaiBaoJuheReportInfo *)reInfo;
23 - (void)sendNotice:(HaiBaoJuheSDKNotificationType)notiType 23 - (void)sendNotice:(HaiBaoJuheSDKNotificationType)notiType
24 notiName:(NSString *)notiName 24 notiName:(NSString *)notiName
25 statusCode:(int)nCode 25 statusCode:(int)nCode
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
28 28
29 - (void)startCheckDelegate:(HaiBaoJuheLoginInfo *)loginInfo; 29 - (void)startCheckDelegate:(HaiBaoJuheLoginInfo *)loginInfo;
30 30
31 -- (void)RailwayHaiBaoJuheStartCheckDelegate:(HaiBaoJuheLoginInfo *)loginInfo type:(int)type; 31 +- (void)HNYouaiHaiBaoJuheStartCheckDelegate:(HaiBaoJuheLoginInfo *)loginInfo type:(int)type;
32 32
33 /* 33 /*
34 *初始化时调用 34 *初始化时调用
......
1 -#import "HaiBaoJuheSDK/RailwayHaiBaoJuheBaseModel.h" 1 +#import "HaiBaoJuheSDK/HNYouaiHaiBaoJuheBaseModel.h"
2 -@interface HaiBaoJuheCreateOrderInfo : RailwayHaiBaoJuheBaseModel 2 +@interface HaiBaoJuheCreateOrderInfo : HNYouaiHaiBaoJuheBaseModel
3 3
4 @property(nonatomic,strong)NSString *serverId;//服务器ID 4 @property(nonatomic,strong)NSString *serverId;//服务器ID
5 @property(nonatomic, strong)NSString *serverName;//服务器名称 5 @property(nonatomic, strong)NSString *serverName;//服务器名称
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 @property(nonatomic, strong)NSString *userId;//用户ID 16 @property(nonatomic, strong)NSString *userId;//用户ID
17 @property(nonatomic, strong)NSString *timestamp;//时间戳 17 @property(nonatomic, strong)NSString *timestamp;//时间戳
18 18
19 -- (NSString *) RailwayHaiBaoJuheGetTsign ; 19 +- (NSString *) HNYouaiHaiBaoJuheGetTsign ;
20 -- (NSString *) RailwayHaiBaoJuheGetTimestamp ; 20 +- (NSString *) HNYouaiHaiBaoJuheGetTimestamp ;
21 21
22 @end 22 @end
......
1 -#import "HaiBaoJuheSDK/RailwayHaiBaoJuheBaseModel.h" 1 +#import "HaiBaoJuheSDK/HNYouaiHaiBaoJuheBaseModel.h"
2 -@interface HaiBaoJuheGzyazfInfo : RailwayHaiBaoJuheBaseModel 2 +@interface HaiBaoJuheGzyazfInfo : HNYouaiHaiBaoJuheBaseModel
3 3
4 @property(nonatomic, strong)NSString *serverId; 4 @property(nonatomic, strong)NSString *serverId;
5 @property(nonatomic, strong)NSString *queryId; 5 @property(nonatomic, strong)NSString *queryId;
......
1 -#import "HaiBaoJuheSDK/RailwayHaiBaoJuheBaseModel.h" 1 +#import "HaiBaoJuheSDK/HNYouaiHaiBaoJuheBaseModel.h"
2 -@interface HaiBaoJuheLoginInfo : RailwayHaiBaoJuheBaseModel 2 +@interface HaiBaoJuheLoginInfo : HNYouaiHaiBaoJuheBaseModel
3 3
4 @property(nonatomic,strong)NSString *timestamp; 4 @property(nonatomic,strong)NSString *timestamp;
5 @property(nonatomic, strong)NSString *sign; 5 @property(nonatomic, strong)NSString *sign;
......
1 // 1 //
2 -// RailwayHaiBaoJuheReportInfo.h 2 +// HNYouaiHaiBaoJuheReportInfo.h
3 // HaiBaoJuheSDK 3 // HaiBaoJuheSDK
4 // 4 //
5 // Created by winFan on 12/21/15. 5 // Created by winFan on 12/21/15.
6 // Copyright (c) 2015 winFan. All rights reserved. 6 // Copyright (c) 2015 winFan. All rights reserved.
7 // 7 //
8 8
9 -#import "HaiBaoJuheSDK/RailwayHaiBaoJuheBaseModel.h" 9 +#import "HaiBaoJuheSDK/HNYouaiHaiBaoJuheBaseModel.h"
10 -@interface HaiBaoJuheReportInfo : RailwayHaiBaoJuheBaseModel 10 +@interface HaiBaoJuheReportInfo : HNYouaiHaiBaoJuheBaseModel
11 11
12 @property(nonatomic, strong)NSString *reportType;//类型 12 @property(nonatomic, strong)NSString *reportType;//类型
13 @property(nonatomic, strong)NSString *playerId;//玩家ID 13 @property(nonatomic, strong)NSString *playerId;//玩家ID
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 @interface HaiBaoJuheUtils : NSObject 4 @interface HaiBaoJuheUtils : NSObject
5 5
6 +(NSString *)md5:(NSString *)str; 6 +(NSString *)md5:(NSString *)str;
7 -+ (NSDictionary *)RailwayHaiBaoJuheDictionaryWithJsonString:(NSString *)jsonString; 7 ++ (NSDictionary *)HNYouaiHaiBaoJuheDictionaryWithJsonString:(NSString *)jsonString;
8 +(NSString *)createGzyazfOrderUrl; 8 +(NSString *)createGzyazfOrderUrl;
9 //*充值回调地址 9 //*充值回调地址
10 +(NSString *)createGzyazfUrl; 10 +(NSString *)createGzyazfUrl;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
10 10
11 @property(assign) BOOL HNYouaiYouYuanJiao; 11 @property(assign) BOOL HNYouaiYouYuanJiao;
12 12
13 -- (void)HNYouaiSettingCKAssetsView:(int)webViewWidth :(int) webViewHeight :(int) screenwidth :(int) screenHeight; 13 +- (void)HNYouaiSettingHNYouaiView:(int)webViewWidth :(int) webViewHeight :(int) screenwidth :(int) screenHeight;
14 - (void)HNYouaiChuShiHuaWebView; 14 - (void)HNYouaiChuShiHuaWebView;
15 - (void)loadWebPageWithString:(NSString *)url; 15 - (void)loadWebPageWithString:(NSString *)url;
16 - (void)loadWebPageWithJs:(NSString *)content; 16 - (void)loadWebPageWithJs:(NSString *)content;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
12 int mExchange; 12 int mExchange;
13 NSString *HNYouaiAppId; 13 NSString *HNYouaiAppId;
14 NSString *HNYouaiAppKey; 14 NSString *HNYouaiAppKey;
15 +NSString *HNYouaiLeakOrderUrl;
15 16
16 - (void)SDKinit:(UIViewController *) control 17 - (void)SDKinit:(UIViewController *) control
17 { 18 {
...@@ -81,35 +82,35 @@ NSString *HNYouaiAppKey; ...@@ -81,35 +82,35 @@ NSString *HNYouaiAppKey;
81 - (void)HCKAssetsToolCallBack:(NSNotification *)notification 82 - (void)HCKAssetsToolCallBack:(NSNotification *)notification
82 { 83 {
83 NSDictionary* payResultDic = notification.object; 84 NSDictionary* payResultDic = notification.object;
84 -
85 NSString* receiptStr = [payResultDic objectForKey:@"HNYouaiToolResult"]; 85 NSString* receiptStr = [payResultDic objectForKey:@"HNYouaiToolResult"];
86 NSString* queryId = [payResultDic objectForKey:@"query_id"]; 86 NSString* queryId = [payResultDic objectForKey:@"query_id"];
87 87
88 - NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil]; 88 + //收到回调,保存queryid和data
89 - NSString* result = [[NetCenter getInstance] httpPostSyn:[HaiBaoJuheUtils createGzyazfUrl] :receiptDic]; 89 + NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
90 + NSMutableArray* queryIdArray = [userDefaults objectForKey:@"queryIds"];
91 + NSMutableArray* tempQueryIdArray = [[NSMutableArray alloc] initWithCapacity:10];
92 + if (queryIdArray) {
93 + }else{
94 + queryIdArray = [[NSMutableArray alloc]initWithCapacity:10];
95 + }
96 + for (NSString* arrayQueryId in queryIdArray) {
97 + [tempQueryIdArray addObject:arrayQueryId];
98 + }
99 + [tempQueryIdArray addObject:queryId];
100 + [userDefaults setObject:tempQueryIdArray forKey:@"queryIds"];
101 + [userDefaults setObject:receiptStr forKey:queryId];
90 102
103 + NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil];
104 + NSString* result = [[NetCenter getInstance] httpPostSyn:HNYouaiLeakOrderUrl :receiptDic];
91 105
92 if([@"success" isEqualToString:result]){//确认订单成功 106 if([@"success" isEqualToString:result]){//确认订单成功
93 - }else{//失败 107 + //删除已保存的
94 - NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; 108 + [userDefaults removeObjectForKey:queryId];
95 - NSMutableArray* queryIdArray = [userDefaults objectForKey:@"queryIds"]; 109 + [tempQueryIdArray removeObject:queryId];
96 -
97 - NSMutableArray* tempQueryIdArray = [[NSMutableArray alloc] initWithCapacity:10];
98 -
99 - if (queryIdArray) {
100 - }else{
101 - queryIdArray = [[NSMutableArray alloc]initWithCapacity:10];
102 - }
103 -
104 - for (NSString* arrayQueryId in queryIdArray) {
105 - [tempQueryIdArray addObject:arrayQueryId];
106 - }
107 -
108 - [tempQueryIdArray addObject:queryId];
109 [userDefaults setObject:tempQueryIdArray forKey:@"queryIds"]; 110 [userDefaults setObject:tempQueryIdArray forKey:@"queryIds"];
110 - [userDefaults setObject:receiptStr forKey:queryId]; 111 + [userDefaults removeObjectForKey:@"lastqueryid"];
111 - [userDefaults synchronize];
112 } 112 }
113 + [userDefaults synchronize];
113 } 114 }
114 115
115 /** 116 /**
...@@ -117,8 +118,38 @@ NSString *HNYouaiAppKey; ...@@ -117,8 +118,38 @@ NSString *HNYouaiAppKey;
117 */ 118 */
118 - (void)SDKgzyazfWithGzyazfmentInfo:(HaiBaoJuheCreateOrderInfo *)payInfo 119 - (void)SDKgzyazfWithGzyazfmentInfo:(HaiBaoJuheCreateOrderInfo *)payInfo
119 { 120 {
121 + NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
122 + NSString* lastqueryid = [userDefaults objectForKey:@"lastqueryid"];
123 +
124 + HNYouaiLeakOrderUrl = [[NSString alloc] initWithFormat:@"%@?uid=%@&playerid=%@",
125 + [HaiBaoJuheUtils createGzyazfUrl],
126 + [payInfo userId],
127 + [payInfo playerId]];
128 + [userDefaults setObject:HNYouaiLeakOrderUrl forKey:@"lastHNYouaiLeakOrderUrl"];
129 +
130 + if (lastqueryid!=nil) {
131 + //创建订单前进行补单
132 + NSData* receiptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
133 + NSString* receiptStr = [receiptData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
134 + if (receiptStr!=nil) {
135 + receiptStr = [receiptStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
136 + //如果不为空,进行最后一次补单
137 + NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",lastqueryid,@"query_id", nil];
138 + NSString* result = [[NetCenter getInstance] httpPostSyn:HNYouaiLeakOrderUrl :receiptDic];
139 + if([@"success" isEqualToString:result]){//确认订单成功
140 + //删除已保存的
141 + [userDefaults removeObjectForKey:@"lastqueryid"];
142 + }
143 + }
144 + }
145 +
120 mExchange = [payInfo exchange].intValue; 146 mExchange = [payInfo exchange].intValue;
121 [super SDKgzyazfWithGzyazfmentInfo:payInfo]; 147 [super SDKgzyazfWithGzyazfmentInfo:payInfo];
148 + HNYouaiLeakOrderUrl = [[NSString alloc] initWithFormat:@"%@?uid=%@&playerid=%@",
149 + [HaiBaoJuheUtils createGzyazfUrl],
150 + [payInfo userId],
151 + [payInfo playerId]];
152 + [userDefaults synchronize];
122 } 153 }
123 154
124 /** 155 /**
...@@ -181,7 +212,13 @@ NSString *HNYouaiAppKey; ...@@ -181,7 +212,13 @@ NSString *HNYouaiAppKey;
181 for (NSString* queryId in queryIdArray) { 212 for (NSString* queryId in queryIdArray) {
182 NSString* receiptStr = [userDefaults valueForKey:queryId]; 213 NSString* receiptStr = [userDefaults valueForKey:queryId];
183 NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil]; 214 NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil];
184 - NSString* result = [[NetCenter getInstance] httpPostSyn:[HaiBaoJuheUtils createGzyazfUrl] :receiptDic]; 215 + NSString* lastHNYouaiLeakOrderUrl = [userDefaults objectForKey:@"lastHNYouaiLeakOrderUrl"];
216 + NSString* result;
217 + if (lastHNYouaiLeakOrderUrl!=nil) {
218 + result = [[NetCenter getInstance] httpPostSyn:lastHNYouaiLeakOrderUrl :receiptDic];
219 + }else{
220 + result = [[NetCenter getInstance] httpPostSyn:[HaiBaoJuheUtils createGzyazfUrl] :receiptDic];
221 + }
185 if([@"success" isEqualToString:result]){//成功 222 if([@"success" isEqualToString:result]){//成功
186 [userDefaults removeObjectForKey:queryId]; 223 [userDefaults removeObjectForKey:queryId];
187 }else{//补单失败 224 }else{//补单失败
...@@ -219,6 +256,10 @@ NSString *HNYouaiAppKey; ...@@ -219,6 +256,10 @@ NSString *HNYouaiAppKey;
219 [[HNYouaiAllManager HNYouaiInstance] HNYouaiQuery:serverId :roleName :amount :[payInfo queryId] :self.controller :[payInfo serverName]]; 256 [[HNYouaiAllManager HNYouaiInstance] HNYouaiQuery:serverId :roleName :amount :[payInfo queryId] :self.controller :[payInfo serverName]];
220 }else{ 257 }else{
221 NSString* products = [payInfo products]; 258 NSString* products = [payInfo products];
259 + //保存订单号到本地
260 + NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
261 + [userDefaults setObject:queryId forKey:@"lastqueryid"];
262 + [userDefaults synchronize];
222 [[HNYouaiAllManager HNYouaiInstance] HNYouaiQueryOperation:self.controller HNYouaiHuoWuID:products HNYouaiJiaGe:[payInfo postAmount] HNYouaiHuoWuMing:[payInfo productName] HNYouaiDingDanHao:queryId]; 263 [[HNYouaiAllManager HNYouaiInstance] HNYouaiQueryOperation:self.controller HNYouaiHuoWuID:products HNYouaiJiaGe:[payInfo postAmount] HNYouaiHuoWuMing:[payInfo productName] HNYouaiDingDanHao:queryId];
223 } 264 }
224 } 265 }
......