Browse Source

优化数据交互

master
胡超1 1 year ago
parent
commit
c2ae647150
  1. 1
      CPF_Cef/AksVideoPlayer.cs
  2. 5
      CPF_Cef/Common/ChunkedUpload.cs
  3. 9
      CPF_Cef/Common/WebSocketClientWithHeartbeat.cs

1
CPF_Cef/AksVideoPlayer.cs

@ -48,7 +48,6 @@ namespace AksWebBrowser
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized(); base.OnInitialized();
//@"http://192.168.0.34:92/CaseFile/card/2024-06-03/20240603120112952.mp4" //@"http://192.168.0.34:92/CaseFile/card/2024-06-03/20240603120112952.mp4"
vplayer.Play(new Uri(url));//播放 vplayer.Play(new Uri(url));//播放
} }

5
CPF_Cef/Common/ChunkedUpload.cs

@ -138,7 +138,7 @@ namespace AksWebBrowser.Common
{ {
//关闭签字版 //关闭签字版
await PublicSign("close", 2, timeout); await PublicSign("close", 2, timeout);
Task.Delay(500).Wait(); Task.Delay(200).Wait();
string body = await PublicSign(type, typeCode, timeout); string body = await PublicSign(type, typeCode, timeout);
if (!string.IsNullOrEmpty(body)) if (!string.IsNullOrEmpty(body))
{ {
@ -160,10 +160,9 @@ namespace AksWebBrowser.Common
} }
else if (jo2["code"].ToString() == "1") else if (jo2["code"].ToString() == "1")
{ {
Task.Delay(500).Wait();
//关闭签字版 //关闭签字版
await PublicSign("close", 2, timeout); await PublicSign("close", 2, timeout);
Task.Delay(500).Wait(); Task.Delay(200).Wait();
//打开签字版 //打开签字版
body = await PublicSign(type, typeCode, timeout); body = await PublicSign(type, typeCode, timeout);
if (!string.IsNullOrEmpty(body)) if (!string.IsNullOrEmpty(body))

9
CPF_Cef/Common/WebSocketClientWithHeartbeat.cs

@ -28,7 +28,9 @@ namespace AksWebBrowser.Common
{ {
_serverUri = Parame.smWebsocket; _serverUri = Parame.smWebsocket;
_webSocket.ConnectAsync(new Uri(_serverUri), CancellationToken.None); _webSocket.ConnectAsync(new Uri(_serverUri), CancellationToken.None);
ReceiveMessages(); SendHeartbeats(); Task.Delay(200).Wait();
ReceiveMessages();
SendHeartbeats();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -103,6 +105,8 @@ namespace AksWebBrowser.Common
timer.Stop(); timer.Stop();
results = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "aks100101" + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "人证合一验证失败." + "\"}"; results = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "aks100101" + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "人证合一验证失败." + "\"}";
Parame.socket.Send(results); Parame.socket.Send(results);
// 断开连接
_webSocket.Dispose();
} }
} }
@ -110,7 +114,6 @@ namespace AksWebBrowser.Common
} }
else if (functionName == "CF_FaceCompare") else if (functionName == "CF_FaceCompare")
{ {
//停止活检 //停止活检
Send("{\"function\":\"CF_StopLiveDetect\"}", "CF_StopLiveDetect"); Send("{\"function\":\"CF_StopLiveDetect\"}", "CF_StopLiveDetect");
//关闭摄像头 //关闭摄像头
@ -127,6 +130,8 @@ namespace AksWebBrowser.Common
} }
timer.Stop(); timer.Stop();
Parame.socket.Send(results); Parame.socket.Send(results);
// 断开连接
_webSocket.Dispose();
} }
} }
} }

Loading…
Cancel
Save