Commit ffda5a02 by lee

u timeout

parent f8f9c8a3
......@@ -166,12 +166,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
NSURL *url = [NSURL URLWithString:self.baseUrl];
AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:url];
//设置超时时间为10秒
[sessionManager.requestSerializer willChangeValueForKey:@"timeoutInterval"];
// [sessionManager.requestSerializer willChangeValueForKey:@"timeoutInterval"];
sessionManager.requestSerializer.timeoutInterval = 10.f;
[sessionManager.requestSerializer didChangeValueForKey:@"timeoutInterval"];
// [sessionManager.requestSerializer didChangeValueForKey:@"timeoutInterval"];
if (isJsonParameter) {
sessionManager.requestSerializer = [AFJSONRequestSerializer serializerWithWritingOptions:0];
......@@ -199,6 +197,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
apiPath:(NSString *)apiPath
parameters:(NSDictionary *)parameters
filePaths:(NSDictionary *)filePaths
timeout:(NSTimeInterval) timeout
images:(NSArray *)images
jsonParameter:(BOOL)isJsonParameter
result:(Class)result
......@@ -219,6 +218,9 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
success:success
failure:failure];
AFHTTPSessionManager *sessionManager = [self buildSessionManager:isJsonParameter];
if (timeout) {
[sessionManager.requestSerializer setTimeoutInterval:timeout];
}
//app version code
// static NSString *KEY_VERSION_CODE = @"version_code";
// NSString *build = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
......@@ -323,6 +325,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
apiPath:apiPath
parameters:parameters
filePaths:filePaths
timeout:0
images:nil
jsonParameter:isJsonParameter
result:result
......@@ -811,13 +814,14 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [NSString stringWithFormat:@"https://%@/wechatpay/app/unified_order",Pay_API_DOMAIN];
return [self startSessionTask:KWMHTTPMethodPOST
apiPath:apiPath
parameters:parameters
result:[KWMCheckoutPayResult class]
model:[KWMWechatPayData class]
success:success
failure:failure];
// return [self startSessionTask:KWMHTTPMethodPOST
// apiPath:apiPath
// parameters:parameters
// result:[KWMCheckoutPayResult class]
// model:[KWMWechatPayData class]
// success:success
// failure:failure];
return [self startSessionTask:KWMHTTPMethodPOST apiPath:apiPath parameters:parameters filePaths:nil timeout:30 images:nil jsonParameter:NO result:[KWMCheckoutPayResult class] model:[KWMWechatPayData class] success:success failure:failure];
}
/**
......@@ -834,13 +838,14 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [NSString stringWithFormat:@"https://%@/alipay/app/unified_order",Pay_API_DOMAIN];
return [self startSessionTask:KWMHTTPMethodPOST
apiPath:apiPath
parameters:parameters
result:[KWMCheckoutPayResult class]
model:nil
success:success
failure:failure];
// return [self startSessionTask:KWMHTTPMethodPOST
// apiPath:apiPath
// parameters:parameters
// result:[KWMCheckoutPayResult class]
// model:nil
// success:success
// failure:failure];
return [self startSessionTask:KWMHTTPMethodPOST apiPath:apiPath parameters:parameters filePaths:nil timeout:30 images:nil jsonParameter:NO result:[KWMCheckoutPayResult class] model:nil success:success failure:failure];
}
- (NSURLSessionDataTask *) wechatPayOrderQuery:(NSDictionary *)parameters
......
......@@ -56,7 +56,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2017090411</string>
<string>2017090512</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment