Compare commits

..

No commits in common. "d1e6e5e15a4f628c3737bbe5776f09cc54fa8233" and "34fb667a107111583f444706b2a67d64ff306de5" have entirely different histories.

2 changed files with 20 additions and 7 deletions

View File

@ -14,10 +14,4 @@ auth:
- /maku/t_user/register
- /maku/t_user/logout
- /maku/t_user/info
- /maku/t_book/list/search
- /maku/t_book/{id}
- /maku/t_book/{id}
- /user/login
- /maku/t_shopping_trolley/aaa
- /maku/t_user/recharge

View File

@ -38,7 +38,26 @@ import java.util.List;
public class TBookCommentController {
private final TBookCommentService tBookCommentService;
private final RedisCache redisCache;
@PostMapping("/comment")
public Result setshoppingtrolly(HttpServletRequest request, @RequestBody TBookCommentVO vo) {
// 首先验证token的有效性然后从Redis中获取用户信息
String token = request.getHeader("token");
if(token==null || token.isEmpty()){
return Result.error("token is error");
}
TUserEntity tUserEntity = (TUserEntity) redisCache.get(token);
Integer userId=tUserEntity.getId();
LocalDateTime currentTime = LocalDateTime.now();
ZoneId zoneId = ZoneId.systemDefault();
//DATE没有时区二localDateTime有时区,为了将 LocalDateTime 转换为 Date你需要指定一个时区因为 Date 是基于UTC的
// 将LocalDateTime转换为ZonedDateTime然后转换为Instant最后转换为Date
// ZonedDateTime zdt = currentTime.atZone(zoneId);
// Date date = Date.from(zdt.toInstant());
// tBookCollectionService.save(userId,bookId,date);
return Result.ok("加入购物车成功");
}
@GetMapping("page")
@Operation(summary = "分页")