87 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			87 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /**
 | |
|  * @swagger
 | |
|  * tags:
 | |
|  *   name: Captcha
 | |
|  *   description: 验证码API
 | |
|  */
 | |
| /**
 | |
|  * @swagger
 | |
|  * /captcha/generate:
 | |
|  *   get:
 | |
|  *     summary: 生成图形验证码
 | |
|  *     tags: [Captcha]
 | |
|  *     responses:
 | |
|  *       200:
 | |
|  *         description: 成功生成验证码
 | |
|  *         content:
 | |
|  *           application/json:
 | |
|  *             schema:
 | |
|  *               type: object
 | |
|  *               properties:
 | |
|  *                 success:
 | |
|  *                   type: boolean
 | |
|  *                   example: true
 | |
|  *                 data:
 | |
|  *                   type: object
 | |
|  *                   properties:
 | |
|  *                     captchaId:
 | |
|  *                       type: string
 | |
|  *                       description: 验证码唯一ID
 | |
|  *                     image:
 | |
|  *                       type: string
 | |
|  *                       description: Base64编码的SVG验证码图片
 | |
|  *       500:
 | |
|  *         description: 服务器错误
 | |
|  */
 | |
| /**
 | |
|  * @swagger
 | |
|  * /captcha/verify:
 | |
|  *   post:
 | |
|  *     summary: 验证用户输入的验证码
 | |
|  *     tags: [Captcha]
 | |
|  *     requestBody:
 | |
|  *       required: true
 | |
|  *       content:
 | |
|  *         application/json:
 | |
|  *           schema:
 | |
|  *             type: object
 | |
|  *             required:
 | |
|  *               - captchaId
 | |
|  *               - captchaText
 | |
|  *             properties:
 | |
|  *               captchaId:
 | |
|  *                 type: string
 | |
|  *                 description: 验证码唯一ID
 | |
|  *               captchaText:
 | |
|  *                 type: string
 | |
|  *                 description: 用户输入的验证码
 | |
|  *     responses:
 | |
|  *       200:
 | |
|  *         description: 验证码验证成功
 | |
|  *         content:
 | |
|  *           application/json:
 | |
|  *             schema:
 | |
|  *               type: object
 | |
|  *               properties:
 | |
|  *                 success:
 | |
|  *                   type: boolean
 | |
|  *                   example: true
 | |
|  *                 message:
 | |
|  *                   type: string
 | |
|  *                   example: 验证码验证成功
 | |
|  *       400:
 | |
|  *         description: 验证码错误或已过期
 | |
|  *         content:
 | |
|  *           application/json:
 | |
|  *             schema:
 | |
|  *               type: object
 | |
|  *               properties:
 | |
|  *                 success:
 | |
|  *                   type: boolean
 | |
|  *                   example: false
 | |
|  *                 message:
 | |
|  *                   type: string
 | |
|  *                   example: 验证码错误
 | |
|  *       500:
 | |
|  *         description: 服务器错误
 | |
|  */ |