From 4ad463a47507e01b790262a59ae7ad348dde8a6c Mon Sep 17 00:00:00 2001 From: typ Date: Sun, 16 Oct 2022 13:17:55 +0800 Subject: [PATCH] 每日学习时长计算bug修复 --- src/main/java/com/subsidy/controller/VodPlayHistoryController.java | 2 +- src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java | 22 +++++++++++++++------- src/main/resources/application-dev.properties | 4 ++-- src/main/resources/application.properties | 2 +- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java index 8aaf441..02afe1d 100644 --- a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java +++ b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java @@ -37,7 +37,7 @@ public class VodPlayHistoryController { @PostMapping("insertHistory") @ApiOperation("记录学生看视频位置 ajax请求 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点") - @LoginRequired +// @LoginRequired @TimeRequired public ResponseVO insertHistory(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){ return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistory(vodPlayHistoryDO)); diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java index 9bc9f14..470fa3c 100644 --- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java @@ -67,16 +67,18 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl= 6 * 3600) { throw new HttpException(13001); } - //是否超过时长 没超过 false 超过 true + //是否超过时长 if (total + vodPlayHistoryDO.getPlayLength() > 6 * 3600) { + + //超过时长 int playLength = 6 * 3600 - total; vodPlayHistoryDO.setPlayLength(playLength); vodPlayHistoryDO.setPlayCount(1); @@ -84,10 +86,13 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl