Browse Source

Merge branch 'saas_hgw_mobile_live' into master_saas

hgw 3 years ago
parent
commit
aff28031c0

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ImLiveBroadcastRoom.java

@@ -78,6 +78,10 @@ public class ImLiveBroadcastRoom implements Serializable {
     @ApiModelProperty(value = "直播间可见类型-全部可见 ALL / 部分可见 PRIVATE")
     private String popularizeType;
 
+    @TableField("os")
+    @ApiModelProperty(value = "播出端-  pc网页端 移动端mobile")
+    private String os = "pc";
+
     @TableField("created_by_")
     @ApiModelProperty(value = "创建人")
     private Integer createdBy;
@@ -218,6 +222,14 @@ public class ImLiveBroadcastRoom implements Serializable {
         this.popularize = popularize;
     }
 
+    public String getOs() {
+        return os;
+    }
+
+    public void setOs(String os) {
+        this.os = os;
+    }
+
     public Integer getCreatedBy() {
         return createdBy;
     }

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/ImLiveBroadcastRoomService.java

@@ -27,7 +27,7 @@ public interface ImLiveBroadcastRoomService extends IService<ImLiveBroadcastRoom
 
     PageInfo<ImLiveBroadcastRoomVo> queryPage(Map<String, Object> param);
 
-    ImLiveBroadcastRoomVo queryRoomAndCheck(String roomUid, Integer userId,Integer osType);
+    ImLiveBroadcastRoomVo queryRoomAndCheck(String roomUid, Integer userId, Integer osType);
 
     ImLiveBroadcastRoomVo queryRoomInfo(String roomUid);
 
@@ -60,7 +60,7 @@ public interface ImLiveBroadcastRoomService extends IService<ImLiveBroadcastRoom
 
     void opsRoom(List<ImUserState> userState);
 
-    ImLiveBroadcastRoomVo speakerJoinRoom(String roomUid);
+    ImLiveBroadcastRoomVo speakerJoinRoom(String roomUid, String os);
 
     void joinRoom(String roomUid, Integer userId);
 

+ 7 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImLiveBroadcastRoomServiceImpl.java

@@ -139,7 +139,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
     public ImLiveBroadcastRoomVo queryRoomAndCheck(String roomUid, SysUser sysUser, Integer osType) {
         Optional<ImLiveBroadcastRoomVo> optional;
         //如果是学生端,则需要检查是否有权限进入
-        if (osType == 1) {
+        if (Objects.equals(osType, 1)) {
             Map<String, Object> param = new HashMap<>();
             param.put("roomUid", roomUid);
             optional = Optional.of(param).map(this::getImLiveBroadcastRoomVo);
@@ -794,9 +794,13 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
      *
      * @param roomUid
      */
-    public ImLiveBroadcastRoomVo speakerJoinRoom(String roomUid) {
+    public ImLiveBroadcastRoomVo speakerJoinRoom(String roomUid, String os) {
         SysUser sysUser = getSysUser();
-        ImLiveBroadcastRoomVo roomVo = queryRoomAndCheck(roomUid, sysUser, 0);
+        ImLiveBroadcastRoomVo roomVo = queryRoomAndCheck(roomUid, sysUser, null);
+        if (!os.equals(roomVo.getOs())) {
+            String ex = roomVo.getOs().equals("pc") ? "电脑": "手机";
+            throw new BizException("该直播间仅可在"+ex+"端直播");
+        }
         Integer userId = sysUser.getId();
         if (!userId.equals(roomVo.getSpeakerId())) {
             throw new BizException("您不是该直播间的主讲人");

+ 1 - 0
mec-biz/src/main/resources/config/mybatis/ImLiveBroadcastRoomMapper.xml

@@ -41,6 +41,7 @@
         a.tenant_id_ AS tenantId,
         t.name_ AS tenantName,
         t.logo_ AS tenantLogo,
+        t.os_ AS os,
         a.room_uid_ AS roomUid,
         a.room_title_ AS roomTitle,
         a.live_remark_ AS liveRemark,

+ 1 - 0
mec-biz/src/main/resources/config/mybatis/ImLiveRoomReservationMapper.xml

@@ -28,6 +28,7 @@
         a.tenant_id_ AS tenantId,
         t.name_ AS tenantName,
         t.logo_ AS tenantLogo,
+        t.os_ AS os,
         a.room_uid_ AS roomUid,
         a.room_title_ AS roomTitle,
         a.live_remark_ AS liveRemark,

+ 0 - 30
mec-student/src/main/java/com/ym/mec/student/controller/ImLiveBroadcastRoomController.java

@@ -48,26 +48,12 @@ public class ImLiveBroadcastRoomController extends BaseController {
         return succeed(imLiveBroadcastRoomService.queryRoomAndCheck(roomUid, userId, 1));
     }
 
-    @ApiOperation("同步点赞数量")
-    @GetMapping("/syncLike")
-    public HttpResponseResult<Object> syncLike(@ApiParam(value = "房间uid", required = true) String roomUid,
-                                               @ApiParam(value = "点赞数", required = true) Integer likeNum) {
-        imLiveBroadcastRoomService.syncLike(roomUid, likeNum);
-        return succeed();
-    }
-
     @PostMapping("/quitRoom")
     public HttpResponseResult<Object> quitRoom(@RequestBody List<ImUserState> userState) {
         imLiveBroadcastRoomService.opsRoom(userState);
         return succeed();
     }
 
-    @ApiOperation("主讲人进入房间")
-    @GetMapping("/speakerJoinRoom")
-    public HttpResponseResult<ImLiveBroadcastRoomVo> speakerJoinRoom(String roomUid) {
-        return succeed(imLiveBroadcastRoomService.speakerJoinRoom(roomUid));
-    }
-
     @ApiOperation("学生-进入房间")
     @GetMapping("/joinRoom")
     public HttpResponseResult<Object> joinRoom(String roomUid, Integer userId) {
@@ -75,21 +61,5 @@ public class ImLiveBroadcastRoomController extends BaseController {
         return succeed();
     }
 
-    @ApiOperation("开启/关闭直播的录像")
-    @GetMapping("/opsLiveVideo")
-    public HttpResponseResult<Object> opsLiveVideo(@ApiParam(value = "房间uid", required = true) String roomUid,
-                                                   @ApiParam(value = "用户id", required = true) Integer userId,
-                                                   @ApiParam(value = "type 1:开始直播-开始录像     2:关闭直播关闭录像", required = true) Integer type) {
-        if (type == 1) {
-            imLiveBroadcastRoomService.startLive(roomUid, userId);
-        } else if (type == 2) {
-            imLiveBroadcastRoomService.closeLive(roomUid, userId);
-        } else {
-            failed("type参数错误");
-        }
-        return succeed();
-    }
-
-
 }
 

+ 1 - 1
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherImLiveBroadcastRoomController.java

@@ -96,7 +96,7 @@ public class TeacherImLiveBroadcastRoomController extends BaseController {
     @ApiOperation("主讲人进入房间")
     @GetMapping("/speakerJoinRoom")
     public HttpResponseResult<ImLiveBroadcastRoomVo> speakerJoinRoom(String roomUid) {
-        return succeed(imLiveBroadcastRoomService.speakerJoinRoom(roomUid));
+        return succeed(imLiveBroadcastRoomService.speakerJoinRoom(roomUid,"mobile"));
     }
 
     @GetMapping("/test")

+ 32 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherImLiveRoomVideoController.java

@@ -0,0 +1,32 @@
+package com.ym.mec.teacher.controller;
+
+import com.ym.mec.biz.dal.entity.ImLiveRoomVideo;
+import com.ym.mec.biz.service.ImLiveRoomVideoService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Api(tags = "直播回放录像记录表")
+@RestController
+@RequestMapping("/imLiveRoomVideo")
+public class TeacherImLiveRoomVideoController extends BaseController {
+
+    /**
+     * 服务对象
+     */
+    @Resource
+    private ImLiveRoomVideoService imLiveRoomVideoService;
+
+    @ApiOperation("查询该机构目前推广的直播间")
+    @GetMapping(value = "/queryList")
+    public HttpResponseResult<List<ImLiveRoomVideo>> queryList(String roomUid) {
+        return succeed(imLiveRoomVideoService.queryList(roomUid));
+    }
+}

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/ImLiveBroadcastRoomController.java

@@ -174,7 +174,7 @@ public class ImLiveBroadcastRoomController extends BaseController {
     @ApiOperation("主讲人进入房间")
     @GetMapping("/speakerJoinRoom")
     public HttpResponseResult<ImLiveBroadcastRoomVo> speakerJoinRoom(String roomUid) {
-        return succeed(imLiveBroadcastRoomService.speakerJoinRoom(roomUid));
+        return succeed(imLiveBroadcastRoomService.speakerJoinRoom(roomUid, "pc"));
     }
 
     @ApiOperation("学生-进入房间")