mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
perf: 修改 request body
This commit is contained in:
parent
85f6ad957b
commit
42e557c713
@ -11,10 +11,7 @@ import io.github.xxyopen.novel.dto.resp.UserLoginRespDto;
|
|||||||
import io.github.xxyopen.novel.service.UserService;
|
import io.github.xxyopen.novel.service.UserService;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员模块相关 控制器
|
* 会员模块相关 控制器
|
||||||
@ -35,7 +32,7 @@ public class UserController {
|
|||||||
* 用户注册接口
|
* 用户注册接口
|
||||||
*/
|
*/
|
||||||
@PostMapping("register")
|
@PostMapping("register")
|
||||||
public RestResp<String> register(@Valid UserRegisterReqDto dto) {
|
public RestResp<String> register(@Valid @RequestBody UserRegisterReqDto dto) {
|
||||||
return userService.register(dto);
|
return userService.register(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +40,7 @@ public class UserController {
|
|||||||
* 用户登录接口
|
* 用户登录接口
|
||||||
*/
|
*/
|
||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
public RestResp<UserLoginRespDto> login(@Valid UserLoginReqDto dto) {
|
public RestResp<UserLoginRespDto> login(@Valid @RequestBody UserLoginReqDto dto) {
|
||||||
return userService.login(dto);
|
return userService.login(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +49,7 @@ public class UserController {
|
|||||||
* 用户信息修改接口
|
* 用户信息修改接口
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public RestResp<Void> updateUserInfo(@Valid UserInfoUptReqDto dto) {
|
public RestResp<Void> updateUserInfo(@Valid @RequestBody UserInfoUptReqDto dto) {
|
||||||
dto.setUserId(UserHolder.getUserId());
|
dto.setUserId(UserHolder.getUserId());
|
||||||
return userService.updateUserInfo(dto);
|
return userService.updateUserInfo(dto);
|
||||||
}
|
}
|
||||||
@ -61,7 +58,7 @@ public class UserController {
|
|||||||
* 用户反馈
|
* 用户反馈
|
||||||
*/
|
*/
|
||||||
@PostMapping("feedBack")
|
@PostMapping("feedBack")
|
||||||
public RestResp<Void> submitFeedBack(String content) {
|
public RestResp<Void> submitFeedBack(@RequestBody String content) {
|
||||||
return userService.saveFeedBack(UserHolder.getUserId(), content);
|
return userService.saveFeedBack(UserHolder.getUserId(), content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,5 +14,5 @@ public class UserLoginRespDto {
|
|||||||
|
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
private String jwt;
|
private String token;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
|
|
||||||
// 登录成功,生成JWT并返回
|
// 登录成功,生成JWT并返回
|
||||||
return RestResp.ok(UserLoginRespDto.builder()
|
return RestResp.ok(UserLoginRespDto.builder()
|
||||||
.jwt(jwtUtils.generateToken(userInfo.getId(), SystemConfigConsts.NOVEL_FRONT_KEY))
|
.token(jwtUtils.generateToken(userInfo.getId(), SystemConfigConsts.NOVEL_FRONT_KEY))
|
||||||
.nickName(userInfo.getNickName()).build());
|
.nickName(userInfo.getNickName()).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user