派生自 projectDept/qhighschool

EricsHu
2023-08-04 6f6900cfbb38dbe967c71b4cdc886f5896d7269f
回掉直播状态
1个文件已修改
15 ■■■■ 已修改文件
src/main/java/com/qxueyou/scc/callback/CallbackExampleAct.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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");