更新上传接口

This commit is contained in:
JaguarJack 2021-05-09 17:08:48 +08:00
parent 0a4951091f
commit 4f1eeae989

View File

@ -36,13 +36,15 @@ class Upload extends CatchController
*/ */
public function image(CatchRequest $request, CatchUpload $upload): \think\response\Json public function image(CatchRequest $request, CatchUpload $upload): \think\response\Json
{ {
$images = $request->file(); $images = array_values($request->file());
if (!$images) { if (!count($images)) {
throw new FailedException('请选择图片上传'); throw new FailedException('请选择图片上传');
} }
return CatchResponse::success($upload->checkImages($images)->multiUpload($images['image'])); return CatchResponse::success($upload->checkImages($images)->multiUpload(
count($images) < 2 ? $images[0] : $images
));
} }
/** /**