perf: 优化发送文件预览

This commit is contained in:
kuaifan
2024-03-13 10:58:46 +09:00
parent d40028340c
commit bc25f5dfdf
4 changed files with 94 additions and 10 deletions

View File

@@ -2473,13 +2473,18 @@ class Base
*/
public static function extIcon($ext)
{
return match ($ext) {
"docx" => 'images/ext/doc.png',
"xlsx" => 'images/ext/xls.png',
"pptx" => 'images/ext/ppt.png',
"ai", "avi", "bmp", "cdr", "doc", "eps", "gif", "mov", "mp3", "mp4", "pdf", "ppt", "pr", "psd", "rar", "svg", "tif", "txt", "xls", "zip" => 'images/ext/' . $ext . '.png',
default => 'images/ext/file.png',
};
if ($ext == "docx") {
$ext = 'doc';
} elseif ($ext == "xlsx") {
$ext = 'xls';
} elseif ($ext == "pptx") {
$ext = 'ppt';
}
if (in_array($ext, ["ai", "avi", "bmp", "cdr", "doc", "eps", "gif", "mov", "mp3", "mp4", "pdf", "ppt", "pr", "psd", "rar", "svg", "tif", "txt", "xls", "zip"])) {
return 'images/ext/' . $ext . '.png';
} else {
return 'images/ext/file.png';
}
}
/**