liujunchi пре 2 година
родитељ
комит
a517bb6ff5

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

@@ -12,6 +12,7 @@ import com.microsvc.toolkit.middleware.live.LivePluginContext;
 import com.microsvc.toolkit.middleware.live.LivePluginService;
 import com.microsvc.toolkit.middleware.live.message.LiveRoomMessage;
 import com.microsvc.toolkit.middleware.live.message.LiveRoomUser;
+import com.microsvc.toolkit.middleware.live.message.RTCRequest;
 import com.microsvc.toolkit.middleware.live.message.RTCRoom;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
@@ -995,8 +996,12 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
                     return;
                 }
 
-                pluginService.rtcRoomRecordStop(rtcRoom.getSessionId());
-                // pluginService.rtcRoomRecordStart(roomUid, videoResolution);
+                pluginService.rtcRoomRecordStart(RTCRequest.RecordStart.builder()
+                        .sessionId(rtcRoom.getSessionId())
+                         .config(RTCRequest.RecordConfig.builder()
+                                .videoResolution(videoResolution)
+                                .build())
+                        .build());
             } catch (Exception e) {
                 log.error("startRecord error: {}", e.getMessage());
             }

+ 26 - 0
mec-im/src/main/java/com/ym/common/ETencentImCallbackCommand.java

@@ -0,0 +1,26 @@
+package com.ym.common;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2023-03-02
+ */
+public enum ETencentImCallbackCommand {
+
+    STATE_STATECHANGE("State.StateChange", "用户状态变更"),
+
+    ;
+
+    private String command;
+    private String desc;
+
+    private final String code;
+
+    ETencentImCallbackCommand(String command, String desc) {
+        this.command = command;
+        this.desc = desc;
+
+        this.code = this.name();
+    }
+}

+ 1 - 1
mec-im/src/main/java/com/ym/config/ResourceServerConfig.java

@@ -16,7 +16,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
                         "/group/dismiss", "/room/statusImMsg", "/history/get", "/user/statusImUser", "/liveRoom/recordSync",
                         "/liveRoom/publishRoomMsg", "/liveRoom/destroy", "/liveRoom/create", "/liveRoom/startRecord",
                         "/liveRoom/stopRecord", "/liveRoom/userExistInRoom","/liveRoom/checkOnline",
-                        "/liveRoom/addUserUnableSpeak","/liveRoom/removeUserUnableSpeak","/liveRoom/syncChatRoomStatus")
+                        "/liveRoom/addUserUnableSpeak","/liveRoom/removeUserUnableSpeak","/liveRoom/syncChatRoomStatus","/liveRoom/tencentImCallback")
                 .permitAll().anyRequest().authenticated().and().csrf().disable();
     }
 }

+ 14 - 0
mec-im/src/main/java/com/ym/controller/LiveRoomController.java

@@ -1,9 +1,11 @@
 package com.ym.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.common.entity.ImRoomMessage;
 import com.ym.pojo.IMApiResultInfo;
 import com.ym.pojo.RecordNotify;
+import com.ym.pojo.TencentImCallbackResult;
 import com.ym.service.LiveRoomService;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -13,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  * @author hgw
  * Created by 2022-02-21
@@ -96,4 +100,14 @@ public class LiveRoomController {
         log.info("syncChatRoomStatus body:{}", body);
     }
 
+
+    @ApiOperation("腾讯im 回调接口")
+    @PostMapping(value = "/tencentImCallback")
+    public TencentImCallbackResult tencentImCallback(@RequestBody String body, HttpServletRequest request) {
+        log.info("tencentImCallback body:{}", body);
+
+        log.info("tencentImCallback request param:{}", JSON.toJSONString(request.getParameterMap()));
+
+        return new TencentImCallbackResult();
+    }
 }

+ 40 - 0
mec-im/src/main/java/com/ym/pojo/TencentImCallbackResult.java

@@ -0,0 +1,40 @@
+package com.ym.pojo;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2023-03-02
+ */
+public class TencentImCallbackResult {
+
+    private String ActionStatus = "OK";
+
+    private String ErrorInfo;
+
+    private int ErrorCode = 0;
+
+    public String getActionStatus() {
+        return ActionStatus;
+    }
+
+    public void setActionStatus(String actionStatus) {
+        ActionStatus = actionStatus;
+    }
+
+    public String getErrorInfo() {
+        return ErrorInfo;
+    }
+
+    public void setErrorInfo(String errorInfo) {
+        ErrorInfo = errorInfo;
+    }
+
+    public int getErrorCode() {
+        return ErrorCode;
+    }
+
+    public void setErrorCode(int errorCode) {
+        ErrorCode = errorCode;
+    }
+}