Commit 858a7caf by 涂亚平

20220707 备个份

1 parent e4b76240
......@@ -65,8 +65,8 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Autowired
private MemberMapper memberMapper;
@Autowired
private RedisUtil redisUtil;
// @Autowired
// private RedisUtil redisUtil;
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
......@@ -81,11 +81,18 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
if (total == classHourDictDO.getClassHour() * 3600){
throw new HttpException(13001);
}
//是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) {
if (total + vodPlayHistoryDO.getPlayLength() > classHourDictDO.getClassHour() * 3600) {
int playLength = classHourDictDO.getClassHour() * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
this.baseMapper.insert(vodPlayHistoryDO);
vodPlayHistoryDO.setPlayCount(1);
if (playLength>3){
this.baseMapper.insert(vodPlayHistoryDO);
}
throw new HttpException(13001);
}
}
......@@ -98,11 +105,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO) {
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();
BeanUtils.copyProperties(insertHistoryNewDTO, vodPlayHistoryDO);
......@@ -117,11 +119,18 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
if (total == classHourDictDO.getClassHour() * 3600){
throw new HttpException(13001);
}
//是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) {
if (total + vodPlayHistoryDO.getPlayLength() > classHourDictDO.getClassHour() * 3600) {
int playLength = classHourDictDO.getClassHour() * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
this.baseMapper.insert(vodPlayHistoryDO);
vodPlayHistoryDO.setPlayCount(1);
if (playLength >3){
this.baseMapper.insert(vodPlayHistoryDO);
}
throw new HttpException(13001);
}
}
......@@ -624,7 +633,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public List<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO) {
String classIds = "254";
String classIds = "261";
// String classIds = "122,150";
List<String> classIdArr = Arrays.asList(classIds.split(","));
......@@ -652,7 +661,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// LocalDateTime dateTmp = vph1.getCreateDate().minusSeconds(-vph2.getPlayLength() - getRandom1_2());
// vph2.setCreateDate(dateTmp);
// this.baseMapper.updateById(vph2);
// result.add(vodPlayStateVO.getId());
result.add(vodPlayStateVO.getId());
// }
}
}
......
# 环境配置
spring.profiles.active=prod
spring.profiles.active=dev
#和CPU数
spring.server.acceptorThreadCount=600
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!