| | |
| | | int sum = gameRecordList.stream().map(TGameRecord::getUseTime).mapToInt(Integer::intValue).sum(); |
| | | Integer totalStudy = studyRecord.getTotalStudy(); |
| | | studyRecord.setTotalStudy(Math.round((float) (totalStudy + sum) / 3600)); |
| | | studyRecord = studyService.studySchedule(studyRecord,week); |
| | | } |
| | | return R.ok(studyRecord); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 退出游戏/故事学习 |
| | | */ |
| | | @GetMapping("/exitGameOrStory") |
| | | @ApiOperation(value = "退出游戏/故事学习", tags = {"学习端-题目"}) |
| | | public R<Boolean> exitGameOrStory(@RequestParam Integer studyTime) { |
| | | LoginUserParent loginStudy = tokenService.getLoginUserStudy(); |
| | | if (null == loginStudy) { |
| | | return R.tokenError("登录失效!"); |
| | | } |
| | | Integer userid = loginStudy.getUserid(); |
| | | // 判断当前week和day是否已完成学习 |
| | | TUserStudy userStudy = userStudyService.lambdaQuery().eq(TUserStudy::getUserId, userid) |
| | | .eq(TUserStudy::getDisabled, 0).one(); |
| | | if (null == userStudy) { |
| | | userStudy = createUserStudy(userid); |
| | | } |
| | | // 学习时长更新 |
| | | userStudy.setTotalStudy(userStudy.getTotalStudy() + studyTime); |
| | | userStudy.setTodayStudy(userStudy.getTodayStudy() + studyTime); |
| | | userStudy.setWeekStudy(userStudy.getWeekStudy() + studyTime); |
| | | userStudy.setMonthStudy(userStudy.getMonthStudy() + studyTime); |
| | | return R.ok(userStudyService.updateById(userStudy)); |
| | | } |
| | | |
| | | /** |
| | | * 自主学习1-听音选图 |
| | | * |
| | | * @param week 周目 |