getMulitiMessageFileID static method
Implementation
static String getMulitiMessageFileID(
Map<String, dynamic> elem,
int image_type,
bool isSnap,
) {
int elem_type = elem["elem_type"] ?? 0;
String ext = "";
if (elem_type == 1) {
// 图片消息
int picext = elem["image_elem_format"];
String eext = "";
switch (picext) {
case 1:
eext = ".jpg";
break;
case 2:
eext = ".gif";
break;
case 3:
eext = ".png";
break;
case 4:
eext = ".bmp";
break;
}
if (image_type == 0) {
String id = (elem["image_elem_orig_id"] ?? "");
bool hasext = id.contains(".");
String fname = hasext ? id : "$id$eext";
ext = "$image_type-$fname";
} else if (image_type == 1) {
String id = (elem["image_elem_thumb_id"] ?? "");
bool hasext = id.contains(".");
String fname = hasext ? id : "$id$eext";
ext = "$image_type-$fname";
} else {
String id = (elem["image_elem_large_id"] ?? "");
bool hasext = id.contains(".");
String fname = hasext ? id : "$id$eext";
ext = "$image_type-$fname";
}
} else if (elem_type == 2) {
// 声音
ext = elem["sound_elem_file_id"] ?? "";
} else if (elem_type == 4) {
// file
String id = elem["file_elem_file_id"] ?? "";
bool hasext = id.contains(".");
String downloadID = hasext ? id : "$id.${elem["file_elem_file_name"]}";
ext = downloadID;
} else if (elem_type == 9) {
if (isSnap) {
String id = (elem["video_elem_image_id"] ?? "");
bool hasext = id.contains(".");
String fname = hasext ? id : "$id.${elem["video_elem_video_type"]}";
ext = fname;
} else {
String id = (elem["video_elem_video_id"] ?? "");
bool hasext = id.contains(".");
String fname = hasext ? id : "$id.${elem["video_elem_video_type"]}";
ext = fname;
}
// 视频
}
return ext;
}