feat: 新增验证码接口
This commit is contained in:
		| @@ -2,9 +2,13 @@ package com.cnbm.admin.controller; | ||||
|  | ||||
| import com.cnbm.admin.handler.LogoutSuccessHandlerImpl; | ||||
| import com.cnbm.admin.params.LoginParam; | ||||
| import com.cnbm.admin.service.CaptchaService; | ||||
| import com.cnbm.admin.service.LoginService; | ||||
| import com.cnbm.admin.utils.ResponseResult; | ||||
| import com.cnbm.common.exception.ErrorCode; | ||||
| import com.cnbm.common.validator.AssertUtils; | ||||
| import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiOperation; | ||||
| import lombok.extern.log4j.Log4j2; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -17,6 +21,7 @@ import org.springframework.web.bind.annotation.*; | ||||
|  | ||||
| import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.io.IOException; | ||||
|  | ||||
| /** | ||||
|  * @Author weihongyang | ||||
| @@ -31,6 +36,20 @@ public class LoginController { | ||||
|     @Autowired | ||||
|     private LoginService loginService; | ||||
|  | ||||
|     @Autowired | ||||
|     private CaptchaService captchaService; | ||||
|  | ||||
|     @GetMapping("/captcha") | ||||
|     @ApiOperation(value = "验证码", produces="application/octet-stream") | ||||
|     @ApiImplicitParam(paramType = "query", dataTypeClass=String.class, name = "uuid", required = true) | ||||
|     public void captcha(HttpServletResponse response, String uuid)throws IOException { | ||||
|         //uuid不能为空 | ||||
|         AssertUtils.isBlank(uuid, ErrorCode.IDENTIFIER_NOT_NULL); | ||||
|  | ||||
|         //生成验证码 | ||||
|         captchaService.create(response, uuid); | ||||
|     } | ||||
|  | ||||
|     @PostMapping("/login") | ||||
|     @ApiOperation(value = "登录") | ||||
|     public ResponseResult login(HttpServletRequest request, @RequestBody LoginParam loginParam) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user