364 lines
10 KiB
JavaScript
364 lines
10 KiB
JavaScript
|
|
/**
|
|||
|
|
* @swagger
|
|||
|
|
* tags:
|
|||
|
|
* name: 文件上传
|
|||
|
|
* description: 文件上传管理相关接口
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @swagger
|
|||
|
|
* /upload/single:
|
|||
|
|
* post:
|
|||
|
|
* summary: 单文件上传
|
|||
|
|
* tags: [文件上传]
|
|||
|
|
* security:
|
|||
|
|
* - bearerAuth: []
|
|||
|
|
* requestBody:
|
|||
|
|
* required: true
|
|||
|
|
* content:
|
|||
|
|
* multipart/form-data:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* file:
|
|||
|
|
* type: string
|
|||
|
|
* format: binary
|
|||
|
|
* description: 上传的文件
|
|||
|
|
* responses:
|
|||
|
|
* 200:
|
|||
|
|
* description: 上传成功
|
|||
|
|
* content:
|
|||
|
|
* application/json:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* success:
|
|||
|
|
* type: boolean
|
|||
|
|
* example: true
|
|||
|
|
* data:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* filename:
|
|||
|
|
* type: string
|
|||
|
|
* description: 文件名
|
|||
|
|
* originalname:
|
|||
|
|
* type: string
|
|||
|
|
* description: 原始文件名
|
|||
|
|
* path:
|
|||
|
|
* type: string
|
|||
|
|
* description: 文件路径
|
|||
|
|
* size:
|
|||
|
|
* type: integer
|
|||
|
|
* description: 文件大小(字节)
|
|||
|
|
* mimetype:
|
|||
|
|
* type: string
|
|||
|
|
* description: 文件MIME类型
|
|||
|
|
* url:
|
|||
|
|
* type: string
|
|||
|
|
* description: 文件访问URL
|
|||
|
|
* 400:
|
|||
|
|
* description: 上传失败
|
|||
|
|
* 401:
|
|||
|
|
* description: 未授权
|
|||
|
|
* 413:
|
|||
|
|
* description: 文件过大
|
|||
|
|
* 500:
|
|||
|
|
* description: 服务器错误
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @swagger
|
|||
|
|
* /upload/multiple:
|
|||
|
|
* post:
|
|||
|
|
* summary: 多文件上传
|
|||
|
|
* tags: [文件上传]
|
|||
|
|
* security:
|
|||
|
|
* - bearerAuth: []
|
|||
|
|
* requestBody:
|
|||
|
|
* required: true
|
|||
|
|
* content:
|
|||
|
|
* multipart/form-data:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* files:
|
|||
|
|
* type: array
|
|||
|
|
* items:
|
|||
|
|
* type: string
|
|||
|
|
* format: binary
|
|||
|
|
* description: 上传的文件数组
|
|||
|
|
* responses:
|
|||
|
|
* 200:
|
|||
|
|
* description: 上传成功
|
|||
|
|
* content:
|
|||
|
|
* application/json:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* success:
|
|||
|
|
* type: boolean
|
|||
|
|
* example: true
|
|||
|
|
* data:
|
|||
|
|
* type: array
|
|||
|
|
* items:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* filename:
|
|||
|
|
* type: string
|
|||
|
|
* description: 文件名
|
|||
|
|
* originalname:
|
|||
|
|
* type: string
|
|||
|
|
* description: 原始文件名
|
|||
|
|
* path:
|
|||
|
|
* type: string
|
|||
|
|
* description: 文件路径
|
|||
|
|
* size:
|
|||
|
|
* type: integer
|
|||
|
|
* description: 文件大小(字节)
|
|||
|
|
* mimetype:
|
|||
|
|
* type: string
|
|||
|
|
* description: 文件MIME类型
|
|||
|
|
* url:
|
|||
|
|
* type: string
|
|||
|
|
* description: 文件访问URL
|
|||
|
|
* 400:
|
|||
|
|
* description: 上传失败
|
|||
|
|
* 401:
|
|||
|
|
* description: 未授权
|
|||
|
|
* 413:
|
|||
|
|
* description: 文件过大
|
|||
|
|
* 500:
|
|||
|
|
* description: 服务器错误
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @swagger
|
|||
|
|
* /upload/avatar:
|
|||
|
|
* post:
|
|||
|
|
* summary: 头像上传
|
|||
|
|
* tags: [文件上传]
|
|||
|
|
* security:
|
|||
|
|
* - bearerAuth: []
|
|||
|
|
* requestBody:
|
|||
|
|
* required: true
|
|||
|
|
* content:
|
|||
|
|
* multipart/form-data:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* avatar:
|
|||
|
|
* type: string
|
|||
|
|
* format: binary
|
|||
|
|
* description: 头像文件(支持jpg, jpeg, png, gif格式,最大2MB)
|
|||
|
|
* responses:
|
|||
|
|
* 200:
|
|||
|
|
* description: 上传成功
|
|||
|
|
* content:
|
|||
|
|
* application/json:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* success:
|
|||
|
|
* type: boolean
|
|||
|
|
* example: true
|
|||
|
|
* data:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* filename:
|
|||
|
|
* type: string
|
|||
|
|
* description: 文件名
|
|||
|
|
* url:
|
|||
|
|
* type: string
|
|||
|
|
* description: 头像访问URL
|
|||
|
|
* 400:
|
|||
|
|
* description: 文件格式不支持或文件过大
|
|||
|
|
* 401:
|
|||
|
|
* description: 未授权
|
|||
|
|
* 500:
|
|||
|
|
* description: 服务器错误
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @swagger
|
|||
|
|
* /upload/qrcode:
|
|||
|
|
* post:
|
|||
|
|
* summary: 二维码上传
|
|||
|
|
* tags: [文件上传]
|
|||
|
|
* security:
|
|||
|
|
* - bearerAuth: []
|
|||
|
|
* requestBody:
|
|||
|
|
* required: true
|
|||
|
|
* content:
|
|||
|
|
* multipart/form-data:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* qrcode:
|
|||
|
|
* type: string
|
|||
|
|
* format: binary
|
|||
|
|
* description: 二维码文件(支持jpg, jpeg, png格式,最大5MB)
|
|||
|
|
* responses:
|
|||
|
|
* 200:
|
|||
|
|
* description: 上传成功
|
|||
|
|
* content:
|
|||
|
|
* application/json:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* success:
|
|||
|
|
* type: boolean
|
|||
|
|
* example: true
|
|||
|
|
* data:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* filename:
|
|||
|
|
* type: string
|
|||
|
|
* description: 文件名
|
|||
|
|
* url:
|
|||
|
|
* type: string
|
|||
|
|
* description: 二维码访问URL
|
|||
|
|
* 400:
|
|||
|
|
* description: 文件格式不支持或文件过大
|
|||
|
|
* 401:
|
|||
|
|
* description: 未授权
|
|||
|
|
* 500:
|
|||
|
|
* description: 服务器错误
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @swagger
|
|||
|
|
* /upload/idcard:
|
|||
|
|
* post:
|
|||
|
|
* summary: 身份证上传
|
|||
|
|
* tags: [文件上传]
|
|||
|
|
* security:
|
|||
|
|
* - bearerAuth: []
|
|||
|
|
* requestBody:
|
|||
|
|
* required: true
|
|||
|
|
* content:
|
|||
|
|
* multipart/form-data:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* idcard:
|
|||
|
|
* type: string
|
|||
|
|
* format: binary
|
|||
|
|
* description: 身份证文件(支持jpg, jpeg, png格式,最大10MB)
|
|||
|
|
* responses:
|
|||
|
|
* 200:
|
|||
|
|
* description: 上传成功
|
|||
|
|
* content:
|
|||
|
|
* application/json:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* success:
|
|||
|
|
* type: boolean
|
|||
|
|
* example: true
|
|||
|
|
* data:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* filename:
|
|||
|
|
* type: string
|
|||
|
|
* description: 文件名
|
|||
|
|
* url:
|
|||
|
|
* type: string
|
|||
|
|
* description: 身份证访问URL
|
|||
|
|
* 400:
|
|||
|
|
* description: 文件格式不支持或文件过大
|
|||
|
|
* 401:
|
|||
|
|
* description: 未授权
|
|||
|
|
* 500:
|
|||
|
|
* description: 服务器错误
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @swagger
|
|||
|
|
* /upload/license:
|
|||
|
|
* post:
|
|||
|
|
* summary: 营业执照上传
|
|||
|
|
* tags: [文件上传]
|
|||
|
|
* security:
|
|||
|
|
* - bearerAuth: []
|
|||
|
|
* requestBody:
|
|||
|
|
* required: true
|
|||
|
|
* content:
|
|||
|
|
* multipart/form-data:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* license:
|
|||
|
|
* type: string
|
|||
|
|
* format: binary
|
|||
|
|
* description: 营业执照文件(支持jpg, jpeg, png, pdf格式,最大10MB)
|
|||
|
|
* responses:
|
|||
|
|
* 200:
|
|||
|
|
* description: 上传成功
|
|||
|
|
* content:
|
|||
|
|
* application/json:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* success:
|
|||
|
|
* type: boolean
|
|||
|
|
* example: true
|
|||
|
|
* data:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* filename:
|
|||
|
|
* type: string
|
|||
|
|
* description: 文件名
|
|||
|
|
* url:
|
|||
|
|
* type: string
|
|||
|
|
* description: 营业执照访问URL
|
|||
|
|
* 400:
|
|||
|
|
* description: 文件格式不支持或文件过大
|
|||
|
|
* 401:
|
|||
|
|
* description: 未授权
|
|||
|
|
* 500:
|
|||
|
|
* description: 服务器错误
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @swagger
|
|||
|
|
* /upload/file:
|
|||
|
|
* delete:
|
|||
|
|
* summary: 删除文件
|
|||
|
|
* tags: [文件上传]
|
|||
|
|
* security:
|
|||
|
|
* - bearerAuth: []
|
|||
|
|
* requestBody:
|
|||
|
|
* required: true
|
|||
|
|
* content:
|
|||
|
|
* application/json:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* required:
|
|||
|
|
* - filename
|
|||
|
|
* properties:
|
|||
|
|
* filename:
|
|||
|
|
* type: string
|
|||
|
|
* description: 要删除的文件名
|
|||
|
|
* responses:
|
|||
|
|
* 200:
|
|||
|
|
* description: 删除成功
|
|||
|
|
* content:
|
|||
|
|
* application/json:
|
|||
|
|
* schema:
|
|||
|
|
* type: object
|
|||
|
|
* properties:
|
|||
|
|
* success:
|
|||
|
|
* type: boolean
|
|||
|
|
* example: true
|
|||
|
|
* message:
|
|||
|
|
* type: string
|
|||
|
|
* example: "文件删除成功"
|
|||
|
|
* 400:
|
|||
|
|
* description: 参数错误
|
|||
|
|
* 401:
|
|||
|
|
* description: 未授权
|
|||
|
|
* 404:
|
|||
|
|
* description: 文件不存在
|
|||
|
|
* 500:
|
|||
|
|
* description: 服务器错误
|
|||
|
|
*/
|