diff --git a/src/main/java/com/rymcu/vertical/dto/UserDTO.java b/src/main/java/com/rymcu/vertical/dto/UserDTO.java index d8b5b29..b3248bd 100644 --- a/src/main/java/com/rymcu/vertical/dto/UserDTO.java +++ b/src/main/java/com/rymcu/vertical/dto/UserDTO.java @@ -2,6 +2,9 @@ package com.rymcu.vertical.dto; import lombok.Data; +/** + * @author ronger + */ @Data public class UserDTO { diff --git a/src/main/java/com/rymcu/vertical/dto/UserRegisterInfoDTO.java b/src/main/java/com/rymcu/vertical/dto/UserRegisterInfoDTO.java new file mode 100644 index 0000000..740fa08 --- /dev/null +++ b/src/main/java/com/rymcu/vertical/dto/UserRegisterInfoDTO.java @@ -0,0 +1,17 @@ +package com.rymcu.vertical.dto; + +import lombok.Data; + +/** + * @author ronger + */ +@Data +public class UserRegisterInfoDTO { + + private String email; + + private String password; + + private String code; + +} diff --git a/src/main/java/com/rymcu/vertical/web/api/common/CommonApiController.java b/src/main/java/com/rymcu/vertical/web/api/common/CommonApiController.java index 789481e..b26ea25 100644 --- a/src/main/java/com/rymcu/vertical/web/api/common/CommonApiController.java +++ b/src/main/java/com/rymcu/vertical/web/api/common/CommonApiController.java @@ -9,6 +9,7 @@ import com.rymcu.vertical.core.service.log.annotation.VisitLogger; import com.rymcu.vertical.dto.ArticleDTO; import com.rymcu.vertical.dto.ForgetPasswordDTO; import com.rymcu.vertical.dto.TokenUser; +import com.rymcu.vertical.dto.UserRegisterInfoDTO; import com.rymcu.vertical.entity.User; import com.rymcu.vertical.service.ArticleService; import com.rymcu.vertical.service.JavaMailService; @@ -39,7 +40,7 @@ public class CommonApiController { private ArticleService articleService; @ApiOperation(value = "获取邮件验证码") - @PostMapping("/get-email-code") + @GetMapping("/get-email-code") public GlobalResult> getEmailCode(@RequestParam("email") String email) throws MessagingException { Map map = new HashMap<>(1); map.put("message",GlobalResultMessage.SEND_SUCCESS.getMessage()); @@ -56,7 +57,7 @@ public class CommonApiController { } @ApiOperation(value = "获取找回密码邮件") - @PostMapping("/get-forget-password-email") + @GetMapping("/get-forget-password-email") public GlobalResult> getForgetPasswordEmail(@RequestParam("email") String email) throws MessagingException { Map map = new HashMap<>(1); map.put("message",GlobalResultMessage.SEND_SUCCESS.getMessage()); @@ -73,14 +74,14 @@ public class CommonApiController { } @PostMapping("/register") - public GlobalResult register(@RequestParam("email") String email, @RequestParam("password") String password, @RequestParam("code") String code){ - Map map = userService.register(email,password,code); + public GlobalResult register(@RequestBody UserRegisterInfoDTO registerInfo){ + Map map = userService.register(registerInfo.getEmail(), registerInfo.getPassword(), registerInfo.getCode()); return GlobalResultGenerator.genSuccessResult(map); } @PostMapping("/login") - public GlobalResult login(@RequestParam("account") String account, @RequestParam("password") String password){ - Map map = userService.login(account,password); + public GlobalResult login(@RequestBody User user){ + Map map = userService.login(user.getAccount(), user.getPassword()); return GlobalResultGenerator.genSuccessResult(map); }