三七 преди 3 дни
родител
ревизия
6c33f02d31
променени са 1 файла, в които са добавени 31 реда и са изтрити 0 реда
  1. 31 0
      fs-qw-task/src/main/java/com/fs/app/controller/CommonController.java

+ 31 - 0
fs-qw-task/src/main/java/com/fs/app/controller/CommonController.java

@@ -13,6 +13,7 @@ import com.fs.course.mapper.FsCourseRedPacketLogMapper;
 import com.fs.course.mapper.FsCourseWatchLogMapper;
 import com.fs.course.param.newfs.FsUserCourseAddCompanyUserParam;
 import com.fs.course.service.*;
+import com.fs.course.vo.FsUserCourseVideoQVO;
 import com.fs.his.domain.FsUser;
 import com.fs.his.service.IFsInquiryOrderService;
 import com.fs.his.utils.qrcode.QRCodeUtils;
@@ -122,6 +123,36 @@ public class CommonController {
 
     @Autowired
     private SyncQwExternalContactService syncQwExternalContactService;
+    @Autowired
+    private IFsUserCourseVideoService fsUserCourseVideoService;
+
+    @Autowired
+    public RedisCache redisCache;
+
+    /**
+     * 获取跳转微信小程序的链接地址
+     */
+    @GetMapping("/getVideoDuration")
+    @ApiOperation("获取跳转微信小程序的链接地址")
+    public Long getVideoDuration(Long videoId) {
+
+            String redisKey = "h5user:video:duration:" + videoId;
+            Long duration = redisCache.getCacheObject(redisKey);
+
+            if (duration == null) {
+                FsUserCourseVideoQVO videoInfo = fsUserCourseVideoService.selectFsUserCourseVideoByVideoIdVO(videoId,null);
+                if (videoInfo == null || videoInfo.getDuration() == null) {
+                    throw new IllegalArgumentException("视频时长信息不存在");
+                }
+                duration = videoInfo.getDuration();
+
+                // 将查询结果缓存到Redis,设置适当过期时间
+                redisCache.setCacheObject(redisKey, duration);
+            }
+
+            return duration;
+
+    }