派生自 projectDept/qhighschool

yn147
2023-05-10 96286178ee1c257c130cb2ad964a781f36c4eee5
src/main/java/com/qxueyou/scc/stucontroller/StuLiveController.java
@@ -1,11 +1,10 @@
package com.qxueyou.scc.stucontroller;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.qxueyou.scc.sdk.MTCloud;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -115,22 +114,27 @@
   
   /**
    * 查看直播明细
    * @param liveId 直播id
    * @param couresId 直播id
    * @return
    */
   @GetMapping(value = "view")
   public Result view(String liveId) {
      MediaVideoLive live = liveService.read(liveId);
      return new Result(true, "success", CollectionUtils.newObjectMap(
            "startTime",live.getStartTime(),
            "endTime",live.getEndTime(),
            "name",live.getName(),
            "hlsPullUrl",live.getHlsPullUrl(),
            "imgPath",live.getPreviewImgUrl(),
            "chatroomId",dao.getChatRoomId(liveId),
            "remark",live.getRemark()
            ));
   public Result view(String couresId) throws Exception {
      MTCloud client = new MTCloud();
      HashMap<Object,Object> options = new HashMap<Object, Object>();
      String res = client.courseAccess(couresId, ClientUtils.getUserId(), ClientUtils.getUserName(), MTCloud.ROLE_USER, 10000, options);
      JSONObject jsonObject = JSON.parseObject(res);
      JSONObject data = jsonObject.getJSONObject("data");
      String liveUrl = (String) data.get("liveUrl");
      System.out.println(liveUrl);
      return new Result(true, "success",liveUrl);
   }
}