This commit is contained in:
全栈小学生 2023-04-21 14:18:26 +08:00
parent 791e3c456c
commit 7fa96dc3a2
6 changed files with 16 additions and 8 deletions

View File

@ -57,14 +57,14 @@ class Index extends BaseInstall
$dirs_list = [ $dirs_list = [
[ "path" => $root_path . DIRECTORY_SEPARATOR . ".env", "path_name" => "niucloud/.env", "name" => "env" ], [ "path" => $root_path . DIRECTORY_SEPARATOR . ".env", "path_name" => "niucloud/.env", "name" => "env" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . ".example.env", "path_name" => "niucloud/.example_env", "name" => "env" ], [ "path" => $root_path . DIRECTORY_SEPARATOR . ".example.env", "path_name" => "niucloud/.example_env", "name" => "env" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'runtime/', "path_name" => "niucloud/runtime", "name" => "runtime" ], [ "path" => $root_path . DIRECTORY_SEPARATOR . 'runtime'.DIRECTORY_SEPARATOR, "path_name" => "niucloud/runtime", "name" => "runtime" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'public/upload/', "path_name" => "niucloud/public/upload", "name" => "upload" ], [ "path" => $root_path . DIRECTORY_SEPARATOR . 'public'.DIRECTORY_SEPARATOR.'upload'.DIRECTORY_SEPARATOR, "path_name" => "niucloud/public/upload", "name" => "upload" ],
[ "path" => $root_path . DIRECTORY_SEPARATOR . 'app/install/', "path_name" => "niucloud/app/install", "name" => "安装目录" ] [ "path" => $root_path . DIRECTORY_SEPARATOR . 'app'.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR, "path_name" => "niucloud/app/install", "name" => "安装目录" ]
]; ];
//目录 可读 可写检测 //目录 可读 可写检测
$is_dir = true; $is_dir = true;
foreach ($dirs_list as $k => $v) { foreach ($dirs_list as $k => $v) {
!is_dir($v[ "path" ]) && mkdirs($v[ "path" ], 0755, true); @mkdir($v[ "path" ], 0755, true);
$is_readable = is_readable($v[ "path" ]); $is_readable = is_readable($v[ "path" ]);
$is_write = is_write($v[ "path" ]); $is_write = is_write($v[ "path" ]);
$dirs_list[ $k ][ "is_readable" ] = $is_readable; $dirs_list[ $k ][ "is_readable" ] = $is_readable;

View File

@ -35,10 +35,18 @@ class CoreUploadConfigService extends BaseCoreService
$info = (new CoreConfigService())->getConfig($site_id, ConfigKeyEnum::UPLOAD)['value'] ?? []; $info = (new CoreConfigService())->getConfig($site_id, ConfigKeyEnum::UPLOAD)['value'] ?? [];
if (empty($info)) { if (empty($info)) {
$info = [ $info = [
'image_ext' => '',//图片上传文件后缀 'image_ext' => [
'video_ext' => '',//视频上传文件后缀 'jpg', 'png', 'gif', 'jpeg', 'webp'
],//图片上传文件后缀
'video_ext' => [
'wmv', 'avi', 'mpg', 'mpeg', '3gp', 'mov', 'mp4', 'flv', 'f4v', 'rmvb', 'mkv'
],//视频上传文件后缀
'document_ext' => [
'crt', 'pem'
],
'image_size' => 0,//图片上传大小限制 'image_size' => 0,//图片上传大小限制
'video_size' => 0,//视频上传大小限制 'video_size' => 0,//视频上传大小限制
'document_size' => 0,//文件上传大小限制
]; ];
} }
return $info; return $info;

View File

@ -119,11 +119,13 @@ class CoreUploadService extends CoreFileService
$config['file_ext'] = match ($att_type) { $config['file_ext'] = match ($att_type) {
FileEnum::IMAGE => $config['image_ext'] ?? [], FileEnum::IMAGE => $config['image_ext'] ?? [],
FileEnum::VIDEO => $config['video_ext'] ?? [], FileEnum::VIDEO => $config['video_ext'] ?? [],
FileEnum::DOCUMENT => $config['document_ext'] ?? [],
default => [], default => [],
}; };
$config['file_size'] = match ($att_type) { $config['file_size'] = match ($att_type) {
FileEnum::IMAGE => $config['image_size'] ?? 0, FileEnum::IMAGE => $config['image_size'] ?? 0,
FileEnum::VIDEO => $config['video_size'] ?? 0, FileEnum::VIDEO => $config['video_size'] ?? 0,
FileEnum::DOCUMENT => $config['document_size'] ?? [],
default => 0, default => 0,
}; };
$rule = []; $rule = [];

View File

@ -1,4 +1,3 @@
/.htaccess /.htaccess
upload
nginx.htaccess nginx.htaccess
.htaccess .htaccess

0
niucloud/public/upload/.gitignore vendored Normal file
View File

View File

@ -27,7 +27,6 @@
import { t } from '@/locale' import { t } from '@/locale'
import { getArticleDetail } from '@/api/article'; import { getArticleDetail } from '@/api/article';
import { useShare } from '@/hooks/useShare' import { useShare } from '@/hooks/useShare'
import { currShareRoute } from '@/utils/common';
const { setShare, onShareAppMessage, onShareTimeline } = useShare() const { setShare, onShareAppMessage, onShareTimeline } = useShare()
onShareAppMessage() onShareAppMessage()