| | |
| | | Integer current = dto.getCurrent(); |
| | | if (-1 == dto.getStepOrDown()) { |
| | | if (current - 1 < 0) { |
| | | return R.fail("操作失败"); |
| | | current = 0; |
| | | } |
| | | current--; |
| | | } else { |
| | | current++; |
| | | //下一题 |
| | | current++; |
| | | if (current >= count) { |
| | | return R.fail("操作失败"); |
| | | current = count - 1; |
| | | } |
| | | } |
| | | List<TLotteryEventQuestions> list = lotteryEventServiceQuestionsService.list(new QueryWrapper<TLotteryEventQuestions>().eq("lottery_event_id", dto.getId()).orderByAsc("sort")); |
| | |
| | | map.put("name", item.getAnswers()); |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | if (-1 == dto.getStepOrDown()) { |
| | | if (-1 == dto.getStepOrDown() || current == list.size() - 1) { |
| | | TUserLotteryEventQuestionsAnswers one = userLotteryEventQuestionsAnswersService.getOne(new QueryWrapper<TUserLotteryEventQuestionsAnswers>().eq("lottery_event_id", dto.getId()).eq("user_id", userId).orderByDesc("create_time").last(" limit 0, 1")); |
| | | if (null != one) { |
| | | vo.setAnswer(lotteryEventQuestionsAnswersService.getById(one.getLotteryEventQuestionsAnswersId()).getAnswers()); |
| | |
| | | one.setIsCorrect(1); |
| | | } |
| | | userLotteryEventQuestionsAnswersService.saveOrUpdate(one); |
| | | //判断 |
| | | |
| | | return R.ok(); |
| | | } |
| | | |