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
9f212bfe
Commit
9f212bfe
authored
Aug 20, 2020
by
yueming lu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改数据
parent
6538bc46
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
17 deletions
+17
-17
GMPhobosPageViewModel.m
GMPhobos/Classes/PhobosDataStorage/GMPhobosPageViewModel.m
+3
-3
GMPhobosSqulitModel.h
GMPhobos/Classes/PhobosDataStorage/GMPhobosSqulitModel.h
+3
-3
GMPhobosSqulitModel.m
GMPhobos/Classes/PhobosDataStorage/GMPhobosSqulitModel.m
+3
-3
PhobosDataManager.m
GMPhobos/Classes/PhobosDataStorage/PhobosDataManager.m
+6
-6
UIResponder+PhobosPV.m
GMPhobos/Classes/UIResponder+PhobosPV.m
+2
-2
No files found.
GMPhobos/Classes/PhobosDataStorage/GMPhobosPageViewModel.m
View file @
9f212bfe
...
@@ -19,12 +19,12 @@
...
@@ -19,12 +19,12 @@
NSDictionary
*
data
=
dict
[
@"params"
];
NSDictionary
*
data
=
dict
[
@"params"
];
GMPhobosPageViewModel
*
model
=
[[
GMPhobosPageViewModel
alloc
]
init
];
GMPhobosPageViewModel
*
model
=
[[
GMPhobosPageViewModel
alloc
]
init
];
//共有参数
//共有参数
model
.
table
N
ame
=
name
;
model
.
table
_n
ame
=
name
;
model
.
data
=
[
GMPhobosTool
dictionaryToJsonString
:
data
];
model
.
data
=
[
GMPhobosTool
dictionaryToJsonString
:
data
];
NSTimeInterval
time
=
[[
NSDate
date
]
timeIntervalSince1970
]
*
1000
;
NSTimeInterval
time
=
[[
NSDate
date
]
timeIntervalSince1970
]
*
1000
;
model
.
message
ItemId
=
[
NSString
stringWithFormat
:
@"%.f*
%lld"
,
time
,
mach_absolute_time
()];
model
.
message
_item_id
=
[
NSString
stringWithFormat
:
@"%.f/
%lld"
,
time
,
mach_absolute_time
()];
model
.
status
=
PhobosDataSendStatus_wait
;
model
.
status
=
PhobosDataSendStatus_wait
;
model
.
phobos
T
ype
=
phobosType
;
model
.
phobos
_t
ype
=
phobosType
;
model
.
api
=
urlapi
;
model
.
api
=
urlapi
;
model
.
immediately
=
status
;
model
.
immediately
=
status
;
//私有参数
//私有参数
...
...
GMPhobos/Classes/PhobosDataStorage/GMPhobosSqulitModel.h
View file @
9f212bfe
...
@@ -20,15 +20,15 @@ typedef NS_ENUM(int, PhobosDataSendStatus) {
...
@@ -20,15 +20,15 @@ typedef NS_ENUM(int, PhobosDataSendStatus) {
@interface
GMPhobosSqulitModel
:
NSObject
@interface
GMPhobosSqulitModel
:
NSObject
/// 唯一标识(用于筛选)
/// 唯一标识(用于筛选)
@property
(
nonatomic
,
strong
)
NSString
*
message
ItemI
d
;
@property
(
nonatomic
,
strong
)
NSString
*
message
_item_i
d
;
/// 埋点类型
/// 埋点类型
@property
(
nonatomic
,
strong
)
NSString
*
phobos
T
ype
;
@property
(
nonatomic
,
strong
)
NSString
*
phobos
_t
ype
;
/// 内容
/// 内容
@property
(
nonatomic
,
strong
)
NSString
*
data
;
@property
(
nonatomic
,
strong
)
NSString
*
data
;
/// 路径
/// 路径
@property
(
nonatomic
,
strong
)
NSString
*
api
;
@property
(
nonatomic
,
strong
)
NSString
*
api
;
///插入表格名称
///插入表格名称
@property
(
nonatomic
,
strong
)
NSString
*
table
N
ame
;
@property
(
nonatomic
,
strong
)
NSString
*
table
_n
ame
;
/// 数据状态
/// 数据状态
@property
(
nonatomic
,
assign
)
PhobosDataSendStatus
status
;
@property
(
nonatomic
,
assign
)
PhobosDataSendStatus
status
;
///是否是立刻发的埋点
///是否是立刻发的埋点
...
...
GMPhobos/Classes/PhobosDataStorage/GMPhobosSqulitModel.m
View file @
9f212bfe
...
@@ -16,12 +16,12 @@
...
@@ -16,12 +16,12 @@
tableName
:(
NSString
*
)
name
tableName
:(
NSString
*
)
name
immediately
:(
BOOL
)
status
{
immediately
:(
BOOL
)
status
{
GMPhobosSqulitModel
*
model
=
[
GMPhobosSqulitModel
new
];
GMPhobosSqulitModel
*
model
=
[
GMPhobosSqulitModel
new
];
model
.
table
N
ame
=
name
;
model
.
table
_n
ame
=
name
;
model
.
data
=
[
GMPhobosTool
dictionaryToJsonString
:
data
];
model
.
data
=
[
GMPhobosTool
dictionaryToJsonString
:
data
];
NSTimeInterval
time
=
[[
NSDate
date
]
timeIntervalSince1970
]
*
1000
;
NSTimeInterval
time
=
[[
NSDate
date
]
timeIntervalSince1970
]
*
1000
;
model
.
message
ItemId
=
[
NSString
stringWithFormat
:
@"%.f*
%lld"
,
time
,
mach_absolute_time
()];
model
.
message
_item_id
=
[
NSString
stringWithFormat
:
@"%.f/
%lld"
,
time
,
mach_absolute_time
()];
model
.
status
=
PhobosDataSendStatus_wait
;
model
.
status
=
PhobosDataSendStatus_wait
;
model
.
phobos
T
ype
=
phobosType
;
model
.
phobos
_t
ype
=
phobosType
;
model
.
api
=
urlapi
;
model
.
api
=
urlapi
;
model
.
immediately
=
status
;
model
.
immediately
=
status
;
return
model
;
return
model
;
...
...
GMPhobos/Classes/PhobosDataStorage/PhobosDataManager.m
View file @
9f212bfe
...
@@ -129,7 +129,7 @@ static PhobosDataManager *dataManager;
...
@@ -129,7 +129,7 @@ static PhobosDataManager *dataManager;
-
(
void
)
insertModel
:
(
GMPhobosSqulitModel
*
)
squlitModel
{
-
(
void
)
insertModel
:
(
GMPhobosSqulitModel
*
)
squlitModel
{
BOOL
insertType
=
[
_squlitManager
gm_insertTable
:
squlitModel
.
table
N
ame
model
:
squlitModel
];
BOOL
insertType
=
[
_squlitManager
gm_insertTable
:
squlitModel
.
table
_n
ame
model
:
squlitModel
];
if
(
!
insertType
)
{
//如果插入失败,就直接发送给服务器
if
(
!
insertType
)
{
//如果插入失败,就直接发送给服务器
[
self
sendModelArray
:@[
squlitModel
]];
[
self
sendModelArray
:@[
squlitModel
]];
}
else
if
(
squlitModel
.
immediately
)
{
//需要立刻发送的埋点
}
else
if
(
squlitModel
.
immediately
)
{
//需要立刻发送的埋点
...
@@ -138,7 +138,7 @@ static PhobosDataManager *dataManager;
...
@@ -138,7 +138,7 @@ static PhobosDataManager *dataManager;
self
.
messageCont
++
;
self
.
messageCont
++
;
[
self
disposeSendDataWithImmediately
:
NO
];
[
self
disposeSendDataWithImmediately
:
NO
];
}
}
NSLog
(
@"插入%@状态%d count:%d"
,
squlitModel
.
phobos
T
ype
,
insertType
,
_messageCont
);
NSLog
(
@"插入%@状态%d count:%d"
,
squlitModel
.
phobos
_t
ype
,
insertType
,
_messageCont
);
}
}
#pragma mark - 获取待发送数据并修改状态为“发送”
#pragma mark - 获取待发送数据并修改状态为“发送”
...
@@ -198,8 +198,8 @@ static PhobosDataManager *dataManager;
...
@@ -198,8 +198,8 @@ static PhobosDataManager *dataManager;
#pragma mark - 上报数据成功
#pragma mark - 上报数据成功
-
(
void
)
sendSuccess
:
(
NSArray
<
GMPhobosSqulitModel
*>
*
)
entities
{
-
(
void
)
sendSuccess
:
(
NSArray
<
GMPhobosSqulitModel
*>
*
)
entities
{
for
(
GMPhobosSqulitModel
*
model
in
entities
)
{
for
(
GMPhobosSqulitModel
*
model
in
entities
)
{
NSString
*
whereStr
=
[
NSString
stringWithFormat
:
@"where message
ItemId = '%@'"
,
model
.
messageItemI
d
];
NSString
*
whereStr
=
[
NSString
stringWithFormat
:
@"where message
_item_id = '%@'"
,
model
.
message_item_i
d
];
bool
status
=
[
_squlitManager
gm_deleteTable
:
model
.
table
N
ame
whereFormat
:
whereStr
];
bool
status
=
[
_squlitManager
gm_deleteTable
:
model
.
table
_n
ame
whereFormat
:
whereStr
];
NSLog
(
@"删除状态:%d"
,
status
);
NSLog
(
@"删除状态:%d"
,
status
);
}
}
}
}
...
@@ -207,8 +207,8 @@ static PhobosDataManager *dataManager;
...
@@ -207,8 +207,8 @@ static PhobosDataManager *dataManager;
#pragma mark - 上报数据失败
#pragma mark - 上报数据失败
-
(
void
)
sendError
:
(
NSArray
<
GMPhobosSqulitModel
*>
*
)
entities
{
-
(
void
)
sendError
:
(
NSArray
<
GMPhobosSqulitModel
*>
*
)
entities
{
for
(
GMPhobosSqulitModel
*
model
in
entities
)
{
for
(
GMPhobosSqulitModel
*
model
in
entities
)
{
NSString
*
whereStr
=
[
NSString
stringWithFormat
:
@"where message
ItemId = '%@'"
,
model
.
messageItemI
d
];
NSString
*
whereStr
=
[
NSString
stringWithFormat
:
@"where message
_item_id = '%@'"
,
model
.
message_item_i
d
];
bool
status
=
[
_squlitManager
gm_updateTable
:
model
.
table
N
ame
bool
status
=
[
_squlitManager
gm_updateTable
:
model
.
table
_n
ame
dicOrModel
:
@{
@"status"
:
@
(
PhobosDataSendStatus_error
)}
dicOrModel
:
@{
@"status"
:
@
(
PhobosDataSendStatus_error
)}
whereFormat
:
whereStr
];
whereFormat
:
whereStr
];
NSLog
(
@"发送失败后修改状态:%d"
,
status
);
NSLog
(
@"发送失败后修改状态:%d"
,
status
);
...
...
GMPhobos/Classes/UIResponder+PhobosPV.m
View file @
9f212bfe
...
@@ -242,11 +242,11 @@
...
@@ -242,11 +242,11 @@
}
}
-
(
void
)
setMessageId
:
(
NSString
*
)
messageId
{
-
(
void
)
setMessageId
:
(
NSString
*
)
messageId
{
objc_setAssociatedObject
(
self
,
@selector
(
messageI
temI
d
),
messageId
,
OBJC_ASSOCIATION_COPY_NONATOMIC
);
objc_setAssociatedObject
(
self
,
@selector
(
messageId
),
messageId
,
OBJC_ASSOCIATION_COPY_NONATOMIC
);
}
}
-
(
NSString
*
)
messageId
{
-
(
NSString
*
)
messageId
{
NSString
*
messageId
=
objc_getAssociatedObject
(
self
,
@selector
(
messageI
temI
d
));
NSString
*
messageId
=
objc_getAssociatedObject
(
self
,
@selector
(
messageId
));
return
messageId
==
nil
?
@""
:
messageId
;
return
messageId
==
nil
?
@""
:
messageId
;
}
}
...
...
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