|
@@ -2,6 +2,9 @@ package com.ym.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.microsvc.toolkit.middleware.live.LivePluginContext;
|
|
|
+import com.microsvc.toolkit.middleware.live.LivePluginService;
|
|
|
+import com.microsvc.toolkit.middleware.live.impl.TencentCloudLivePlugin;
|
|
|
import com.ym.common.BaseResponse;
|
|
|
import com.ym.mec.biz.dal.dto.TencentData;
|
|
|
import com.ym.mec.biz.dal.dto.TencentImCallbackResult;
|
|
@@ -31,6 +34,8 @@ public class UserController {
|
|
|
private ImLiveBroadcastRoomService imLiveBroadcastRoomService;
|
|
|
@Autowired
|
|
|
private LiveRoomService liveRoomService;
|
|
|
+ @Autowired
|
|
|
+ private LivePluginContext livePluginContext;
|
|
|
|
|
|
@RequestMapping(value = "/register", method = RequestMethod.POST)
|
|
|
public Object register(@RequestBody UserModel userModel) throws Exception {
|
|
@@ -60,9 +65,23 @@ public class UserController {
|
|
|
public TencentImCallbackResult tencentImCallback(@RequestBody String body, HttpServletRequest request) {
|
|
|
log.info("tencentImCallback body:{}", body);
|
|
|
|
|
|
- log.info("tencentImCallback request param:{}", JSON.toJSONString(request.getParameterMap()));
|
|
|
+ LivePluginService pluginService = livePluginContext.getPluginService(TencentCloudLivePlugin.PLUGIN_NAME);
|
|
|
+ String appKey = pluginService.getLiveRoomConfig().getAppKey();
|
|
|
|
|
|
- String clientIP = request.getParameter("ClientIP");
|
|
|
+ log.info("tencentImCallback request param:{}", JSON.toJSONString(request.getParameterMap()));
|
|
|
+
|
|
|
+ String sdkAppid = request.getParameter("SdkAppid");
|
|
|
+ List<String> sdkList = JSON.parseArray(sdkAppid, String.class);
|
|
|
+ if (sdkList == null || sdkList.size() == 0) {
|
|
|
+ log.error("tencentImCallback sdkAppid is null");
|
|
|
+ return new TencentImCallbackResult();
|
|
|
+ }
|
|
|
+ if (!sdkList.contains(appKey)) {
|
|
|
+ log.error("tencentImCallback sdkAppid is not match");
|
|
|
+ return new TencentImCallbackResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ String clientIP = request.getParameter("ClientIP");
|
|
|
String optPlatform = request.getParameter("OptPlatform");
|
|
|
|
|
|
|