From 6f6900cfbb38dbe967c71b4cdc886f5896d7269f Mon Sep 17 00:00:00 2001
From: EricsHu <hrr145632>
Date: 星期五, 04 八月 2023 15:46:20 +0800
Subject: [PATCH] 回掉直播状态

---
 src/main/java/com/qxueyou/scc/callback/CallbackExampleAct.java |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/qxueyou/scc/callback/CallbackExampleAct.java b/src/main/java/com/qxueyou/scc/callback/CallbackExampleAct.java
index 2e1a47c..5892da0 100644
--- a/src/main/java/com/qxueyou/scc/callback/CallbackExampleAct.java
+++ b/src/main/java/com/qxueyou/scc/callback/CallbackExampleAct.java
@@ -4,6 +4,7 @@
 import com.qxueyou.scc.base.model.Result;
 import com.qxueyou.scc.base.util.CollectionUtils;
 import com.qxueyou.scc.sdk.MTCloud;
+import com.qxueyou.scc.teach.live.model.AccessLog;
 import com.qxueyou.scc.teach.live.model.MediaVideoLive;
 import com.qxueyou.scc.teach.live.service.IMediaLiveService;
 import lombok.extern.slf4j.Slf4j;
@@ -18,6 +19,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.net.URLDecoder;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 
@@ -56,19 +58,24 @@
         //绛惧悕楠岃瘉鎴愬姛
         if(reqParams.get("cmd").equals("live.start")){//鐩存挱寮�濮�
             //璺紨鐩存挱鐘舵�佺粨鏉熶笟鍔″鐞�
-            Integer courseId =(Integer) params.get("course_id");
+            String courseId = (String) params.get("course_id");
             StringBuffer hql=new StringBuffer("from MediaVideoLive where deleteFlag is false and courseId=?");
-            List<Object> args = CollectionUtils.newList(courseId);
+            List<Object> args = CollectionUtils.newList(Integer.valueOf(courseId));
             MediaVideoLive unique = commonDAO.findUnique(hql.toString(), args, MediaVideoLive.class);
             unique.setStatus(MediaVideoLive.STATUS_LIVE_LIVE);
             commonDAO.update(unique);
         }else if(reqParams.get("cmd").equals("live.stop")){//鐩存挱缁撴潫
             //璺紨鐩存挱鐘舵�佺粨鏉熶笟鍔″鐞�
-            Integer courseId =(Integer) params.get("course_id");
+            String courseId = (String) params.get("course_id");
             StringBuffer hql=new StringBuffer("from MediaVideoLive where deleteFlag is false and courseId=?");
-            List<Object> args = CollectionUtils.newList(courseId);
+            List<Object> args = CollectionUtils.newList(Integer.valueOf(courseId));
             MediaVideoLive unique = commonDAO.findUnique(hql.toString(), args, MediaVideoLive.class);
             unique.setStatus(MediaVideoLive.STATUS_LIVE_STOP);
+            StringBuffer accessLog=new StringBuffer("from AccessLog where courseId=? and type='videoLive'");
+            List<Object> arglog = CollectionUtils.newList(courseId);
+            AccessLog unique1 = commonDAO.findUnique(accessLog.toString(), arglog, AccessLog.class);
+            unique1.setLeaveTime(new Date());
+            commonDAO.update(unique1);
             commonDAO.update(unique);
         }
         return  new Result(true,"suc");

--
Gitblit v1.8.0