From 8a056e22952a34b301a65285fded8b3d31d372c4 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Thu, 5 Mar 2026 17:18:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/controller/UploadController.php | 16 ---------------- backend/app/service/UploadService.php | 13 ------------- backend/config/route.php | 1 - 3 files changed, 30 deletions(-) diff --git a/backend/app/controller/UploadController.php b/backend/app/controller/UploadController.php index 6eb1902..76856af 100644 --- a/backend/app/controller/UploadController.php +++ b/backend/app/controller/UploadController.php @@ -53,22 +53,6 @@ class UploadController extends BaseController } } - /** - * 头像上传接口 - */ - public function uploadAvatar(Request $request): Response - { - try { - $userId = $this->getUserId($request); // 可选,没有token则为null - - $result = $this->uploadService->uploadAvatar($request, $userId); - - return $this->success($result, '头像上传成功'); - } catch (\Exception $e) { - return $this->error($e->getMessage()); - } - } - /** * 二手车图片上传接口 */ diff --git a/backend/app/service/UploadService.php b/backend/app/service/UploadService.php index a15d7a3..c79642a 100644 --- a/backend/app/service/UploadService.php +++ b/backend/app/service/UploadService.php @@ -167,19 +167,6 @@ class UploadService return $this->upload($request, self::PARTITION_IMAGE, $category, $userId); } - /** - * 上传头像(专用接口) - * - * @param Request $request 请求对象 - * @param int|null $userId 用户ID - * @return array - * @throws \Exception - */ - public function uploadAvatar(Request $request, ?int $userId = null): array - { - return $this->upload($request, self::PARTITION_AVATAR, 'avatar', $userId); - } - /** * 上传二手车图片(专用接口) * diff --git a/backend/config/route.php b/backend/config/route.php index ed1ecc6..eb9b7e4 100644 --- a/backend/config/route.php +++ b/backend/config/route.php @@ -83,7 +83,6 @@ Route::group('/api/v1/usedcar', function () { Route::group('/api/v1/upload', function () { Route::post('/file', [app\controller\UploadController::class, 'upload']); Route::post('/image', [app\controller\UploadController::class, 'uploadImage']); - Route::post('/avatar', [app\controller\UploadController::class, 'uploadAvatar']); Route::post('/usedcar', [app\controller\UploadController::class, 'uploadUsedCarImage']); Route::post('/batch', [app\controller\UploadController::class, 'batchUploadImages']); Route::post('/delete', [app\controller\UploadController::class, 'deleteFile']);