Authored by John Tai

Merge branch 'develop' of http://git.yoho.cn/mobile/YH_EventReport into develop

... ... @@ -51,11 +51,9 @@
self.timedEvents = [NSMutableDictionary dictionary];
NSArray *tabAry= @[@"YH_CategoryContainerVC",
@"YH_GuangMainVC",
NSArray *tabAry= @[@"YH_GuangMainVC",
@"YH_ShowMainVC",
@"YH_CmtMainVC",
@"YH_GuangContainerVC",
@"YH_ShoppingCartViewController",
@"UIPageViewController",
@"YH_MyViewController",
... ...
... ... @@ -11,6 +11,7 @@
#import "YH_Reachability.h"
#import "YHLog.h"
#import "NSData+YHERGZip.h"
#import "NSString+ER_URL.h"
#define kYOHOEventReportURL @"http://analysis.yohobuy.com/yas_mobile"//@"http://172.16.10.128:8081/eventreport"
... ... @@ -52,12 +53,13 @@
if (!self.canUpload) {
return;
}
NSData *postData = [self getBodyData:parameters];
if (!postData) {
NSError *nullError = [[NSError alloc] initWithDomain:@"YoHoErrorDomain" code:-11111 userInfo:@{NSLocalizedDescriptionKey:@"data 不能为空!"}];
result(NO,nil,nullError);
return;
}
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSString *parsJsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSString *parsStr = [[NSString stringWithFormat:@"_mlogs=%@",erSafeValue(parsJsonStr)]er_encodedString];
NSData* xmlData = [parsStr dataUsingEncoding:NSUTF8StringEncoding];
NSData *postData = [xmlData YHERgzippedData];
[self.uploadEventRequest setHTTPBody:postData];
[self.uploadEventRequest setValue:(@(self.uploadEventRequest.HTTPBody.length)).description forHTTPHeaderField:@"Content-Length"];
... ... @@ -95,7 +97,7 @@
result(YES,tag,nil);
}
}];
[task resume];
}
... ... @@ -105,11 +107,10 @@
if (param == nil || [param isEqual:[NSNull null]]) {
return nil;
}
NSError *error;
NSData *postData = [NSJSONSerialization dataWithJSONObject:param options:0 error:&error];
if (error) {
return nil;
}
... ... @@ -131,7 +132,7 @@
if (!_uploadEventRequest) {
NSURL *url = [NSURL URLWithString:kYOHOEventReportURL];
_uploadEventRequest =[NSMutableURLRequest requestWithURL:url];
[_uploadEventRequest setValue:@"application/json" forHTTPHeaderField:@"content-type"];
[_uploadEventRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
_uploadEventRequest.HTTPMethod = @"POST";
[_uploadEventRequest setValue:@"gzip" forHTTPHeaderField:@"Content-Encoding"];
}
... ...
... ... @@ -172,6 +172,7 @@ typedef NS_ENUM(NSInteger, YHEventLoadStatus) {
#define IOS10 ([[[UIDevice currentDevice] systemVersion] doubleValue] >=10.0 ? YES : NO)
#define erSafeValue(X) (!(X) ? [NSNull null] : (X))
//////////////////////大数据 业务数据上报参数///////////////////////////////
... ...
... ... @@ -36,7 +36,7 @@
return nil;
}
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[currentUrl er_encodedString],kYHEventReportTimeURL,[NSString stringWithFormat:@"%.0f",elapsedTime*1000],kYHEventReportTimeElapsed,nil];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[currentUrl er_encodedString],kYHEventReportTimeURL,[NSString stringWithFormat:@"%.0f",elapsedTime*1000],kYHEventReportTimeElapsed,@"",kYHEventReportTimeTitle,nil];
return dict;
}
... ... @@ -48,7 +48,7 @@
currentUrl=@"";
}
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[currentUrl er_encodedString],kYHEventReportTimeURL,[NSString stringWithFormat:@"%.0f",elapsedTime*1000],kYHEventReportTimeElapsed,nil];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[currentUrl er_encodedString],kYHEventReportTimeURL,[NSString stringWithFormat:@"%.0f",elapsedTime*1000],kYHEventReportTimeElapsed,@"",kYHEventReportTimeTitle,nil];
return dict;
}
... ...