Merge branch 'develop' into feature/mzl_dev
# Conflicts: # config/route.php
This commit is contained in:
@@ -76,4 +76,38 @@ class OssService
|
||||
throw new BusinessException('Delete Error: ' . $th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应的 MIME 类型
|
||||
*/
|
||||
public function getMimeTypes($extensions)
|
||||
{
|
||||
$mimeMap = [
|
||||
'jpg' => 'image/jpeg',
|
||||
'jpeg' => 'image/jpeg',
|
||||
'png' => 'image/png',
|
||||
'gif' => 'image/gif',
|
||||
'bmp' => 'image/bmp',
|
||||
'webp' => 'image/webp',
|
||||
'pdf' => 'application/pdf',
|
||||
'doc' => 'application/msword',
|
||||
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'xls' => 'application/vnd.ms-excel',
|
||||
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'ppt' => 'application/vnd.ms-powerpoint',
|
||||
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'txt' => 'text/plain',
|
||||
'zip' => 'application/zip',
|
||||
'rar' => 'application/x-rar-compressed'
|
||||
];
|
||||
|
||||
$mimes = [];
|
||||
foreach ($extensions as $ext) {
|
||||
if (isset($mimeMap[$ext])) {
|
||||
$mimes[] = $mimeMap[$ext];
|
||||
}
|
||||
}
|
||||
|
||||
return array_unique($mimes);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user