Browse Source

admin后台上传 获取权限

yuhongqi 1 month ago
parent
commit
e1ba7de6c7

+ 9 - 0
fs-admin/src/main/java/com/fs/web/controller/common/CommonController.java

@@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse;
 
 import com.fs.common.core.domain.R;
 import com.fs.common.exception.file.OssException;
+import com.fs.common.service.ITencentCloudCosService;
 import com.fs.system.oss.CloudStorageService;
 import com.fs.system.oss.OSSFactory;
 import com.fs.web.vo.WangUploadVO;
@@ -37,6 +38,8 @@ public class CommonController
 
     @Autowired
     private ServerConfig serverConfig;
+    @Autowired
+    private ITencentCloudCosService tencentCloudCosService;
 
     /**
      * 通用下载请求
@@ -169,4 +172,10 @@ public class CommonController
         return R.ok().put("url",url);
     }
 
+    @GetMapping("/common/getTmpSecretKey")
+    public R getTmpSecretKey()
+    {
+        return tencentCloudCosService.getKeyAndCredentials();
+    }
+
 }

+ 4 - 2
fs-user-app/src/main/java/com/fs/app/websocket/service/WebSocketServer.java

@@ -127,6 +127,9 @@ public class WebSocketServer {
             sendMsgVo.setData(JSONObject.toJSONString(liveWatchUserVO));
             sendMsgVo.setNickName(fsUser.getNickname());
             sendMsgVo.setAvatar(fsUser.getAvatar());
+            // 广播连接消息
+            broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", sendMsgVo)));
+
             LiveUserFirstEntry liveUserFirstEntry = liveUserFirstEntryService.selectEntityByLiveIdUserId(liveId, userId);
             if (liveUserFirstEntry != null) {
                 // 处理第一次自己进入,第二次扫码销售进入
@@ -154,8 +157,7 @@ public class WebSocketServer {
                 liveUserFirstEntryService.insertLiveUserFirstEntry(liveUserFirstEntry);
             }
 
-            // 广播连接消息
-            broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", sendMsgVo)));
+
         } else {
             adminRoom.add(session);
         }