From 1da190e7f267bcd3501884f3aeaac7476850fec7 Mon Sep 17 00:00:00 2001 From: EricsHu <hrr145632> Date: 星期日, 26 十一月 2023 17:53:03 +0800 Subject: [PATCH] 优化菜单查询 --- src/main/java/com/qxueyou/scc/controller/VideoLiveController.java | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 42 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/qxueyou/scc/controller/VideoLiveController.java b/src/main/java/com/qxueyou/scc/controller/VideoLiveController.java index d486128..4b3ddd0 100644 --- a/src/main/java/com/qxueyou/scc/controller/VideoLiveController.java +++ b/src/main/java/com/qxueyou/scc/controller/VideoLiveController.java @@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject; import com.hankcs.hanlp.corpus.tag.Nature; import com.qxueyou.scc.base.dao.CommonDAO; +import com.qxueyou.scc.base.util.UUIDUtils; import com.qxueyou.scc.config.IpUtils; import com.qxueyou.scc.sdk.MTCloud; import com.qxueyou.scc.teach.live.model.AccessLog; @@ -70,6 +71,41 @@ @Autowired private RedisCache redisCache; + + /** + * 鑾峰彇鐩存挱鍥炴斁鍦板潃 + * + * @param videoLiveId + * 鐩存挱id锛堟洿鏂扮殑鏃跺�欐墠闇�瑕佷紶锛� + */ + @ApiOperation(value = "鑾峰彇鐩存挱鍥炴斁鍦板潃") + @GetMapping(value = "livePlaybackURL") + public Result livePlaybackURL(String videoLiveId,String nickname) throws Exception { + if (StringUtils.isEmpty(videoLiveId)) { + return new Result(false,"videoLiveId涓嶈兘涓虹┖"); + } + if (StringUtils.isEmpty(nickname)) { + return new Result(false,"nickname涓嶈兘涓虹┖"); + } + MTCloud client = new MTCloud(); + HashMap<Object,Object> options = new HashMap<Object,Object>(); + options.put("ssl", true); + //鑾峰彇鐩存挱瀵硅薄 + MediaVideoLive mediaVideoLive = liveService.read(videoLiveId); + //璋冪敤绗笁鏂圭洿鎾帴鍙� 4028815c8c0063f0018c006e083d0001 + String uuid = UUIDUtils.generateUUID(); + String courseAccess = client.courseAccessPlayback(String.valueOf(mediaVideoLive.getCourseId()),uuid,nickname,"user",3600,options); + + //json杞崲鎷垮埌courseId + JSONObject jsonObject = JSON.parseObject(courseAccess); + JSONObject data = jsonObject.getJSONObject("data"); + if(jsonObject.getString("code").equals("0")) { + String playbackUrl = (String) data.get("playbackUrl");//甯﹁亰澶╁尯鍦板潃 +// String playbackOutUrl = (String) data.get("playbackOutUrl");//绾棰戝湴鍧� + return new Result(true, "鎴愬姛", playbackUrl); + } + return new Result(false,jsonObject.getString("msg")); + } /** * 鑾峰彇鐩存挱鍒楄〃 * @@ -83,9 +119,9 @@ */ @ApiOperation(value = "鑾峰彇鍒涘缓浜虹殑鐩存挱鍒楄〃") @GetMapping(value = "list") - public Result list(String keyword, Integer pageNum, Integer pageSize) { + public Result list(String keyword,String portalStatus, Integer pageNum, Integer pageSize) { - List<MediaVideoLive> data = liveService.listOfMine(keyword, pageNum, pageSize); + List<MediaVideoLive> data = liveService.listOfMine(keyword,portalStatus, pageNum, pageSize); int count = liveService.listCountOfMine(keyword); return new Result(true, "success", CollectionUtils.newObjectMap("videoLiveCount", count, @@ -102,7 +138,8 @@ "pushUrl","rtmpPushUrl", "hlsPullUrl","hlsPullUrl", "previewImgUrl","previewImgUrl", - "courseId","courseId" + "courseId","courseId", + "portalStatus","portalStatus" )))); } @@ -138,7 +175,7 @@ @ApiOperation(value = "鍒涘缓缂栬緫鐩存挱") @PostMapping(value = "addOrUpdate") public Result addOrUpdate(String videoLiveId, String name, String content,String teacherId,String teacherName,String subjectId, - String subjectName,String definition,String imgPath, long startTime,long endTime, boolean isPlayBack, String classIds) throws Exception { + String subjectName,String definition,String imgPath, long startTime,long endTime, boolean isPlayBack, String classIds,String portalStatus) throws Exception { MTCloud client = new MTCloud(); HashMap<Object,Object> options = new HashMap<Object,Object>(); options.put("barrage", 1); @@ -159,7 +196,7 @@ JSONObject data = jsonObject.getJSONObject("data"); if(jsonObject.getString("code").equals("0")) { String course_id = (String) data.get("course_id"); - liveService.add(name, content,teacherId,teacherName,subjectId,subjectName,definition,imgPath, new Date(startTime), new Date(endTime),Integer.parseInt(course_id), isPlayBack, StringUtils.isEmpty(classIds)?null:CollectionUtils.newList(String.class,classIds.split(","))); + liveService.add(name, content,teacherId,teacherName,subjectId,subjectName,definition,imgPath, new Date(startTime), new Date(endTime),Integer.parseInt(course_id), isPlayBack, StringUtils.isEmpty(classIds)?null:CollectionUtils.newList(String.class,classIds.split(",")),portalStatus); return new Result(true, "鎴愬姛", s); } return new Result(false,jsonObject.getString("msg")); -- Gitblit v1.8.0