Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
QM_TJ
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
QM_TJ
Commits
5bec8fd5
Commit
5bec8fd5
authored
Jan 23, 2021
by
李增强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
m
parent
61a3e5b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
28 deletions
+52
-28
lib/qm_tj.dart
lib/qm_tj.dart
+52
-28
No files found.
lib/qm_tj.dart
View file @
5bec8fd5
...
...
@@ -10,26 +10,16 @@ class QMTJ {
static
DB
_db
;
static
String
_appStartUpId
;
static
bool
isDebug
=
false
;
static
void
debug
()
{
isDebug
=
true
;
}
static
void
init
()
async
{
_appStartUpId
=
_md5
(
_getDateNow
().
toString
());
_db
=
new
DB
();
await
_db
.
init
();
var
app_tj
=
await
_db
.
db
.
query
(
"app_tj"
);
print
(
'=============================================================app_tj'
);
print
(
app_tj
);
print
(
'=============================================================app_tj'
);
var
page_tj
=
await
_db
.
db
.
query
(
"page_tj"
);
print
(
'=============================================================page_tj'
);
print
(
page_tj
);
print
(
'=============================================================page_tj'
);
var
a
=
await
_db
.
db
.
query
(
"tap_tj"
);
print
(
'=============================================================tap_tj'
);
print
(
a
);
print
(
'=============================================================tap_tj'
);
var
exposure
=
await
_db
.
db
.
query
(
"exposure_tj"
);
print
(
'=============================================================exposure'
);
print
(
exposure
);
print
(
'=============================================================exposure'
);
}
/// APP 启动
...
...
@@ -38,14 +28,16 @@ class QMTJ {
int
disappearTime
=
0
;
int
appearTime
=
_getDateNow
();
String
id
=
_appStartUpId
;
await
_db
.
db
.
insert
(
"app_tj"
,
{
Map
<
String
,
dynamic
>
map
=
{
"id"
:
id
,
"type"
:
type
,
"source"
:
source
,
"disappear_time"
:
disappearTime
,
"appear_time"
:
appearTime
,
"extras"
:
json
.
encode
(
extras
),
});
};
log
(
"appStart"
,
map
);
await
_db
.
db
.
insert
(
"app_tj"
,
map
);
}
/// APP 可见
...
...
@@ -57,20 +49,28 @@ class QMTJ {
int
disappearTime
=
0
;
int
appearTime
=
_getDateNow
();
String
id
=
_appStartUpId
;
await
_db
.
db
.
insert
(
"app_tj"
,
{
Map
<
String
,
dynamic
>
map
=
{
"id"
:
id
,
"type"
:
type
,
"source"
:
source
,
"disappear_time"
:
disappearTime
,
"appear_time"
:
appearTime
,
"extras"
:
json
.
encode
(
extras
),
});
};
log
(
"appAppear"
,
map
);
await
_db
.
db
.
insert
(
"app_tj"
,
map
);
}
/// APP 不可见
static
void
appDisappear
()
{
_db
.
db
.
update
(
"app_tj"
,
{
"disappear_time"
:
_getDateNow
()},
int
disappearTime
=
_getDateNow
();
_db
.
db
.
update
(
"app_tj"
,
{
"disappear_time"
:
disappearTime
},
where:
"id = ? and disappear_time = 0"
,
whereArgs:
[
_appStartUpId
]);
Map
<
String
,
dynamic
>
map
=
{
"id"
:
_appStartUpId
,
"disappear_time"
:
disappearTime
,
};
log
(
"appDisappear"
,
map
);
}
/// PAGE 可见
...
...
@@ -83,7 +83,7 @@ class QMTJ {
String
id
=
_md5
(
"
${pageId}
_
${lastPageId}
_
$extrasStr
"
);
int
disappearTime
=
0
;
int
appearTime
=
_getDateNow
();
await
_db
.
db
.
insert
(
"page_tj"
,
{
Map
<
String
,
dynamic
>
map
=
{
"id"
:
id
,
"source"
:
source
,
"page_id"
:
pageId
,
...
...
@@ -91,7 +91,9 @@ class QMTJ {
"appear_time"
:
appearTime
,
"disappear_time"
:
disappearTime
,
"extras"
:
extrasStr
,
});
};
log
(
"pageAppear"
,
map
);
await
_db
.
db
.
insert
(
"page_tj"
,
map
);
}
/// PAGE 不可见
...
...
@@ -99,13 +101,22 @@ class QMTJ {
{
String
pageId
,
String
lastPageId
,
Map
<
String
,
dynamic
>
extras
})
async
{
String
extrasStr
=
json
.
encode
(
extras
);
String
id
=
_md5
(
"
${pageId}
_
${lastPageId}
_
$extrasStr
"
);
int
disappearTime
=
_getDateNow
();
await
_db
.
db
.
update
(
"page_tj"
,
{
"disappear_time"
:
_getDateNow
()
,
"disappear_time"
:
disappearTime
,
},
where:
"id = ? and disappear_time = 0"
,
whereArgs:
[
id
]);
Map
<
String
,
dynamic
>
map
=
{
"id"
:
id
,
"page_id"
:
pageId
,
"last_page_id"
:
lastPageId
,
"disappear_time"
:
disappearTime
,
"extras"
:
extrasStr
,
};
log
(
"pageDisappear"
,
map
);
}
/// 点击
...
...
@@ -120,14 +131,16 @@ class QMTJ {
int
clickTime
=
_getDateNow
();
String
extrasStr
=
json
.
encode
(
extras
);
String
id
=
_md5
(
"
${pageId}
_
${clickId}
_
${extrasStr}
_
${clickTime}
"
);
await
_db
.
db
.
insert
(
"tap_tj"
,
{
Map
<
String
,
dynamic
>
map
=
{
"id"
:
id
,
"source"
:
source
,
"page_id"
:
pageId
,
"click_id"
:
clickId
,
"click_time"
:
clickTime
,
"extras"
:
extrasStr
,
});
};
log
(
"tap"
,
map
);
await
_db
.
db
.
insert
(
"tap_tj"
,
map
);
}
/// 曝光
...
...
@@ -142,14 +155,16 @@ class QMTJ {
int
exposureTime
=
_getDateNow
();
String
extrasStr
=
json
.
encode
(
extras
);
String
id
=
_md5
(
"
${pageId}
_
${exposureId}
_
${extrasStr}
_
${exposureTime}
"
);
await
_db
.
db
.
insert
(
"exposure_tj"
,
{
Map
<
String
,
dynamic
>
map
=
{
"id"
:
id
,
"source"
:
source
,
"page_id"
:
pageId
,
"exposure_id"
:
exposureId
,
"exposure_time"
:
exposureTime
,
"extras"
:
extrasStr
,
});
};
log
(
"exposure"
,
map
);
await
_db
.
db
.
insert
(
"exposure_tj"
,
map
);
}
/// 获取当前时间戳,单位:秒
...
...
@@ -164,4 +179,13 @@ class QMTJ {
var
digest
=
crypto
.
md5
.
convert
(
bytes
);
return
digest
.
toString
();
}
static
void
log
(
String
type
,
Map
<
String
,
dynamic
>
map
)
{
if
(!
isDebug
)
{
return
;
}
print
(
"
$type
=======================s===========================
$type
"
);
print
(
map
);
print
(
"
$type
=======================e===========================
$type
"
);
}
}
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