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
0caeec4a
Commit
0caeec4a
authored
Jun 22, 2020
by
yueming lu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改枚举
parent
9f93ec88
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
GMPhobosSqulitModel.h
GMPhobos/Classes/PhobosDataStorage/GMPhobosSqulitModel.h
+4
-4
GMPhobosSqulitModel.m
GMPhobos/Classes/PhobosDataStorage/GMPhobosSqulitModel.m
+1
-1
PhobosDataManager.m
GMPhobos/Classes/PhobosDataStorage/PhobosDataManager.m
+8
-8
No files found.
GMPhobos/Classes/PhobosDataStorage/GMPhobosSqulitModel.h
View file @
0caeec4a
...
@@ -9,10 +9,10 @@
...
@@ -9,10 +9,10 @@
typedef
NS_ENUM
(
int
,
PhobosDataSendStatus
)
{
typedef
NS_ENUM
(
int
,
PhobosDataSendStatus
)
{
PhobosDataSendStatus
ToBeSend
=
1
,
// 待发送数据
PhobosDataSendStatus
_wait
=
1
,
// 待发送数据
PhobosDataSendStatus
Sending
=
2
,
// 发送中数据
PhobosDataSendStatus
_send
=
2
,
// 发送中数据
PhobosDataSendStatus
F
inish
=
3
,
// 发送完成数据
PhobosDataSendStatus
_f
inish
=
3
,
// 发送完成数据
PhobosDataSendStatus
E
rror
=
4
,
// 发送失败数据
PhobosDataSendStatus
_e
rror
=
4
,
// 发送失败数据
};
};
...
...
GMPhobos/Classes/PhobosDataStorage/GMPhobosSqulitModel.m
View file @
0caeec4a
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
model
.
data
=
[
GMPhobosSqulitModel
dictionaryToJsonString
:
data
];
model
.
data
=
[
GMPhobosSqulitModel
dictionaryToJsonString
:
data
];
NSTimeInterval
time
=
[[
NSDate
date
]
timeIntervalSince1970
]
*
1000
;
NSTimeInterval
time
=
[[
NSDate
date
]
timeIntervalSince1970
]
*
1000
;
model
.
messageId
=
[
NSString
stringWithFormat
:
@"%.f*%lld"
,
time
,
mach_absolute_time
()];
model
.
messageId
=
[
NSString
stringWithFormat
:
@"%.f*%lld"
,
time
,
mach_absolute_time
()];
model
.
status
=
PhobosDataSendStatus
ToBeSend
;
model
.
status
=
PhobosDataSendStatus
_wait
;
model
.
phobosType
=
phobosType
;
model
.
phobosType
=
phobosType
;
model
.
api
=
urlapi
;
model
.
api
=
urlapi
;
model
.
immediately
=
status
;
model
.
immediately
=
status
;
...
...
GMPhobos/Classes/PhobosDataStorage/PhobosDataManager.m
View file @
0caeec4a
...
@@ -82,13 +82,13 @@ static PhobosDataManager *dataManager;
...
@@ -82,13 +82,13 @@ static PhobosDataManager *dataManager;
#pragma mark - 方法只用在APP启动的时候
#pragma mark - 方法只用在APP启动的时候
-
(
void
)
resetData
{
-
(
void
)
resetData
{
/** 将上次没有获取到发送结果的数据的状态修改为发送失败,待下次重新发送 */
/** 将上次没有获取到发送结果的数据的状态修改为发送失败,待下次重新发送 */
NSString
*
whereStr
=
[
NSString
stringWithFormat
:
@"where status = %d"
,
PhobosDataSendStatus
Sending
];
NSString
*
whereStr
=
[
NSString
stringWithFormat
:
@"where status = %d"
,
PhobosDataSendStatus
_send
];
[
_squlitManager
gm_updateTable
:
KtableName
dicOrModel
:@{
@"status"
:
@
(
PhobosDataSendStatus
E
rror
)}
whereFormat
:
whereStr
];
[
_squlitManager
gm_updateTable
:
KtableName
dicOrModel
:@{
@"status"
:
@
(
PhobosDataSendStatus
_e
rror
)}
whereFormat
:
whereStr
];
/** 将发送成功的数据删除 */
/** 将发送成功的数据删除 */
NSString
*
whereDelet
=
[
NSString
stringWithFormat
:
@"where status = %d"
,
PhobosDataSendStatus
F
inish
];
NSString
*
whereDelet
=
[
NSString
stringWithFormat
:
@"where status = %d"
,
PhobosDataSendStatus
_f
inish
];
[
_squlitManager
gm_deleteTable
:
KtableName
whereFormat
:
whereDelet
];
[
_squlitManager
gm_deleteTable
:
KtableName
whereFormat
:
whereDelet
];
/** 设置未发送数据数量 */
/** 设置未发送数据数量 */
NSString
*
whereCount
=
[
NSString
stringWithFormat
:
@"where status = %d or status = %d"
,
PhobosDataSendStatus
ToBeSend
,
PhobosDataSendStatusE
rror
];
NSString
*
whereCount
=
[
NSString
stringWithFormat
:
@"where status = %d or status = %d"
,
PhobosDataSendStatus
_wait
,
PhobosDataSendStatus_e
rror
];
_messageCont
=
[
_squlitManager
gm_tableItemCount
:
KtableName
whereFormat
:
whereCount
];
_messageCont
=
[
_squlitManager
gm_tableItemCount
:
KtableName
whereFormat
:
whereCount
];
}
}
...
@@ -117,17 +117,17 @@ static PhobosDataManager *dataManager;
...
@@ -117,17 +117,17 @@ static PhobosDataManager *dataManager;
#pragma mark - 获取待发送数据并修改状态为“发送”
#pragma mark - 获取待发送数据并修改状态为“发送”
-
(
NSArray
*
)
fetchToBeSendDataEntitiesAndUpdateWithSendStatus
{
-
(
NSArray
*
)
fetchToBeSendDataEntitiesAndUpdateWithSendStatus
{
NSString
*
where
=
[
NSString
stringWithFormat
:
@"where status = %d or status = %d"
,
PhobosDataSendStatus
ToBeSend
,
PhobosDataSendStatusE
rror
];
NSString
*
where
=
[
NSString
stringWithFormat
:
@"where status = %d or status = %d"
,
PhobosDataSendStatus
_wait
,
PhobosDataSendStatus_e
rror
];
/**获取待发送的数据*/
/**获取待发送的数据*/
NSArray
*
array
=
[
_squlitManager
gm_lookupTable
:
KtableName
filterArray
:
nil
objectClass
:
[
GMPhobosSqulitModel
class
]
whereFormat
:
where
];
NSArray
*
array
=
[
_squlitManager
gm_lookupTable
:
KtableName
filterArray
:
nil
objectClass
:
[
GMPhobosSqulitModel
class
]
whereFormat
:
where
];
/**将待发送的数据修改为“发送中”*/
/**将待发送的数据修改为“发送中”*/
[
_squlitManager
gm_updateTable
:
KtableName
dicOrModel
:@{
@"status"
:
@
(
PhobosDataSendStatus
Sending
)}
whereFormat
:
where
];
[
_squlitManager
gm_updateTable
:
KtableName
dicOrModel
:@{
@"status"
:
@
(
PhobosDataSendStatus
_send
)}
whereFormat
:
where
];
return
array
;
return
array
;
}
}
#pragma mark - 是否需要发送数据
#pragma mark - 是否需要发送数据
-
(
void
)
disposeSendDataWithImmediately
:
(
BOOL
)
status
{
-
(
void
)
disposeSendDataWithImmediately
:
(
BOOL
)
status
{
NSString
*
where
=
[
NSString
stringWithFormat
:
@"where status = %d or status = %d"
,
PhobosDataSendStatus
ToBeSend
,
PhobosDataSendStatusE
rror
];
NSString
*
where
=
[
NSString
stringWithFormat
:
@"where status = %d or status = %d"
,
PhobosDataSendStatus
_wait
,
PhobosDataSendStatus_e
rror
];
_messageCont
=
[
_squlitManager
gm_tableItemCount
:
KtableName
whereFormat
:
where
];
_messageCont
=
[
_squlitManager
gm_tableItemCount
:
KtableName
whereFormat
:
where
];
if
(
status
||
_messageCont
>=
PhobosShardCount
)
{
if
(
status
||
_messageCont
>=
PhobosShardCount
)
{
NSArray
*
array
=
[
self
fetchToBeSendDataEntitiesAndUpdateWithSendStatus
];
NSArray
*
array
=
[
self
fetchToBeSendDataEntitiesAndUpdateWithSendStatus
];
...
@@ -158,7 +158,7 @@ static PhobosDataManager *dataManager;
...
@@ -158,7 +158,7 @@ static PhobosDataManager *dataManager;
for
(
GMPhobosSqulitModel
*
model
in
entities
)
{
for
(
GMPhobosSqulitModel
*
model
in
entities
)
{
NSString
*
whereStr
=
[
NSString
stringWithFormat
:
@"where messageId = '%@'"
,
model
.
messageId
];
NSString
*
whereStr
=
[
NSString
stringWithFormat
:
@"where messageId = '%@'"
,
model
.
messageId
];
bool
status
=
[
_squlitManager
gm_updateTable
:
KtableName
bool
status
=
[
_squlitManager
gm_updateTable
:
KtableName
dicOrModel
:
@{
@"status"
:
@
(
PhobosDataSendStatus
E
rror
)}
dicOrModel
:
@{
@"status"
:
@
(
PhobosDataSendStatus
_e
rror
)}
whereFormat
:
whereStr
];
whereFormat
:
whereStr
];
NSLog
(
@"发送失败后修改状态:%d"
,
status
);
NSLog
(
@"发送失败后修改状态:%d"
,
status
);
}
}
...
...
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