Commit b756ad1b authored by jinzhu's avatar jinzhu

更改 埋点规则校验 时间更改 以及避免多次弹框的问题

parent f2b609e1
......@@ -35,7 +35,7 @@ PODS:
- GMKit/Protocol (0.8.4):
- Masonry (= 1.1.0)
- SDWebImage (= 3.7.6)
- GMPhobos (1.1.9):
- GMPhobos (1.2.0):
- GMCache (= 0.2.3)
- GMKit
- Masonry (1.1.0)
......@@ -63,7 +63,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
GMCache: 09a3029c96fe130e3a21faef70b3d9d2ce92d639
GMKit: a30da06b84e5c4a357d427c70d1b5ec672a1f6a1
GMPhobos: c035b742d9b29b1c3417ca3451feec9300eae370
GMPhobos: 4b5ab2b54be8ff7ef86995edd7bc4888f1fd1a97
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
SDWebImage: c325cf02c30337336b95beff20a13df489ec0ec9
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
......
......@@ -453,35 +453,40 @@ static NSString *sdkVersion = @"110";
#else
if (data[@"type"] && [data[@"type"] isEqualToString:@"page_view"]) {
NSDictionary *pageParams = data[@"params"];
NSDate *pageInTime = [NSDate dateWithTimeIntervalSince1970:[pageParams[@"in"] longLongValue]];
NSDate *pageOutTime = [NSDate dateWithTimeIntervalSince1970:[pageParams[@"out"] longLongValue]];
long long pageInTime = [pageParams[@"in"] longLongValue];
long long pageOutTime = [pageParams[@"out"] longLongValue];
// phobosLog(@"pageInTime------%lld",pageInTime);
// phobosLog(@"pageOutTime------%lld",pageOutTime);
if (pageInTime && pageOutTime) {
__block BOOL checkTimeError;
[dataArray enumerateObjectsUsingBlock:^(NSDictionary * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
for (int i = 0; i < dataArray.count; i++) {
NSDictionary *obj = dataArray[i];
if (obj[@"type"] && [obj[@"type"] isEqualToString:@"page_view"]) {
NSDictionary *params = obj[@"params"];
NSDate *objInTime = [NSDate dateWithTimeIntervalSince1970:[params[@"in"] longLongValue]];
NSDate *objOutTime = [NSDate dateWithTimeIntervalSince1970:[params[@"out"] longLongValue]];
if ([pageInTime timeIntervalSinceDate:objInTime] < 1 || [pageOutTime timeIntervalSinceDate:objOutTime] < 1) {
long long objInTime = [params[@"in"] longLongValue];
long long objOutTime = [params[@"out"] longLongValue];
if ( (fabsl(objInTime - pageInTime)) < 1 || (fabsl(objOutTime - pageOutTime)) < 1) {
phobosLog(@"两个埋点inTime 时间差------%f", (fabsl(objInTime - pageInTime)));
phobosLog(@"两个埋点outTime 时间差------%f", (fabsl(objOutTime - pageOutTime)));
checkTimeError = YES;
stop = YES;
phobosLog(@"%s____数据校验失败", __func__);
NSString *stringTitle = [NSString stringWithFormat:@"%@ PV埋点可能重复", data];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:stringTitle message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alertView show];
dispatch_async(dispatch_get_main_queue(), ^{
NSString *stringTitle = [NSString stringWithFormat:@"%@ PV埋点可能重复", data];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:stringTitle message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alertView show];
});
break;
}
}
}];
}
}
}
// 不管成功还是失败 给开发提示方便DEBUG
// phobosLog(@"%s____数据校验成功", __func__);
// phobosLog(@"%s____数据校验成功", __func__);
[dataArray addObject:data];
#endif
} else {
dataArray = [NSMutableArray arrayWithObject:data];
......
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