Commit fb04b002 authored by 井庆林's avatar 井庆林

达100条数据进行拆分上传

parent af6934b4
......@@ -31,5 +31,6 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
#define PhobosTempCacheKey @"PhobosTempCacheKey" //old 临时存放待发送埋点数据的key
#define PhobosShardCount 50 //收集数据分段发送的个数
#define PhobosMaxSendCount 100 // 最大发送数量
#endif /* PhobosConfig_h */
......@@ -56,6 +56,16 @@
+ (void)sendDataWithEntities:(NSArray<PhobosSendDataEntity *> *)sendDataEntities completion:(void (^)(NSArray<PhobosSendDataEntity *> * _Nonnull, NSInteger))completion {
if (sendDataEntities.count == 0) {
return;
} else if (sendDataEntities.count > PhobosMaxSendCount) {
NSMutableArray *temp = [NSMutableArray arrayWithCapacity:PhobosMaxSendCount];
[sendDataEntities enumerateObjectsUsingBlock:^(PhobosSendDataEntity * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (temp.count >= PhobosMaxSendCount) {
[self sendDataWithEntities:temp completion:completion];
[temp removeAllObjects];
}
[temp addObject:obj];
}];
return;
}
NSMutableDictionary *sendDataMap = [NSMutableDictionary new];
[sendDataEntities enumerateObjectsUsingBlock:^(PhobosSendDataEntity *obj, NSUInteger idx, BOOL * _Nonnull stop) {
......
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