From d2dd29790124cb24f677dffea8945a88c812f99d Mon Sep 17 00:00:00 2001 From: tuyp Date: Mon, 17 Oct 2022 17:00:19 +0800 Subject: [PATCH] 插入视频逻辑修改 --- src/main/java/com/subsidy/controller/VodPlayHistoryController.java | 1 - src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java | 24 ++++++++++++++++-------- src/main/resources/application-dev.properties | 4 ++-- 3 files changed, 18 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..2732de5 100644 --- a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java +++ b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java @@ -45,7 +45,6 @@ public class VodPlayHistoryController { @RequestMapping("insertHistoryNew") @ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点") - @LoginRequired @TimeRequired public ResponseVO insertHistoryNew(@RequestBody String param){ InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class); diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java index 4c51743..dde7819 100644 --- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java @@ -67,27 +67,32 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl= 6 * 3600) { throw new HttpException(13001); } - //是否超过时长 没超过 false 超过 true - if (total + vodPlayHistoryDO.getPlayLength() > classDictDO.getLimitHour() * 3600) { - int playLength = classDictDO.getLimitHour() * 3600 - total; + //是否超过时长 + if (total + vodPlayHistoryDO.getPlayLength() > 6 * 3600) { + + //超过时长 + int playLength = 6 * 3600 - total; vodPlayHistoryDO.setPlayLength(playLength); vodPlayHistoryDO.setPlayCount(1); if (playLength > 5) { this.baseMapper.insert(vodPlayHistoryDO); } - throw new HttpException(13001); - }else { +// throw new HttpException(13001); + } else { vodPlayHistoryDO.setPlayCount(1); this.baseMapper.insert(vodPlayHistoryDO); } + } else if (classDictDO.getLimitHour() == 0) { + vodPlayHistoryDO.setPlayCount(1); + this.baseMapper.insert(vodPlayHistoryDO); } } return ConstantUtils.ADD_SUCCESS; @@ -122,8 +127,11 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl