提交
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user