|
|
@@ -0,0 +1,41 @@
|
|
|
+package com.ruoyi.web.controller.device;
|
|
|
+
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.utils.SecurityUtils;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.device.domain.model.TsbUserDeviceBind;
|
|
|
+import com.ruoyi.device.mapper.TsbUserDeviceMapper;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 调试宝 WebSocket连接 辅助接口
|
|
|
+ * 测试是否可以连接
|
|
|
+ *
|
|
|
+ * @author lwm
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/tsb/ws")
|
|
|
+public class TsbWebSocketController extends BaseController
|
|
|
+{
|
|
|
+ @Resource
|
|
|
+ private TsbUserDeviceMapper tsbUserDeviceMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 当前登录用户的设备绑定信息(建立 WebSocket 前校验)
|
|
|
+ */
|
|
|
+ @GetMapping("/bind")
|
|
|
+ public AjaxResult bindInfo()
|
|
|
+ {
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
+ TsbUserDeviceBind bind = tsbUserDeviceMapper.selectBindByUserId(userId);
|
|
|
+ if (bind == null || bind.getDeviceSn() == null || StringUtils.isEmpty(bind.getDeviceType()))
|
|
|
+ {
|
|
|
+ return error("当前用户未绑定调试宝设备,无法建立实时连接");
|
|
|
+ }
|
|
|
+ return success(bind);
|
|
|
+ }
|
|
|
+}
|