trackEventCheck static method
Implementation
static Future<bool> trackEventCheck(Map p) async {
try {
if ((p is Map) == false) {
MzanalyticsLog.p('传入参数必须为Map类型');
return false;
}
if (((p['ec'] is String) == false ||
((p['ec'] is String) == true) && p['ec'].length == 0) &&
((p['ea'] is String) == false ||
((p['ea'] is String) == true) && p['ea'].length == 0) &&
((p['el'] is String) == false ||
((p['el'] is String) == true) && p['el'].length == 0)) {
MzanalyticsLog.p('请输入事件分类、事件动作、事件标签中的任意一个参数');
return false;
}
if (p.containsKey('ec')) {
if ((p['ec'] is String) == false) {
MzanalyticsLog.p('ec 必须为String类型');
return false;
}
}
if (p.containsKey('ea')) {
if ((p['ea'] is String) == false) {
MzanalyticsLog.p('ea 必须为String类型');
return false;
}
}
if (p.containsKey('el')) {
if ((p['el'] is String) == false) {
MzanalyticsLog.p('el 必须为String类型');
return false;
}
}
if (p.containsKey('ev')) {
if ((p['ev'] is String) == false) {
MzanalyticsLog.p('ev 必须为String类型');
return false;
}
if (!number.hasMatch(p['ev'])) {
MzanalyticsLog.p('ev 必须为数字');
return false;
}
}
if (p['CustomDimMetrics'] is Map) {
bool ret = await cdmCheck(p['CustomDimMetrics']);
return ret;
}
return true;
} catch (e) {
return false;
}
}