ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysLiveController.java
@@ -105,6 +105,10 @@ if(Objects.nonNull(dto.getStartTime()) && Objects.nonNull(dto.getExpectedDuration())){ dto.setEndTime(dto.getStartTime().plusMinutes(dto.getExpectedDuration())); } // 点击次数默认 0,避免后续自增时 NPE if (Objects.isNull(dto.getClickCount())) { dto.setClickCount(0); } // 创建小鹅通直播 // XiaoeLiveDTO xiaoeLiveDTO = new XiaoeLiveDTO(); @@ -136,8 +140,10 @@ // if (dto.getStartTime().isBefore(LocalDateTime.now())) { // return R.fail("直播已开始,无法编辑"); // } // 计算结束时间 // 计算结束时间(视频类型没有开始时间和预计时长,必须判空,否则编辑接口会 500) if (Objects.nonNull(dto.getStartTime()) && Objects.nonNull(dto.getExpectedDuration())) { dto.setEndTime(dto.getStartTime().plusMinutes(dto.getExpectedDuration())); } // 编辑小鹅通直播 // XiaoeLiveDTO xiaoeLiveDTO = new XiaoeLiveDTO(); @@ -164,8 +170,8 @@ @GetMapping(value = "/getDetailById") public R<TSysLive> getDetailById(@RequestParam String id) { TSysLive sysLive = sysLiveService.getById(id); // 查询次数自增 使用数据库原子更新操作 sysLive.setClickCount(sysLive.getClickCount()+1); // 查询次数自增(历史数据 click_count 可能为 NULL,需判空) sysLive.setClickCount(Objects.isNull(sysLive.getClickCount()) ? 1 : sysLive.getClickCount() + 1); sysLiveService.updateById(sysLive); // 如果是诊所 Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TSysLiveController.java
@@ -74,8 +74,8 @@ @GetMapping(value = "/getDetailById") public R<TSysLive> getDetailById(@RequestParam String id) { TSysLive sysLive = sysLiveService.getById(id); // 查询次数自增 使用数据库原子更新操作 sysLive.setClickCount(sysLive.getClickCount() + 1); // 查询次数自增(历史数据 click_count 可能为 NULL,需判空) sysLive.setClickCount(Objects.isNull(sysLive.getClickCount()) ? 1 : sysLive.getClickCount() + 1); sysLiveService.updateById(sysLive); return R.ok(sysLive); } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysLiveServiceImpl.java
@@ -50,8 +50,10 @@ public R pushUser(String id, String pushType) { TSysLive sysLive = this.getById(id); if (Objects.nonNull(sysLive)){ // 判断直播开始时间是否在当前时间之后 if (sysLive.getContentType()==1 && sysLive.getStartTime().isBefore(LocalDateTime.now())){ // 判断直播开始时间是否在当前时间之后(contentType / startTime 可能为空,需判空) if (Objects.nonNull(sysLive.getContentType()) && sysLive.getContentType() == 1 && Objects.nonNull(sysLive.getStartTime()) && sysLive.getStartTime().isBefore(LocalDateTime.now())){ return R.fail("直播已开始,无法配置推送"); } sysLive.setPushType(pushType);