From 96286178ee1c257c130cb2ad964a781f36c4eee5 Mon Sep 17 00:00:00 2001
From: yn147 <2270338776@qq.com>
Date: 星期三, 10 五月 2023 16:23:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/com/qxueyou/scc/controller/VideoLiveController.java |   87 +++++++++++++++++++++++++++++++++++--------
 1 files changed, 71 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/qxueyou/scc/controller/VideoLiveController.java b/src/main/java/com/qxueyou/scc/controller/VideoLiveController.java
index 3597283..f18bac9 100644
--- a/src/main/java/com/qxueyou/scc/controller/VideoLiveController.java
+++ b/src/main/java/com/qxueyou/scc/controller/VideoLiveController.java
@@ -1,10 +1,14 @@
 package com.qxueyou.scc.controller;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.hankcs.hanlp.corpus.tag.Nature;
+import com.qxueyou.scc.sdk.MTCloud;
+import io.swagger.models.auth.In;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -24,6 +28,10 @@
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import springfox.documentation.spring.web.json.Json;
+
+import static com.hankcs.hanlp.corpus.tag.Nature.r;
+import static com.hankcs.hanlp.corpus.tag.Nature.s;
 
 @Api(tags="鐩存挱绠$悊鎺ュ彛")
 @RestController
@@ -64,7 +72,7 @@
 		
 		List<MediaVideoLive> data = liveService.listOfMine(keyword, pageNum, pageSize);
 		int count = liveService.listCountOfMine(keyword);
-		
+
 		return new Result(true, "success", CollectionUtils.newObjectMap("videoLiveCount", count, 
 				"videoLiveLst",QBeanUtils.listBean2ListMap(data, CollectionUtils.newStringMap(
 						"creator","creator",
@@ -78,7 +86,8 @@
 						"status","status",
 						"pushUrl","rtmpPushUrl",
 						"hlsPullUrl","hlsPullUrl",
-						"previewImgUrl","previewImgUrl"
+						"previewImgUrl","previewImgUrl",
+						"courseId","courseId"
 						))));
 	}
 
@@ -106,14 +115,59 @@
 	@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) {
-		if(StringUtils.isEmpty(videoLiveId)) {
-			return liveService.add(name, content,teacherId,teacherName,subjectId,subjectName,definition,imgPath, new Date(startTime), new Date(endTime), isPlayBack, StringUtils.isEmpty(classIds)?null:CollectionUtils.newList(String.class,classIds.split(",")));
-		}else {
-			return liveService.update(videoLiveId,name, content,teacherId,teacherName,subjectId,subjectName,definition,imgPath, new Date(startTime), new Date(endTime), isPlayBack,  StringUtils.isEmpty(classIds)?null:CollectionUtils.newList(String.class,classIds.split(",")));
+			String subjectName,String definition,String imgPath, long startTime,long endTime, boolean isPlayBack, String classIds) throws Exception {
+		MTCloud client = new MTCloud();
+		HashMap<Object,Object> options = new HashMap<Object,Object>();
+		options.put("barrage", 1);
+		options.put("isPublic", 1);
+		options.put("robotNumber", 1);
+		options.put("robotType", 1);
+		options.put("pptDisplay", 1);
+		options.put("modetype", 6);
+		//灏唋ong绫诲瀷杞崲涓篠tring绫诲瀷
+		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
+		String startTime1 = simpleDateFormat.format(new Date(startTime));
+		String endTime1 = simpleDateFormat.format(new Date(endTime));
+		//璋冪敤绗笁鏂圭洿鎾帴鍙�
+		String s = client.courseAdd(name, ClientUtils.getUserId(), startTime1, endTime1, ClientUtils.getUserName(), "222", options);
+		//json杞崲鎷垮埌courseId
+		JSONObject jsonObject = JSON.parseObject(s);
+		JSONObject data = jsonObject.getJSONObject("data");
+		String course_id = (String) data.get("course_id");
+//		System.out.println(Integer.parseInt(course_id));
+		if(Nature.s !=null) {
+			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(",")));
+			return new Result(true, "鎴愬姛", s);
 		}
+		return new Result(false);
 	}
 
+	@ApiOperation(value = "寮�鍚洿鎾�")
+	@GetMapping(value = "OpenLive")
+	public Result OpenLive(int courseId) throws Exception {
+		MTCloud client = new MTCloud();
+
+		HashMap<Object,Object> options = new HashMap<Object, Object>();
+		options.put("ssl", false);
+
+		String res = client.courseLogin(ClientUtils.getUserId(),MTCloud.ACCOUNT_TYPE_THIRD, options);
+		System.out.println(res);
+		JSONObject jsonObject = JSON.parseObject(res);
+		JSONObject data = jsonObject.getJSONObject("data");
+		String protocol = (String) data.get("url");
+		return new Result(true,"寮�鍚垚鍔�",protocol);
+	}
+
+	@ApiOperation(value = "鍦ㄧ嚎鏃堕暱")
+	@GetMapping(value = "onlineCommunication")
+	public Result onlineCommunication(String courseId,Integer page, Integer size) throws Exception {
+		MTCloud client = new MTCloud();
+		HashMap<Object,Object> options = new HashMap<Object, Object>();
+		options.put("ssl", false);
+		String res = client.courseVisitorList("3360573",10,1,options);
+		return new Result(true,"寮�鍚垚鍔�",res);
+	}
 	/**
 	 * 鏌ヨ鐩存挱璇︽儏
 	 * 
@@ -200,13 +254,13 @@
 	/**
 	 * 鍒犻櫎/澶氫釜浠ラ�楀彿闅斿紑
 	 * 
-	 * @param videoLiveId
+	 * @param videoLiveIds
 	 * @return
 	 */
 	@ApiOperation(value = "鍒犻櫎鍒涘缓鐨勭洿鎾�")
 	@PostMapping(value = "delete")
-	public Result delete(String videoLiveIds) {
-		return liveService.delete(videoLiveIds.split(","));
+	public Result delete(String videoLiveIds,String	courseIds) throws Exception {
+		return liveService.delete(videoLiveIds.split(","),courseIds.split(","));
 	}
 	
 	
@@ -246,7 +300,7 @@
 	/**
 	 * 鐩存挱缁撴潫
 	 * 
-	 * @param videoLiveId
+	 * @param videoLiveIds
 	 *            鐩存挱id
 	 */
 	@ApiOperation(value = "鐩存挱缁撴潫")
@@ -300,7 +354,8 @@
 						"status","status",
 						"pushUrl","rtmpPushUrl",
 						"hlsPullUrl","hlsPullUrl",
-						"previewImgUrl","previewImgUrl"
+						"previewImgUrl","previewImgUrl",
+						"courseId","courseId"
 				))));
 	}
 	

--
Gitblit v1.8.0