Compare commits
No commits in common. "65a6d47e61682cc1a71e07210e5e0b355b860ed0" and "39591d3940d9e082d2bed08514bca2b308e12352" have entirely different histories.
65a6d47e61
...
39591d3940
|
@ -81,40 +81,21 @@ public class TUserController {
|
||||||
if(ObjectUtils.isNull(entity)){
|
if(ObjectUtils.isNull(entity)){
|
||||||
throw new ServerException(ErrorCode.REFRESH_TOKEN_INVALID);
|
throw new ServerException(ErrorCode.REFRESH_TOKEN_INVALID);
|
||||||
}
|
}
|
||||||
TUserEntity p = tUserService.getById(entity.getId());
|
|
||||||
redisCache.set(token, p);
|
return Result.ok(entity);
|
||||||
return Result.ok(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/recharge")
|
@GetMapping("/recharge")
|
||||||
@Operation(summary = "充值")
|
@Operation(summary = "充值")
|
||||||
public Result<String> recharge(HttpServletRequest request,@RequestParam(value = "balance") int balance){
|
public Result<String> recharge(HttpServletRequest request,@RequestParam(value = "balance",required =false) int balance){
|
||||||
String token = request.getHeader("token");
|
String token = request.getHeader("token");
|
||||||
TUserEntity entity = (TUserEntity) redisCache.get(token);
|
TUserEntity entity = (TUserEntity) redisCache.get(token);;
|
||||||
if(ObjectUtils.isNull(entity)){
|
|
||||||
throw new ServerException(ErrorCode.REFRESH_TOKEN_INVALID);
|
|
||||||
}
|
|
||||||
int money=entity.getBalance();
|
int money=entity.getBalance();
|
||||||
entity.setBalance(money+balance);
|
entity.setBalance(money+balance);
|
||||||
tUserService.updateById(entity);
|
tUserService.updateById(entity);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/userInfo")
|
|
||||||
@Operation(summary = "更新资料")
|
|
||||||
public Result<String> userInfo(HttpServletRequest request,@RequestBody TUserVO vo){
|
|
||||||
String token = request.getHeader("token");
|
|
||||||
TUserEntity tokenUser = (TUserEntity) redisCache.get(token);
|
|
||||||
TUserEntity entity = tUserService.getById(tokenUser.getId());
|
|
||||||
if(ObjectUtils.isNull(entity)){
|
|
||||||
throw new ServerException(ErrorCode.REFRESH_TOKEN_INVALID);
|
|
||||||
}
|
|
||||||
entity.setEmail(vo.getEmail());
|
|
||||||
entity.setPhone(vo.getPassword());
|
|
||||||
tUserService.updateById(entity);
|
|
||||||
return Result.ok("success");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/logout")
|
@PostMapping("/logout")
|
||||||
@Operation(summary = "退出登录")
|
@Operation(summary = "退出登录")
|
||||||
|
|
|
@ -31,10 +31,6 @@ public class TUserVO implements Serializable {
|
||||||
|
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
private String phonne;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user