From 58a1078809f129905ae30e676c8705e2a083e2ec Mon Sep 17 00:00:00 2001
From: EricsHu <hrr145632>
Date: 星期三, 24 五月 2023 16:45:38 +0800
Subject: [PATCH] 111

---
 src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaLiveService.java |    5 +++--
 src/main/java/com/qxueyou/scc/controller/VideoLiveController.java           |    2 +-
 src/main/java/com/qxueyou/scc/stucontroller/StuLiveController.java          |   36 +++++++++++++++++++++++++++++-------
 src/main/resources/hanlp.properties                                         |    2 +-
 4 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/qxueyou/scc/controller/VideoLiveController.java b/src/main/java/com/qxueyou/scc/controller/VideoLiveController.java
index df70969..34870b1 100644
--- a/src/main/java/com/qxueyou/scc/controller/VideoLiveController.java
+++ b/src/main/java/com/qxueyou/scc/controller/VideoLiveController.java
@@ -183,7 +183,7 @@
 		MTCloud client = new MTCloud();
 		HashMap<Object,Object> options = new HashMap<Object, Object>();
 		options.put("ssl", false);
-		String res = client.courseVisitorList("3360573",10,1,options);
+		String res = client.courseVisitorList(courseId,page,size,options);
 		return new Result(true,"寮�鍚垚鍔�",res);
 	}
 	/**
diff --git a/src/main/java/com/qxueyou/scc/stucontroller/StuLiveController.java b/src/main/java/com/qxueyou/scc/stucontroller/StuLiveController.java
index 7f889bc..ffe8660 100644
--- a/src/main/java/com/qxueyou/scc/stucontroller/StuLiveController.java
+++ b/src/main/java/com/qxueyou/scc/stucontroller/StuLiveController.java
@@ -118,23 +118,45 @@
 	 * @return
 	 */
 	@GetMapping(value = "view")
-	public Result view(String couresId) throws Exception {
+	public Result view(String couresId,String userId,String userName) throws Exception {
 
 
 		MTCloud client = new MTCloud();
 
 		HashMap<Object,Object> options = new HashMap<Object, Object>();
+		if(userId.equals("")){
+			userId= randomId();
+		}
 
-		String res = client.courseAccess(couresId, ClientUtils.getUserId(), ClientUtils.getUserName(), MTCloud.ROLE_USER, 10000, options);
-
+		String res = client.courseAccess(couresId,userId,userName, MTCloud.ROLE_USER, 10000, options);
 		JSONObject jsonObject = JSON.parseObject(res);
 
-		JSONObject data = jsonObject.getJSONObject("data");
 
-		String liveUrl = (String) data.get("liveUrl");
+		if(jsonObject.getString("code").equals("0")){
+			JSONObject data = jsonObject.getJSONObject("data");
 
-		System.out.println(liveUrl);
+			String liveUrl = (String) data.get("liveUrl");
 
-		return new Result(true, "success",liveUrl);
+			return new Result(true, "success",liveUrl);
+		}
+
+		return new Result(false, jsonObject.getString("msg"));
 	}
+
+	public  String randomId() {
+			Random random=new Random();
+			String str="";
+			for (int i = 0; i <12; i++) {
+				if(i==0){
+					//棣栦綅涓嶈兘涓�0涓旀暟瀛楀彇鍊煎尯闂翠负 [1,9]
+					str+=(random.nextInt(9)+1);
+				}else{
+					//鍏朵綑浣嶇殑鏁板瓧鐨勫彇鍊煎尯闂翠负 [0,9]
+					str+=random.nextInt(10);
+				}
+			}
+			return str;
+		}
+
+
 }
diff --git a/src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaLiveService.java b/src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaLiveService.java
index 51f54e8..84234c9 100644
--- a/src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaLiveService.java
+++ b/src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaLiveService.java
@@ -336,9 +336,10 @@
 	@Override
 	public List<MediaVideoLive> listOfMine(String keyword, Integer pageNum, Integer pageSize) {
 		
-		String hql = "from MediaVideoLive where deleteFlag is false and name like ? and createId=?  order by createTime desc";
+		String hql = "from MediaVideoLive where deleteFlag is false and name like ?  order by createTime desc";
 
-		return findList(hql, new Pager(pageSize, pageNum), CollectionUtils.newList(keyword + "%",ClientUtils.getUserId()), MediaVideoLive.class);
+
+		return findList(hql, new Pager(pageSize, pageNum), CollectionUtils.newList(keyword + "%"), MediaVideoLive.class);
 	}
 	
 	@Override
diff --git a/src/main/resources/hanlp.properties b/src/main/resources/hanlp.properties
index 3f04fd9..c462198 100644
--- a/src/main/resources/hanlp.properties
+++ b/src/main/resources/hanlp.properties
@@ -1,7 +1,7 @@
 #鏈厤缃枃浠朵腑鐨勮矾寰勭殑鏍圭洰褰曪紝鏍圭洰褰�+鍏朵粬璺緞=缁濆璺緞
 #Windows鐢ㄦ埛璇锋敞鎰忥紝璺緞鍒嗛殧绗︾粺涓�浣跨敤/
 #root=D:/JavaProjects/HanLP/
-root=E:/hanlpData
+root=C:/higschool/qhigschool/HanLP-1.6.0
 #鏍稿績璇嶅吀璺緞
 CoreDictionaryPath=data/dictionary/CoreNatureDictionary.txt
 #2鍏冭娉曡瘝鍏歌矾寰�

--
Gitblit v1.8.0