Commit 858a7caf by 涂亚平

20220707 备个份

1 parent e4b76240
...@@ -65,8 +65,8 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -65,8 +65,8 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Autowired @Autowired
private MemberMapper memberMapper; private MemberMapper memberMapper;
@Autowired // @Autowired
private RedisUtil redisUtil; // private RedisUtil redisUtil;
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) { public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
...@@ -81,11 +81,18 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -81,11 +81,18 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//查看当天这个人看了多少时间 //查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId()); Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
if (total == classHourDictDO.getClassHour() * 3600){
throw new HttpException(13001);
}
//是否超过时长 没超过 false 超过 true //是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) { if (total + vodPlayHistoryDO.getPlayLength() > classHourDictDO.getClassHour() * 3600) {
int playLength = classHourDictDO.getClassHour() * 3600 - total; int playLength = classHourDictDO.getClassHour() * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength); vodPlayHistoryDO.setPlayLength(playLength);
this.baseMapper.insert(vodPlayHistoryDO); vodPlayHistoryDO.setPlayCount(1);
if (playLength>3){
this.baseMapper.insert(vodPlayHistoryDO);
}
throw new HttpException(13001); throw new HttpException(13001);
} }
} }
...@@ -98,11 +105,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -98,11 +105,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO) { public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO) {
if (insertHistoryNewDTO.getPlayLength() > 3) { if (insertHistoryNewDTO.getPlayLength() > 3) {
//对比redis上的token
String token = redisUtil.get("mobile_" + insertHistoryNewDTO.getMemberId()).toString();
if (!insertHistoryNewDTO.getToken().equals(token)) {
throw new HttpException(1010);
}
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO(); VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
BeanUtils.copyProperties(insertHistoryNewDTO, vodPlayHistoryDO); BeanUtils.copyProperties(insertHistoryNewDTO, vodPlayHistoryDO);
...@@ -117,11 +119,18 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -117,11 +119,18 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//查看当天这个人看了多少时间 //查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId()); Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
if (total == classHourDictDO.getClassHour() * 3600){
throw new HttpException(13001);
}
//是否超过时长 没超过 false 超过 true //是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) { if (total + vodPlayHistoryDO.getPlayLength() > classHourDictDO.getClassHour() * 3600) {
int playLength = classHourDictDO.getClassHour() * 3600 - total; int playLength = classHourDictDO.getClassHour() * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength); vodPlayHistoryDO.setPlayLength(playLength);
this.baseMapper.insert(vodPlayHistoryDO); vodPlayHistoryDO.setPlayCount(1);
if (playLength >3){
this.baseMapper.insert(vodPlayHistoryDO);
}
throw new HttpException(13001); throw new HttpException(13001);
} }
} }
...@@ -624,7 +633,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -624,7 +633,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public List<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO) { public List<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO) {
String classIds = "254"; String classIds = "261";
// String classIds = "122,150"; // String classIds = "122,150";
List<String> classIdArr = Arrays.asList(classIds.split(",")); List<String> classIdArr = Arrays.asList(classIds.split(","));
...@@ -652,7 +661,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -652,7 +661,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// LocalDateTime dateTmp = vph1.getCreateDate().minusSeconds(-vph2.getPlayLength() - getRandom1_2()); // LocalDateTime dateTmp = vph1.getCreateDate().minusSeconds(-vph2.getPlayLength() - getRandom1_2());
// vph2.setCreateDate(dateTmp); // vph2.setCreateDate(dateTmp);
// this.baseMapper.updateById(vph2); // this.baseMapper.updateById(vph2);
// result.add(vodPlayStateVO.getId()); result.add(vodPlayStateVO.getId());
// } // }
} }
} }
......
# 环境配置 # 环境配置
spring.profiles.active=prod spring.profiles.active=dev
#和CPU数 #和CPU数
spring.server.acceptorThreadCount=600 spring.server.acceptorThreadCount=600
spring.server.minSpareThreads=100 spring.server.minSpareThreads=100
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!