lizhihui

更新190214版本

#import <Foundation/Foundation.h>
#import "OtherSetting.h"
@interface RailwayHaiBaoJuheBaseModel : NSObject
@interface HNYouaiHaiBaoJuheBaseModel : NSObject
- (NSString *)RailwayHaiBaoJuheObjectToJsonString;
- (NSString *)HNYouaiHaiBaoJuheObjectToJsonString;
- (NSMutableString *)paramAddToString;
- (id)initWithDiction:(NSDictionary *)diction;
......
......@@ -11,7 +11,7 @@ typedef NS_ENUM(NSInteger, DGLoggerLevel)
ELogError
};
@interface RailwayHaiBaoJuheDGLogger : NSObject
@interface HNYouaiHaiBaoJuheDGLogger : NSObject
+ (void)showLog:(NSString *)fmt,...;
......
......@@ -15,11 +15,11 @@
- (void)initChecker;
- (void)startCheck:(HaiBaoJuheLoginInfo *)loginInfo;
- (void) createOrder:(HaiBaoJuheCreateOrderInfo *)gzyazfInfo;
- (void) RailwayHaiBaoJuhereportOpen;
- (void) RailwayHaiBaoJuhereportSDKOpen;
- (void)RailwayHaiBaoJuhehandleFirstOpenApp:(NSString*) path;
- (void) HNYouaiHaiBaoJuhereportOpen;
- (void) HNYouaiHaiBaoJuhereportSDKOpen;
- (void)HNYouaiHaiBaoJuhehandleFirstOpenApp:(NSString*) path;
- (void) reportEnter:(HaiBaoJuheReportInfo *)reInfo;
- (void) RailwayHaiBaoJuheReport:(NSString *)_action :(HaiBaoJuheReportInfo *)reInfo;
- (void) HNYouaiHaiBaoJuheReport:(NSString *)_action :(HaiBaoJuheReportInfo *)reInfo;
- (void)sendNotice:(HaiBaoJuheSDKNotificationType)notiType
notiName:(NSString *)notiName
statusCode:(int)nCode
......@@ -28,7 +28,7 @@
- (void)startCheckDelegate:(HaiBaoJuheLoginInfo *)loginInfo;
- (void)RailwayHaiBaoJuheStartCheckDelegate:(HaiBaoJuheLoginInfo *)loginInfo type:(int)type;
- (void)HNYouaiHaiBaoJuheStartCheckDelegate:(HaiBaoJuheLoginInfo *)loginInfo type:(int)type;
/*
*初始化时调用
......
#import "HaiBaoJuheSDK/RailwayHaiBaoJuheBaseModel.h"
@interface HaiBaoJuheCreateOrderInfo : RailwayHaiBaoJuheBaseModel
#import "HaiBaoJuheSDK/HNYouaiHaiBaoJuheBaseModel.h"
@interface HaiBaoJuheCreateOrderInfo : HNYouaiHaiBaoJuheBaseModel
@property(nonatomic,strong)NSString *serverId;//服务器ID
@property(nonatomic, strong)NSString *serverName;//服务器名称
......@@ -16,7 +16,7 @@
@property(nonatomic, strong)NSString *userId;//用户ID
@property(nonatomic, strong)NSString *timestamp;//时间戳
- (NSString *) RailwayHaiBaoJuheGetTsign ;
- (NSString *) RailwayHaiBaoJuheGetTimestamp ;
- (NSString *) HNYouaiHaiBaoJuheGetTsign ;
- (NSString *) HNYouaiHaiBaoJuheGetTimestamp ;
@end
......
#import "HaiBaoJuheSDK/RailwayHaiBaoJuheBaseModel.h"
@interface HaiBaoJuheGzyazfInfo : RailwayHaiBaoJuheBaseModel
#import "HaiBaoJuheSDK/HNYouaiHaiBaoJuheBaseModel.h"
@interface HaiBaoJuheGzyazfInfo : HNYouaiHaiBaoJuheBaseModel
@property(nonatomic, strong)NSString *serverId;
@property(nonatomic, strong)NSString *queryId;
......
#import "HaiBaoJuheSDK/RailwayHaiBaoJuheBaseModel.h"
@interface HaiBaoJuheLoginInfo : RailwayHaiBaoJuheBaseModel
#import "HaiBaoJuheSDK/HNYouaiHaiBaoJuheBaseModel.h"
@interface HaiBaoJuheLoginInfo : HNYouaiHaiBaoJuheBaseModel
@property(nonatomic,strong)NSString *timestamp;
@property(nonatomic, strong)NSString *sign;
......
//
// RailwayHaiBaoJuheReportInfo.h
// HNYouaiHaiBaoJuheReportInfo.h
// HaiBaoJuheSDK
//
// Created by winFan on 12/21/15.
// Copyright (c) 2015 winFan. All rights reserved.
//
#import "HaiBaoJuheSDK/RailwayHaiBaoJuheBaseModel.h"
@interface HaiBaoJuheReportInfo : RailwayHaiBaoJuheBaseModel
#import "HaiBaoJuheSDK/HNYouaiHaiBaoJuheBaseModel.h"
@interface HaiBaoJuheReportInfo : HNYouaiHaiBaoJuheBaseModel
@property(nonatomic, strong)NSString *reportType;//类型
@property(nonatomic, strong)NSString *playerId;//玩家ID
......
......@@ -4,7 +4,7 @@
@interface HaiBaoJuheUtils : NSObject
+(NSString *)md5:(NSString *)str;
+ (NSDictionary *)RailwayHaiBaoJuheDictionaryWithJsonString:(NSString *)jsonString;
+ (NSDictionary *)HNYouaiHaiBaoJuheDictionaryWithJsonString:(NSString *)jsonString;
+(NSString *)createGzyazfOrderUrl;
//*充值回调地址
+(NSString *)createGzyazfUrl;
......
......@@ -10,7 +10,7 @@
@property(assign) BOOL HNYouaiYouYuanJiao;
- (void)HNYouaiSettingCKAssetsView:(int)webViewWidth :(int) webViewHeight :(int) screenwidth :(int) screenHeight;
- (void)HNYouaiSettingHNYouaiView:(int)webViewWidth :(int) webViewHeight :(int) screenwidth :(int) screenHeight;
- (void)HNYouaiChuShiHuaWebView;
- (void)loadWebPageWithString:(NSString *)url;
- (void)loadWebPageWithJs:(NSString *)content;
......
......@@ -12,6 +12,7 @@
int mExchange;
NSString *HNYouaiAppId;
NSString *HNYouaiAppKey;
NSString *HNYouaiLeakOrderUrl;
- (void)SDKinit:(UIViewController *) control
{
......@@ -81,35 +82,35 @@ NSString *HNYouaiAppKey;
- (void)HCKAssetsToolCallBack:(NSNotification *)notification
{
NSDictionary* payResultDic = notification.object;
NSString* receiptStr = [payResultDic objectForKey:@"HNYouaiToolResult"];
NSString* queryId = [payResultDic objectForKey:@"query_id"];
NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil];
NSString* result = [[NetCenter getInstance] httpPostSyn:[HaiBaoJuheUtils createGzyazfUrl] :receiptDic];
//收到回调,保存queryid和data
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
NSMutableArray* queryIdArray = [userDefaults objectForKey:@"queryIds"];
NSMutableArray* tempQueryIdArray = [[NSMutableArray alloc] initWithCapacity:10];
if (queryIdArray) {
}else{
queryIdArray = [[NSMutableArray alloc]initWithCapacity:10];
}
for (NSString* arrayQueryId in queryIdArray) {
[tempQueryIdArray addObject:arrayQueryId];
}
[tempQueryIdArray addObject:queryId];
[userDefaults setObject:tempQueryIdArray forKey:@"queryIds"];
[userDefaults setObject:receiptStr forKey:queryId];
NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil];
NSString* result = [[NetCenter getInstance] httpPostSyn:HNYouaiLeakOrderUrl :receiptDic];
if([@"success" isEqualToString:result]){//确认订单成功
}else{//失败
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
NSMutableArray* queryIdArray = [userDefaults objectForKey:@"queryIds"];
NSMutableArray* tempQueryIdArray = [[NSMutableArray alloc] initWithCapacity:10];
if (queryIdArray) {
}else{
queryIdArray = [[NSMutableArray alloc]initWithCapacity:10];
}
for (NSString* arrayQueryId in queryIdArray) {
[tempQueryIdArray addObject:arrayQueryId];
}
[tempQueryIdArray addObject:queryId];
//删除已保存的
[userDefaults removeObjectForKey:queryId];
[tempQueryIdArray removeObject:queryId];
[userDefaults setObject:tempQueryIdArray forKey:@"queryIds"];
[userDefaults setObject:receiptStr forKey:queryId];
[userDefaults synchronize];
[userDefaults removeObjectForKey:@"lastqueryid"];
}
[userDefaults synchronize];
}
/**
......@@ -117,8 +118,38 @@ NSString *HNYouaiAppKey;
*/
- (void)SDKgzyazfWithGzyazfmentInfo:(HaiBaoJuheCreateOrderInfo *)payInfo
{
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
NSString* lastqueryid = [userDefaults objectForKey:@"lastqueryid"];
HNYouaiLeakOrderUrl = [[NSString alloc] initWithFormat:@"%@?uid=%@&playerid=%@",
[HaiBaoJuheUtils createGzyazfUrl],
[payInfo userId],
[payInfo playerId]];
[userDefaults setObject:HNYouaiLeakOrderUrl forKey:@"lastHNYouaiLeakOrderUrl"];
if (lastqueryid!=nil) {
//创建订单前进行补单
NSData* receiptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
NSString* receiptStr = [receiptData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
if (receiptStr!=nil) {
receiptStr = [receiptStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
//如果不为空,进行最后一次补单
NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",lastqueryid,@"query_id", nil];
NSString* result = [[NetCenter getInstance] httpPostSyn:HNYouaiLeakOrderUrl :receiptDic];
if([@"success" isEqualToString:result]){//确认订单成功
//删除已保存的
[userDefaults removeObjectForKey:@"lastqueryid"];
}
}
}
mExchange = [payInfo exchange].intValue;
[super SDKgzyazfWithGzyazfmentInfo:payInfo];
HNYouaiLeakOrderUrl = [[NSString alloc] initWithFormat:@"%@?uid=%@&playerid=%@",
[HaiBaoJuheUtils createGzyazfUrl],
[payInfo userId],
[payInfo playerId]];
[userDefaults synchronize];
}
/**
......@@ -181,7 +212,13 @@ NSString *HNYouaiAppKey;
for (NSString* queryId in queryIdArray) {
NSString* receiptStr = [userDefaults valueForKey:queryId];
NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil];
NSString* result = [[NetCenter getInstance] httpPostSyn:[HaiBaoJuheUtils createGzyazfUrl] :receiptDic];
NSString* lastHNYouaiLeakOrderUrl = [userDefaults objectForKey:@"lastHNYouaiLeakOrderUrl"];
NSString* result;
if (lastHNYouaiLeakOrderUrl!=nil) {
result = [[NetCenter getInstance] httpPostSyn:lastHNYouaiLeakOrderUrl :receiptDic];
}else{
result = [[NetCenter getInstance] httpPostSyn:[HaiBaoJuheUtils createGzyazfUrl] :receiptDic];
}
if([@"success" isEqualToString:result]){//成功
[userDefaults removeObjectForKey:queryId];
}else{//补单失败
......@@ -219,6 +256,10 @@ NSString *HNYouaiAppKey;
[[HNYouaiAllManager HNYouaiInstance] HNYouaiQuery:serverId :roleName :amount :[payInfo queryId] :self.controller :[payInfo serverName]];
}else{
NSString* products = [payInfo products];
//保存订单号到本地
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:queryId forKey:@"lastqueryid"];
[userDefaults synchronize];
[[HNYouaiAllManager HNYouaiInstance] HNYouaiQueryOperation:self.controller HNYouaiHuoWuID:products HNYouaiJiaGe:[payInfo postAmount] HNYouaiHuoWuMing:[payInfo productName] HNYouaiDingDanHao:queryId];
}
}
......