Commit f71033ff authored by xgz's avatar xgz

setdevie改成setidfa

parent cfba5bad
......@@ -24,8 +24,8 @@ class QMTJ {
}
// 设置设备ID
static void setDeviceId(String d) {
Utils.setDeviceId(d);
static void setIDFA(String d) {
Utils.setIdfaId(d);
}
// 设置渠道
......
......@@ -52,13 +52,17 @@ class App {
// 上传数据至接口
Future<void> upload() async {
await _db.ready;
List<Map> list = await _db.db.query("app_tj", where: "disappear_time < ?",whereArgs: [startUpTime], limit: 100, offset: 0);
List<Map> list = await _db.db.query("app_tj",
where: "disappear_time < ?",
whereArgs: [startUpTime],
limit: 100,
offset: 0);
if (list.length == 0) {
return;
}
String deviceId = await Utils.getDeviceId();
String idfaId = await Utils.getIDFAId();
bool result = await Utils.uploadData({
"device_id": deviceId,
"idfa_id": idfaId,
"projects": [
{"event_name": "app_stage", "event_data": list}
]
......@@ -72,7 +76,7 @@ class App {
Utils.log("app upload_result", {"ok": result, "length": list.length});
}
if (list.length == 100) {
await upload();
await upload();
}
}
}
......@@ -35,9 +35,9 @@ class Exposure {
if (list.length == 0) {
return;
}
String deviceId = await Utils.getDeviceId();
String idfaId = await Utils.getIDFAId();
bool result = await Utils.uploadData({
"device_id": deviceId,
"idfa_id": idfaId,
"projects": [
{"event_name": "elem_exposure", "event_data": list}
]
......@@ -48,13 +48,11 @@ class Exposure {
"delete from exposure_tj where id in('${ids.join("','")}')");
}
if (Utils.isDebug) {
Utils.log("exposure upload_result", {"ok": result, "length": list.length});
Utils.log(
"exposure upload_result", {"ok": result, "length": list.length});
}
if (list.length == 100) {
await upload();
}
}
}
......@@ -60,13 +60,17 @@ class Page {
// 上传数据至接口
Future<void> upload() async {
await _db.ready;
List<Map> list = await _db.db.query("page_tj", where: 'disappear_time < ?',whereArgs: [startUpTime], limit: 100, offset: 0);
List<Map> list = await _db.db.query("page_tj",
where: 'disappear_time < ?',
whereArgs: [startUpTime],
limit: 100,
offset: 0);
if (list.length == 0) {
return;
}
String deviceId = await Utils.getDeviceId();
String idfaId = await Utils.getIDFAId();
bool result = await Utils.uploadData({
"device_id": deviceId,
"idfa_id": idfaId,
"projects": [
{"event_name": "page_scan", "event_data": list}
]
......@@ -80,7 +84,7 @@ class Page {
Utils.log("page upload_result", {"ok": result, "length": list.length});
}
if (list.length == 100) {
await upload();
await upload();
}
}
}
......@@ -38,9 +38,9 @@ class Tap {
if (list.length == 0) {
return;
}
String deviceId = await Utils.getDeviceId();
String idfaId = await Utils.getIDFAId();
bool result = await Utils.uploadData({
"device_id": deviceId,
"idfa_id": idfaId,
"projects": [
{"event_name": "elem_click", "event_data": list}
]
......@@ -54,7 +54,7 @@ class Tap {
Utils.log("tap upload_result", {"ok": result, "length": list.length});
}
if (list.length == 100) {
await upload();
await upload();
}
}
}
......@@ -6,7 +6,7 @@ import 'package:connectivity/connectivity.dart';
class Utils {
static String channel = '';
static String deviceId = '';
static String idfaId = '';
static bool isDebug = false;
static Http _http = Http(scheme: "http", host: "8.135.58.206", port: 8802);
......@@ -53,13 +53,13 @@ class Utils {
}
// 设置设备ID
static void setDeviceId(String d) {
deviceId = d;
static void setIdfaId(String d) {
idfaId = d;
}
// 获取设备ID
static Future<String> getDeviceId() async {
return deviceId;
static Future<String> getIDFAId() async {
return idfaId;
}
// 获取公共参数
......
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