上传
This commit is contained in:
@@ -5,6 +5,7 @@ namespace app\common\controller;
|
|||||||
use app\common\service\OssService;
|
use app\common\service\OssService;
|
||||||
use app\common\service\UploadedFilesService;
|
use app\common\service\UploadedFilesService;
|
||||||
use app\common\traits\ResponseTrait;
|
use app\common\traits\ResponseTrait;
|
||||||
|
use support\Log;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
use support\exception\BusinessException;
|
use support\exception\BusinessException;
|
||||||
use Shopwwi\WebmanFilesystem\Facade\Storage;
|
use Shopwwi\WebmanFilesystem\Facade\Storage;
|
||||||
@@ -56,7 +57,7 @@ class UploadController
|
|||||||
$data['category'] = $category;
|
$data['category'] = $category;
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
// 记录失败不影响上传结果,只记录日志
|
// 记录失败不影响上传结果,只记录日志
|
||||||
error_log('记录文件信息失败: ' . $e->getMessage());
|
Log::error('记录文件信息失败: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->success($data, 'upload success');
|
return $this->success($data, 'upload success');
|
||||||
@@ -163,13 +164,14 @@ class UploadController
|
|||||||
];
|
];
|
||||||
|
|
||||||
$recordResult = $uploadedFilesService->recordFileInfo($fileInfo, $request, $partition, $category);
|
$recordResult = $uploadedFilesService->recordFileInfo($fileInfo, $request, $partition, $category);
|
||||||
|
$data = [];
|
||||||
$data['file_id'] = $recordResult['id'];
|
$data['file_id'] = $recordResult['id'];
|
||||||
$data['partition'] = $partition;
|
$data['partition'] = $partition;
|
||||||
$data['category'] = $category;
|
$data['category'] = $category;
|
||||||
return $data;
|
return $data;
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
// 记录失败不影响上传结果,只记录日志
|
// 记录失败不影响上传结果,只记录日志
|
||||||
error_log('记录文件信息失败: ' . $e->getMessage());
|
Log::error('记录文件信息失败: ' . $e->getMessage());
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user