From a96b71bd06daf58e15e6b58dec994ced449eb0d6 Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Tue, 26 Nov 2024 21:57:33 +0800 Subject: [PATCH] =?UTF-8?q?release-=20lottery=20h5=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../luoo/user/controller/PointController.java | 8 ++++---- .../com/luoo/user/service/LotteryService.java | 20 ++++++++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/luoo_user/src/main/java/com/luoo/user/controller/PointController.java b/luoo_user/src/main/java/com/luoo/user/controller/PointController.java index 0619f82..b1da919 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/PointController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/PointController.java @@ -365,9 +365,9 @@ public class PointController { @ApiOperation(value = "3.10.已参与抽奖的人(APP)", notes = "APP") @PostMapping("/lottery/participated/{page}/{size}") - @GlobalInterceptor(checkAppUserLogin = true) +// @GlobalInterceptor(checkAppUserLogin = true) public Result> findParticipatedLotteryUserList( - @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, + @ApiParam(value = "Header中的token信息") @RequestHeader("Authorization") String token, @ApiParam(value = "查询参数") @RequestBody LotteryParticipatedSearchDto lotteryParticipatedSearchDto, @ApiParam(value = "页码", required = true) @PathVariable Integer page, @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { @@ -411,9 +411,9 @@ public class PointController { @ApiOperation(value = "3.14.抽奖详情(APP)", notes = "APP") @GetMapping("/app/lottery/detail/{id}") - @GlobalInterceptor(checkAppUserLogin = true) +// @GlobalInterceptor(checkAppUserLogin = true) public Result findLotteryDetailAPPVO( - @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, + @ApiParam(value = "Header中的token信息") @RequestHeader("Authorization") String token, @ApiParam(value = "抽奖id", required = true) @PathVariable String id) { return Result.success(lotteryService.getLotteryDetailAPPVO(id)); } diff --git a/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java b/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java index 94aaf03..8abfffc 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java @@ -705,6 +705,13 @@ public class LotteryService { .limit(pageable.getPageSize()) .fetch(); + UserLoginDto user = jwtUtil.getUser(); + if (user == null) { + for (LotteryUserAPPVO lotteryUserAPPVO : lotteryUserList) { + lotteryUserAPPVO.setResult(null); + } + } + long total = jpaQueryFactory .select(qLotteryUser.count()) .from(qLotteryUser) @@ -837,12 +844,15 @@ public class LotteryService { BeanUtils.copyProperties(lotteryDetailPCVO, result); UserLoginDto userLoginDto = jwtUtil.getUser(); - LotteryUser lotteryUser = lotteryUserDao.findByLotteryIdAndUserId(lotteryId, userLoginDto.getUserId()); - if (lotteryUser != null) { - result.setIsParticipate(PointEnums.PARTICIPATED.getCode()); - } else { - result.setIsParticipate(PointEnums.NOT_PARTICIPATED.getCode()); + if (userLoginDto != null) { + LotteryUser lotteryUser = lotteryUserDao.findByLotteryIdAndUserId(lotteryId, userLoginDto.getUserId()); + if (lotteryUser != null) { + result.setIsParticipate(PointEnums.PARTICIPATED.getCode()); + } else { + result.setIsParticipate(PointEnums.NOT_PARTICIPATED.getCode()); + } } + long participateNum = getParticipateNumByLotteryId(lotteryId); // 设置抽奖人数 result.setParticipateNum(participateNum);