This commit is contained in:
2025-09-26 14:40:02 +08:00
parent 76cfa08021
commit 8491be681b
9 changed files with 1717 additions and 1629 deletions

View File

@@ -51,54 +51,6 @@ const multiUpload = multer({
}
});
/**
* @swagger
* /upload/image:
* post:
* summary: 上传图片
* tags: [Upload]
* security:
* - bearerAuth: []
* requestBody:
* required: true
* content:
* multipart/form-data:
* schema:
* type: object
* properties:
* file:
* type: string
* format: binary
* description: 要上传的图片文件
* type:
* type: string
* enum: [avatar, product, document]
* default: document
* description: 上传文件类型
* responses:
* 200:
* description: 图片上传成功
* content:
* application/json:
* schema:
* type: object
* properties:
* success:
* type: boolean
* example: true
* url:
* type: string
* description: 上传后的文件URL
* filename:
* type: string
* description: 上传后的文件名
* 400:
* description: 请求参数错误
* 401:
* description: 未授权
* 500:
* description: 服务器错误
*/
router.post('/image', authenticateToken, (req, res) => {
upload.single('file')(req, res, async (err) => {
if (err instanceof multer.MulterError) {