Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMPhobos
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMPhobos
Commits
fb04b002
Commit
fb04b002
authored
Mar 11, 2020
by
井庆林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
达100条数据进行拆分上传
parent
af6934b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
PhobosConfig.h
GMPhobos/Classes/PhobosConfig.h
+1
-0
PhobosSendManager.m
GMPhobos/Classes/PhobosSendManager.m
+10
-0
No files found.
GMPhobos/Classes/PhobosConfig.h
View file @
fb04b002
...
...
@@ -31,5 +31,6 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
#define PhobosTempCacheKey @"PhobosTempCacheKey" //old 临时存放待发送埋点数据的key
#define PhobosShardCount 50 //收集数据分段发送的个数
#define PhobosMaxSendCount 100 // 最大发送数量
#endif
/* PhobosConfig_h */
GMPhobos/Classes/PhobosSendManager.m
View file @
fb04b002
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment