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