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']);