Commit 9caff025 authored by 朱璇's avatar 朱璇

修改 精准曝光不删除缓存数据

parent bb2ea48b
...@@ -480,7 +480,7 @@ static NSString *sdkVersion = @"110"; ...@@ -480,7 +480,7 @@ static NSString *sdkVersion = @"110";
从缓存区获取数据,发给服务器,请求成功的时候,把缓存区的数据删除掉 从缓存区获取数据,发给服务器,请求成功的时候,把缓存区的数据删除掉
*/ */
- (void)sendArrayWithCurrentAPI:(NSString *)currentAPI { - (void)sendArrayWithCurrentAPI:(NSString *)currentAPI {
NSMutableArray *dataArray = [GMCache fetchObjectAtDocumentPathWithkey:PhobosTempCacheKey]; NSMutableArray *dataArray = [GMCache fetchObjectAtDocumentPathWithkey:PhobosExpusureTempCacheKey];
if (_logEnabled) { if (_logEnabled) {
NSData *data = [NSJSONSerialization dataWithJSONObject:dataArray options:NSJSONWritingPrettyPrinted error:nil]; NSData *data = [NSJSONSerialization dataWithJSONObject:dataArray options:NSJSONWritingPrettyPrinted error:nil];
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
...@@ -492,7 +492,7 @@ static NSString *sdkVersion = @"110"; ...@@ -492,7 +492,7 @@ static NSString *sdkVersion = @"110";
if (compressedData) { if (compressedData) {
[PhobosUtil sendData:compressedData currentAPI:currentAPI success:^(NSInteger code) { [PhobosUtil sendData:compressedData currentAPI:currentAPI success:^(NSInteger code) {
phobosLog(@"✈ ---------- ✈ data arrived Mars"); phobosLog(@"✈ ---------- ✈ data arrived Mars");
[GMCache removeObjectAtDocumentPathWithkey:PhobosTempCacheKey]; [GMCache removeObjectAtDocumentPathWithkey:PhobosExpusureTempCacheKey];
}]; }];
} }
} }
...@@ -535,17 +535,17 @@ static NSString *sdkVersion = @"110"; ...@@ -535,17 +535,17 @@ static NSString *sdkVersion = @"110";
@try { @try {
//1.获取缓存区的数据,把新数据追加进去 //1.获取缓存区的数据,把新数据追加进去
NSMutableArray *dataArray = [GMCache fetchObjectAtDocumentPathWithkey:PhobosTempCacheKey]; NSMutableArray *dataArray = [GMCache fetchObjectAtDocumentPathWithkey:PhobosExpusureTempCacheKey];
if (dataArray) { if (dataArray) {
[dataArray addObjectsFromArray:array]; [dataArray addObjectsFromArray:array];
}else{ }else{
dataArray = [NSMutableArray arrayWithArray:array]; dataArray = [NSMutableArray arrayWithArray:array];
} }
[GMCache storeObjectAtDocumentPathWithkey:PhobosTempCacheKey object:dataArray]; [GMCache storeObjectAtDocumentPathWithkey:PhobosExpusureTempCacheKey object:dataArray];
//2.把缓存区的数据发送给服务器 //2.把缓存区的数据发送给服务器
[self sendArrayWithCurrentAPI:currentAPI]; [self sendArrayWithCurrentAPI:currentAPI];
//3.把原有的数据删除 //3.把原有的数据删除
[GMCache removeObjectAtDocumentPathWithkey:PhobosCacheKey]; // [GMCache removeObjectAtDocumentPathWithkey:PhobosCacheKey];
} }
@catch (NSException *exception) { @catch (NSException *exception) {
phobosLog(exception); phobosLog(exception);
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#define PhobosEndTime @"PhobosEndTime" //记录APP退出|退到后台时的时间戳 #define PhobosEndTime @"PhobosEndTime" //记录APP退出|退到后台时的时间戳
#define PhobosCacheKey @"PhobosCacheKey" //存放持久化埋点数据的key #define PhobosCacheKey @"PhobosCacheKey" //存放持久化埋点数据的key
#define PhobosTempCacheKey @"PhobosTempCacheKey" //临时存放待发送埋点数据的key #define PhobosTempCacheKey @"PhobosTempCacheKey" //临时存放待发送埋点数据的key
#define PhobosExpusureTempCacheKey @"PhobosExpusureTempCacheKey" //临时存放待发送埋点数据的key(精准曝光)
#define PhobosShardCount 50 //收集数据分段发送的个数 #define PhobosShardCount 50 //收集数据分段发送的个数
#endif /* PhobosConfig_h */ #endif /* PhobosConfig_h */
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