1.fix post @PathVariable issue

main
Gary 10 months ago
parent d1ad390ab3
commit 7034207125

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

Loading…
Cancel
Save