From ab0b7b46442a40caf226e1db54fd6e902a3629f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E6=B5=B7=E6=B4=8B?= Date: Sun, 24 May 2026 18:25:01 +0800 Subject: [PATCH] api --- routes/upload.js | 2 +- utils/image-url.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/upload.js b/routes/upload.js index b19320a..ac6e719 100644 --- a/routes/upload.js +++ b/routes/upload.js @@ -37,7 +37,7 @@ router.post('/', upload.single('file'), async (ctx) => { } // 存储相对路径,前端使用时拼接域名 - const fileUrl = `/img/${ctx.file.filename}` + const fileUrl = `/uploads/${ctx.file.filename}` ctx.body = { code: 200, message: '上传成功', diff --git a/utils/image-url.js b/utils/image-url.js index 0706962..dd4f569 100644 --- a/utils/image-url.js +++ b/utils/image-url.js @@ -1,5 +1,5 @@ // 图片URL处理工具 -const DOMAIN_CONFIG = require('./domain').DOMAIN_CONFIG; +const DOMAIN_CONFIG = require('../config/domain').DOMAIN_CONFIG; // 将完整URL转换为相对路径(用于存储到数据库) function toRelativeUrl(url) {