|
|
|
@ -24,7 +24,7 @@ import java.io.ByteArrayOutputStream; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
|
|
|
|
@RestController |
|
|
|
@RestController |
|
|
|
@RequestMapping("/user") |
|
|
|
@RequestMapping("/") |
|
|
|
public class Controller { |
|
|
|
public class Controller { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private final UserServerImpl server; |
|
|
|
private final UserServerImpl server; |
|
|
|
@ -33,9 +33,9 @@ public class Controller { |
|
|
|
this.server = server; |
|
|
|
this.server = server; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/login") |
|
|
|
@PostMapping("login") |
|
|
|
public ResponseResult<UserEntity> login(@RequestParam String name, @RequestParam String password){ |
|
|
|
public ResponseResult<UserEntity> login(UserEntity entity){ |
|
|
|
UserEntity user = server.login(name, password); |
|
|
|
UserEntity user = server.login(entity.getName(), entity.getPassword()); |
|
|
|
if(user!=null){ |
|
|
|
if(user!=null){ |
|
|
|
return ResponseResult.ok(user,"登录成功!"); |
|
|
|
return ResponseResult.ok(user,"登录成功!"); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
@ -43,7 +43,7 @@ public class Controller { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/register") |
|
|
|
@PostMapping("register") |
|
|
|
public ResponseResult<UserVO> register(@RequestBody UserVO user){ |
|
|
|
public ResponseResult<UserVO> register(@RequestBody UserVO user){ |
|
|
|
int userVO = server.register(user); |
|
|
|
int userVO = server.register(user); |
|
|
|
if (user != null){ |
|
|
|
if (user != null){ |
|
|
|
@ -59,7 +59,7 @@ public class Controller { |
|
|
|
* @return 图片 |
|
|
|
* @return 图片 |
|
|
|
* @throws IOException 异常 |
|
|
|
* @throws IOException 异常 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@GetMapping("/captcha") |
|
|
|
@GetMapping("captcha") |
|
|
|
public ResponseEntity<byte[]> getCaptcha(HttpServletResponse response) throws IOException { |
|
|
|
public ResponseEntity<byte[]> getCaptcha(HttpServletResponse response) throws IOException { |
|
|
|
ByteArrayOutputStream stream = new ByteArrayOutputStream(); |
|
|
|
ByteArrayOutputStream stream = new ByteArrayOutputStream(); |
|
|
|
CaptchaGenerator.generateCaptcha(stream, 200, 100, 4); |
|
|
|
CaptchaGenerator.generateCaptcha(stream, 200, 100, 4); |
|
|
|
|