|
@@ -330,27 +330,26 @@ class NetUtil { |
|
|
// return params; |
|
|
// return params; |
|
|
// } |
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
static PackageInfo packageInfo; |
|
|
|
|
|
static Map setting; |
|
|
|
|
|
static IosDeviceInfo iosInfo; |
|
|
|
|
|
static AndroidDeviceInfo androidInfo; |
|
|
|
|
|
static String imei; |
|
|
|
|
|
|
|
|
static PackageInfo packageInfo; |
|
|
|
|
|
static Map setting; |
|
|
|
|
|
static IosDeviceInfo iosInfo; |
|
|
|
|
|
static AndroidDeviceInfo androidInfo; |
|
|
|
|
|
static String imei; |
|
|
|
|
|
/// 获取必须的请求参数(用于请求头部) |
|
|
/// 获取必须的请求参数(用于请求头部) |
|
|
static Future<Map<String, String>> _getMustHeadParams() async { |
|
|
static Future<Map<String, String>> _getMustHeadParams() async { |
|
|
|
|
|
|
|
|
Map<String, String> params = new HashMap<String, String>(); |
|
|
Map<String, String> params = new HashMap<String, String>(); |
|
|
// 应用信息 |
|
|
// 应用信息 |
|
|
if(packageInfo==null){ |
|
|
|
|
|
|
|
|
if (packageInfo == null) { |
|
|
packageInfo = await PackageInfo.fromPlatform(); |
|
|
packageInfo = await PackageInfo.fromPlatform(); |
|
|
} |
|
|
} |
|
|
// 原生传的信息 |
|
|
// 原生传的信息 |
|
|
if(setting==null){ |
|
|
|
|
|
|
|
|
if (setting == null) { |
|
|
setting = await NativeUtil.getSetting(); |
|
|
setting = await NativeUtil.getSetting(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (Platform.isIOS) { |
|
|
if (Platform.isIOS) { |
|
|
if(iosInfo==null){ |
|
|
|
|
|
|
|
|
if (iosInfo == null) { |
|
|
iosInfo = await DeviceInfoPlugin().iosInfo; |
|
|
iosInfo = await DeviceInfoPlugin().iosInfo; |
|
|
} |
|
|
} |
|
|
// 设备 |
|
|
// 设备 |
|
@@ -366,7 +365,7 @@ class NetUtil { |
|
|
// idfa |
|
|
// idfa |
|
|
params['idfa'] = iosInfo?.identifierForVendor?.toString(); |
|
|
params['idfa'] = iosInfo?.identifierForVendor?.toString(); |
|
|
} else if (Platform.isAndroid) { |
|
|
} else if (Platform.isAndroid) { |
|
|
if(androidInfo==null){ |
|
|
|
|
|
|
|
|
if (androidInfo == null) { |
|
|
androidInfo = await DeviceInfoPlugin().androidInfo; |
|
|
androidInfo = await DeviceInfoPlugin().androidInfo; |
|
|
} |
|
|
} |
|
|
// 设备 |
|
|
// 设备 |
|
@@ -413,12 +412,9 @@ class NetUtil { |
|
|
// 当前时间戳:秒 |
|
|
// 当前时间戳:秒 |
|
|
params["time"] = TimeUtil.getNowTime(); |
|
|
params["time"] = TimeUtil.getNowTime(); |
|
|
|
|
|
|
|
|
if (imei==null) { |
|
|
|
|
|
imei = await _getImei(); |
|
|
|
|
|
print("获取到udid"+(imei??"")); |
|
|
|
|
|
}else{ |
|
|
|
|
|
params['imei']=imei; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
imei = await getImei(); |
|
|
|
|
|
print("获取到udid" + (imei ?? "")); |
|
|
|
|
|
params['imei'] = imei; |
|
|
|
|
|
|
|
|
// 过滤空字段,过滤首尾空格 |
|
|
// 过滤空字段,过滤首尾空格 |
|
|
Map<String, String> filters = Map<String, String>(); |
|
|
Map<String, String> filters = Map<String, String>(); |
|
@@ -440,9 +436,9 @@ class NetUtil { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// 获取Android imei |
|
|
/// 获取Android imei |
|
|
static Future<String> _getImei() async { |
|
|
|
|
|
|
|
|
static Future<String> getImei() async { |
|
|
try { |
|
|
try { |
|
|
return await FlutterAlibc.getUdid(); |
|
|
|
|
|
|
|
|
return await FlutterAlibc.getUdid(); |
|
|
} catch (e, s) { |
|
|
} catch (e, s) { |
|
|
Logger.error(e, s); |
|
|
Logger.error(e, s); |
|
|
} |
|
|
} |
|
@@ -558,7 +554,6 @@ class NetUtil { |
|
|
Logger.error('未知错误: ${e.toString()}'); |
|
|
Logger.error('未知错误: ${e.toString()}'); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|