feat(user): 新增VIP字段及完善MyBatis-Plus映射
This commit is contained in:
@@ -22,6 +22,8 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
* 用户前端控制器
|
||||
*
|
||||
@@ -76,7 +78,17 @@ public class UserController {
|
||||
public BaseResponse<KeyboardUserInfoRespVO> detail() {
|
||||
long loginId = StpUtil.getLoginIdAsLong();
|
||||
KeyboardUser keyboardUser = userService.getById(loginId);
|
||||
return ResultUtils.success(BeanUtil.copyProperties(keyboardUser, KeyboardUserInfoRespVO.class));
|
||||
KeyboardUserInfoRespVO respVO = BeanUtil.copyProperties(keyboardUser, KeyboardUserInfoRespVO.class);
|
||||
|
||||
// 格式化VIP到期时间
|
||||
if (keyboardUser.getVipExpiry() != null) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
respVO.setVipExpiry(sdf.format(keyboardUser.getVipExpiry()));
|
||||
} else {
|
||||
respVO.setVipExpiry(null);
|
||||
}
|
||||
|
||||
return ResultUtils.success(respVO);
|
||||
}
|
||||
|
||||
@PostMapping("/register")
|
||||
|
||||
Reference in New Issue
Block a user