更新快检功能必传mac参数
This commit is contained in:
@@ -17,6 +17,7 @@ import 'package:vbvs_app/controller/device/device_type_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/main.dart';
|
||||
import 'package:vbvs_app/model/WebSocketMessage.dart';
|
||||
import 'package:vbvs_app/pages/device/component/DeviceStatusInfoWidget.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
@@ -52,12 +53,12 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
@override
|
||||
void initState() {
|
||||
WidgetsBinding.instance.addObserver(this); // 添加生命周期观察者
|
||||
// edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
|
||||
// path: "/vsbs/web/rt/marttress",
|
||||
// type: 1,
|
||||
// data: {"mac": widget.personInfo['mac']})));
|
||||
// _startOnlineTimer(); // 初始化时启动定时器
|
||||
_initWebSocket();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> _initWebSocket() async {
|
||||
// 发送WebSocket请求
|
||||
try {
|
||||
Future.delayed(Duration(seconds: 0), () {
|
||||
CommonVariables.callMap["/vsbs/web/rt/marttress"] = (data) {
|
||||
@@ -111,12 +112,6 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
edm.EasyDartModule.logger
|
||||
.error("[webscoekt]格式化数据错误-->${{"mac": widget.personInfo['mac']}}");
|
||||
}
|
||||
_initWebSocket();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _initWebSocket() {
|
||||
// 发送WebSocket请求
|
||||
if (widget.personInfo['status'] != null) {
|
||||
try {
|
||||
onlineState =
|
||||
@@ -133,11 +128,21 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
.info("[webscoekt]发送请求:数据-->${{"mac": widget.personInfo['mac']}}");
|
||||
DailyLogUtils.writeLog(
|
||||
"[webscoekt]发送请求:数据-->${{"mac": widget.personInfo['mac']}}");
|
||||
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
|
||||
path: "/vsbs/web/rt/marttress",
|
||||
type: 1,
|
||||
data: {"mac": widget.personInfo['mac']})));
|
||||
try {
|
||||
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
|
||||
path: "/vsbs/web/rt/marttress",
|
||||
type: 1,
|
||||
data: {"mac": widget.personInfo['mac']})));
|
||||
await Future.delayed(Duration(seconds: 3));
|
||||
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
|
||||
path: "/vsbs/web/rt/marttress",
|
||||
type: 1,
|
||||
data: {"mac": widget.personInfo['mac']})));
|
||||
} catch (e) {
|
||||
ef.log("msg");
|
||||
}
|
||||
_startOnlineTimer();
|
||||
ef.log("websocket初始化成功");
|
||||
}
|
||||
//y
|
||||
|
||||
@@ -159,7 +164,7 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
_initWebSocket();
|
||||
} else if (state == AppLifecycleState.paused) {
|
||||
// 应用进入后台时关闭WebSocket
|
||||
_closeWebSocket();
|
||||
// _closeWebSocket();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,7 +664,6 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 40.rpx,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user