Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
b250a8a8d3
|
@ -81,21 +81,40 @@ 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());
|
||||||
return Result.ok(entity);
|
redisCache.set(token, p);
|
||||||
|
return Result.ok(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/recharge")
|
@GetMapping("/recharge")
|
||||||
@Operation(summary = "充值")
|
@Operation(summary = "充值")
|
||||||
public Result<String> recharge(HttpServletRequest request,@RequestParam(value = "balance",required =false) int balance){
|
public Result<String> recharge(HttpServletRequest request,@RequestParam(value = "balance") 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,6 +31,10 @@ 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