无关风月
2024-07-03 f138375f15c072d10335c20ecec9b35f1da78ee4
ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TStudyController.java
@@ -26,6 +26,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -967,7 +968,7 @@
     */
    @GetMapping("/exitGameOrStory")
    @ApiOperation(value = "退出游戏/故事学习", tags = {"学习端-题目"})
    public R<Boolean> exitGameOrStory(@RequestParam Integer studyTime) {
    public R<Boolean> exitGameOrStory(@RequestParam("studyTime") Integer studyTime) {
        LoginUserParent loginStudy = tokenService.getLoginUserStudy();
        if (null == loginStudy) {
            return R.tokenError("登录失效!");
@@ -1702,6 +1703,7 @@
                .eq(TGameRecord::getDisabled, 0)
                .orderByDesc(TGameRecord::getCreateTime)
                .list();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm");
        if (null != studyRecord) {
            // 学习时长格式转换
            Integer todayStudy = studyRecord.getTodayStudy();
@@ -1712,6 +1714,9 @@
            studyRecord.setMonthStudy(Math.round((float) monthStudy / 3600));
            // 游戏总时长
            int sum = gameRecordList.stream().map(TGameRecord::getUseTime).mapToInt(Integer::intValue).sum();
            for (TGameRecord tGameRecord : gameRecordList) {
                tGameRecord.setTime(simpleDateFormat.format(tGameRecord.getCreateTime()));
            }
            Integer totalStudy = studyRecord.getTotalStudy();
            studyRecord.setTotalStudy(Math.round((float) (totalStudy + sum) / 3600));
            // 剩余周目