1.fix null param issue

main
Gary 10 months ago
parent 0b0285b6ee
commit d1ad390ab3

@ -77,20 +77,21 @@ public class MyController {
@ApiImplicitParam(name = "birthDay", value = "生日,格式为: yyyy.MM.dd", required = false), @ApiImplicitParam(name = "birthDay", value = "生日,格式为: yyyy.MM.dd", required = false),
@ApiImplicitParam(name = "sex", value = "性别4个值0为男1 为女2为保密不填为空", required = false) @ApiImplicitParam(name = "sex", value = "性别4个值0为男1 为女2为保密不填为空", required = false)
}) })
@PutMapping("/updateUserInfo") @PostMapping("/updateUserInfo/{nickName}/{signature}/{birthDay}/{sex}")
@GlobalInterceptor(checkAppUserLogin = true) @GlobalInterceptor(checkAppUserLogin = true)
public Result<Void> updateUserInfo(@RequestHeader(value = "token", required = false) String token, public Result<Void> updateUserInfo(@RequestHeader(value = "token", required = false) String token,
@VerifyParam(max = 12) String nickName, @PathVariable @VerifyParam(max = 12) String nickName,
@VerifyParam(max = 50) String signature, @PathVariable @VerifyParam(max = 50) String signature,
String birthDay, @PathVariable String birthDay,
String sex) { @PathVariable String sex) {
UserLoginDto userLoginDto = jwtUtil.getUserLoginDto(token);
if(!StringTools.isEmpty(nickName)) { if(!StringTools.isEmpty(nickName)) {
long count = userService.countByNickName(nickName); long count = userService.countByNickName(nickName);
if (count > 0) { if (count > 0) {
return Result.failed(StatusCode.USER_NICK_NAME_HAS_BEEN_EXIST); return Result.failed(StatusCode.USER_NICK_NAME_HAS_BEEN_EXIST);
} }
} }
UserLoginDto userLoginDto = jwtUtil.getUserLoginDto(token);
User user = userService.findById(userLoginDto.getUserId()); User user = userService.findById(userLoginDto.getUserId());
if(!StringTools.isEmpty(nickName)) { if(!StringTools.isEmpty(nickName)) {
user.setNickname(nickName); user.setNickname(nickName);

Loading…
Cancel
Save