Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
b250a8a8d3
|
@ -81,21 +81,40 @@ public class TUserController {
|
|||
if(ObjectUtils.isNull(entity)){
|
||||
throw new ServerException(ErrorCode.REFRESH_TOKEN_INVALID);
|
||||
}
|
||||
|
||||
return Result.ok(entity);
|
||||
TUserEntity p = tUserService.getById(entity.getId());
|
||||
redisCache.set(token, p);
|
||||
return Result.ok(p);
|
||||
}
|
||||
|
||||
@GetMapping("/recharge")
|
||||
@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");
|
||||
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();
|
||||
entity.setBalance(money+balance);
|
||||
tUserService.updateById(entity);
|
||||
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")
|
||||
@Operation(summary = "退出登录")
|
||||
|
|
|
@ -31,6 +31,10 @@ public class TUserVO implements Serializable {
|
|||
|
||||
private Integer status;
|
||||
|
||||
private String email;
|
||||
|
||||
private String phonne;
|
||||
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date createTime;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user