master
rszn 5 months ago
parent 1cbd96408f
commit 2275bad82b

@ -1,4 +1,5 @@
using HybirdFrameworkDriver.Session; using HybirdFrameworkCore.Utils;
using HybirdFrameworkDriver.Session;
using log4net; using log4net;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -29,19 +30,25 @@ public class CarController : ControllerBase{
CarInfoResp carInfoResp = new CarInfoResp() CarInfoResp carInfoResp = new CarInfoResp()
{ {
Connected = CarServerMgr.CarServer != null && ioSession != null, Connected = CarServerMgr.CarServer != null && ioSession != null,
CarNo = carNo
}; };
ioSession.BusinessMap.TryGetValue("ElecMsg", out var elecMsg); if (ObjUtils.IsNotNull(ioSession))
if (elecMsg != null)
{ {
carInfoResp.ElecMsg = (ElecMsg)elecMsg; ioSession.BusinessMap.TryGetValue("ElecMsg", out var elecMsg);
} if (elecMsg != null)
{
carInfoResp.ElecMsg = (ElecMsg)elecMsg;
}
ioSession.BusinessMap.TryGetValue("HeartBeatMsg", out var heartBeatMsg); ioSession.BusinessMap.TryGetValue("HeartBeatMsg", out var heartBeatMsg);
if (heartBeatMsg != null) if (heartBeatMsg != null)
{ {
carInfoResp.HeartBeatMsg = (HeartBeatMsg)heartBeatMsg; carInfoResp.HeartBeatMsg = (HeartBeatMsg)heartBeatMsg;
}
} }
return carInfoResp; return carInfoResp;
} }

Loading…
Cancel
Save