diff --git a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BoxWebSocketHandler.java b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BoxWebSocketHandler.java
index 5ab7add..09dc2dd 100644
--- a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BoxWebSocketHandler.java
+++ b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/BoxWebSocketHandler.java
@@ -234,10 +234,8 @@ public class BoxWebSocketHandler implements WebSocketHandler {
}).flatMap(d -> {
DeviceInfoEntity dv = (DeviceInfoEntity)d;
boxSession.setDeviceId(dv.getId());
-
+ BoxSession oldBoxSession = baseWebSocketService.putBoxSession(sn, boxSession);
return bindBox(boxSession, dv, userId, isBind).flatMap(db ->{
- BoxSession oldBoxSession = baseWebSocketService.getBoxSessionWithSn(sn);
- baseWebSocketService.putBoxSession(sn, boxSession);
if(oldBoxSession != null){
return baseWebSocketService.closeSendMsg(oldBoxSession, "您在其他地方登录", AskTypeEnum.TTS.getCode());
}
diff --git a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/CustomerWebSocketHandler.java b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/CustomerWebSocketHandler.java
index b285db9..bece4f7 100644
--- a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/CustomerWebSocketHandler.java
+++ b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/handler/CustomerWebSocketHandler.java
@@ -170,8 +170,8 @@ public class CustomerWebSocketHandler implements WebSocketHandler {
}else{
baseWebSocketService.normalSendMsg(userSession, "您暂未绑定果宝儿Box,快去绑定吧", AskTypeEnum.TTS.getCode());
}
- UserSession oldUserSession = baseWebSocketService.getUserSessionWithUserId(userId);
- baseWebSocketService.putUserSession(userId, userSession);
+ UserSession oldUserSession = baseWebSocketService.putUserSession(userId, userSession);
+
if(oldUserSession != null){
return baseWebSocketService.closeSendMsg(oldUserSession, "您在其他地方登录", AskTypeEnum.TTS.getCode());
}
diff --git a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/service/BaseWebSocketService.java b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/service/BaseWebSocketService.java
index 6caaea2..80bb995 100644
--- a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/service/BaseWebSocketService.java
+++ b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/service/BaseWebSocketService.java
@@ -238,16 +238,16 @@ public class BaseWebSocketService {
int length,
Long requestId){
if(n < length && baseSession.getRequestId().equals(requestId)){
+ int start = n;
n += ONE_MAX_TEXT;
if(n > length){
n = length;
}
- String message = text.substring(n - ONE_MAX_TEXT, n);
+ String message = text.substring(start, n);
int status = 0;
if(n == length){
message += "。";
status = 1;
- builder.setLength(0);
}
message = getSendStr(builder, message);
int m = n;
diff --git a/iot-modules/iot-box-websocket-api/src/main/resources/logback-test.xml b/iot-modules/iot-box-websocket-api/src/main/resources/logback-test.xml
index 2328326..b2d3ad4 100644
--- a/iot-modules/iot-box-websocket-api/src/main/resources/logback-test.xml
+++ b/iot-modules/iot-box-websocket-api/src/main/resources/logback-test.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/iot-modules/iot-customer-http-api/src/main/resources/logback-test.xml b/iot-modules/iot-customer-http-api/src/main/resources/logback-test.xml
index dcd924f..3111e04 100644
--- a/iot-modules/iot-customer-http-api/src/main/resources/logback-test.xml
+++ b/iot-modules/iot-customer-http-api/src/main/resources/logback-test.xml
@@ -3,7 +3,7 @@
-
+