Skip to content

Commit 0ba6010

Browse files
committed
修复上传文件未读取config配置
1 parent dfc0ef7 commit 0ba6010

3 files changed

Lines changed: 26 additions & 4 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"ext-swoole": ">=4.5",
2020
"hyperf/model-cache": "^2.0.0",
2121
"hyperf/redis": "^2.0.0",
22-
"hyperf-plus/route": "~2.1.0",
22+
"hyperf-plus/route": "~2.1.0|dev-master",
2323
"96qbhy/hyperf-auth": "^2.3",
2424
"hyperf-plus/ui": "~1.0.0|dev-master",
2525
"hyperf/paginator": "~2.1.0"

src/Controller/System.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This file is part of Hyperf.plus
6+
*
7+
* @link https://www.hyperf.plus
8+
* @document https://doc.hyperf.plus
9+
* @contact 898468798@qq.com
10+
* author luoxiaoxin
11+
* date: 2021-01-21 10:26
12+
* @license https://github.com/hyperf-plus/admin/blob/master/LICENSE
13+
*/
14+
15+
16+
namespace HPlus\Admin\Controller;
17+
18+
19+
class System extends AbstractAdminController
20+
{
21+
22+
}

src/Controller/Upload.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use Psr\Container\ContainerInterface;
2323

2424
/**
25-
* @ApiController(prefix="/upload")
25+
* @ApiController(prefix="/upload",tag="上传")
2626
* Class IndexAdminController
2727
*/
2828
class Upload
@@ -64,7 +64,7 @@ public function image()
6464
if ($file->getSize() > $fileSize) {
6565
throw new BusinessException(1000, '文件不能大于!' . ($fileSize / 1024 / 1024) . 'MB');
6666
}
67-
$imageMimes = explode(',', $config['image_mimes'] ?? 'jpeg,bmp,png,gif,jpg');
67+
$imageMimes = explode(',', config('admin.upload.image_mimes') ?? 'jpeg,bmp,png,gif,jpg');
6868
if (! in_array(strtolower($file->getExtension()), $imageMimes)) {
6969
throw new BusinessException(1000, '后缀不允许!');
7070
}
@@ -91,7 +91,7 @@ public function file()
9191
throw new BusinessException(1000, '文件不能大于!' . ($fileSize / 1024 / 1024) . 'MB');
9292
}
9393
#检测类型
94-
$imageMimes = explode(',', $config['file_mimes'] ?? 'txt,sql,zip,rar,ppt,word,xls,xlsx,doc,docx');
94+
$imageMimes = explode(',', config('admin.upload.file_mimes') ?? 'txt,sql,zip,rar,ppt,word,xls,xlsx,doc,docx');
9595
if (! in_array(strtolower($file->getExtension()), $imageMimes)) {
9696
throw new BusinessException(1000, '类型不允许!');
9797
}

0 commit comments

Comments
 (0)