Browse Source

新增异常补偿服务

master
胡超1 1 year ago
parent
commit
481093d225
  1. 22
      CPF_Cef/Common/WebSocketClientWithHeartbeat.cs
  2. 6
      CPF_Cef/MainModel.cs

22
CPF_Cef/Common/WebSocketClientWithHeartbeat.cs

@ -66,7 +66,27 @@ namespace AksWebBrowser.Common
{ {
JObject jo = (JObject)JsonConvert.DeserializeObject(body); JObject jo = (JObject)JsonConvert.DeserializeObject(body);
string functionName = jo["functionName"].ToString(); string functionName = jo["functionName"].ToString();
if (functionName == "LiveDetectResult") if (functionName == "CF_OpenCamera")
{
string status = jo["success"].ToString();
if (status == "0")
{
//开始活检
Send("{\"function\":\"CF_StartLiveDetect\"}", "CF_StartLiveDetect");
}
else
{
timer.Stop();
// 断开连接
_webSocket.Dispose();
isstop = false;
string commod = "cd /opt/lhtserver/files/bin && nohup ./LhtCamServer.sh &";
MainModel.Bash(commod);
Task.Delay(1000).Wait();
MainModel.StartFace();
}
}
else if (functionName == "LiveDetectResult")
{ {
Log.Error("LiveDetectResult" + "活检准备"); Log.Error("LiveDetectResult" + "活检准备");
string status = string.Empty; string status = string.Empty;

6
CPF_Cef/MainModel.cs

@ -1780,7 +1780,7 @@ namespace AksWebBrowser
/// </summary> /// </summary>
private static string smresults = string.Empty; private static string smresults = string.Empty;
private static AutoResetEvent @event9 = new AutoResetEvent(false); private static AutoResetEvent @event9 = new AutoResetEvent(false);
private static void StartFace() public static void StartFace()
{ {
try try
{ {
@ -1796,8 +1796,6 @@ namespace AksWebBrowser
}; };
//打开摄像头 //打开摄像头
webSocket.Send(JsonConvert.SerializeObject(mode), "CF_OpenCamera"); webSocket.Send(JsonConvert.SerializeObject(mode), "CF_OpenCamera");
//开始活检
webSocket.Send("{\"function\":\"CF_StartLiveDetect\"}", "CF_StartLiveDetect");
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -2245,7 +2243,7 @@ namespace AksWebBrowser
string zxjg = Bash(commod); string zxjg = Bash(commod);
if (string.IsNullOrEmpty(zxjg)) if (string.IsNullOrEmpty(zxjg))
{ {
commod = "chmod -R 777 /opt/lhtserver/files/bin && cd /opt/lhtserver/files/bin && nohup ./LhtCamServer.sh &"; commod = "cd /opt/lhtserver/files/bin && nohup ./LhtCamServer.sh &";
Bash(commod); Bash(commod);
Task.Delay(3000).Wait(); Task.Delay(3000).Wait();
} }

Loading…
Cancel
Save