Browse Source

更新

master
胡超1 1 year ago
parent
commit
a33016b52d
  1. 4
      CPF_Cef/Common/ChunkedUpload.cs
  2. 25
      CPF_Cef/MainModel.cs
  3. 2
      CPF_Cef/Parame.cs

4
CPF_Cef/Common/ChunkedUpload.cs

@ -190,7 +190,7 @@ namespace AksWebBrowser.Common
} }
else if (jo2["code"].ToString() == "2") else if (jo2["code"].ToString() == "2")
{ {
return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "用户取消签字" + "\"}"; return "{\"timestamp\":\"" + "" + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "取消签字" + "\"}";
} }
else else
{ {
@ -206,7 +206,7 @@ namespace AksWebBrowser.Common
} }
else if (jo2["code"].ToString() == "2") else if (jo2["code"].ToString() == "2")
{ {
return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "用户取消签字" + "\"}"; return "{\"timestamp\":\"" + "" + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "取消签字" + "\"}";
} }
else else
{ {

25
CPF_Cef/MainModel.cs

@ -14,6 +14,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Net.WebSockets;
using System.Reflection.Metadata; using System.Reflection.Metadata;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -25,24 +26,26 @@ namespace AKS.EnterpriseLibrary.WebBrowser
{ {
public class MainModel : CPF.CpfObject public class MainModel : CPF.CpfObject
{ {
private static List<IWebSocketConnection> allSockets;
//初始化网络连接 //初始化网络连接
public static void DeviceControllerInit() public static void DeviceControllerInit()
{ {
try try
{ {
List<string> lit = new List<string>(); allSockets = new List<IWebSocketConnection>();
var server = new WebSocketServer("ws://0.0.0.0:19983"); var server = new WebSocketServer("ws://0.0.0.0:19983");
server.Start(socket => server.Start(socket =>
{ {
Parame.socket = socket; Parame.socket = socket;
socket.OnOpen = () => socket.OnOpen = () =>
{ {
allSockets.Add(socket);
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接成功\"}"; string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接成功\"}";
socket.Send(result); socket.Send(result);
}; };
socket.OnClose = () => socket.OnClose = () =>
{ {
allSockets.Remove(socket);
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接关闭\"}"; string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接关闭\"}";
socket.Send(result); socket.Send(result);
}; };
@ -67,7 +70,8 @@ namespace AKS.EnterpriseLibrary.WebBrowser
if (json != null) if (json != null)
{ {
//释放所有硬件 //释放所有硬件
Task.Run(() => { Task.Run(() =>
{
HttpResponseClose(); HttpResponseClose();
}); });
@event8.WaitOne(); @event8.WaitOne();
@ -170,10 +174,6 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
try try
{ {
//Log.Info("答复请求者:" + result);
//答复请求者(处理完请求后在些答复)
//byte[] bytes = SerializeContent(result);
socket.Send(result); socket.Send(result);
} }
catch { result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"400\",\"status\":true,\"data\":\"返回参数失败\"}"; } catch { result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"400\",\"status\":true,\"data\":\"返回参数失败\"}"; }
@ -594,7 +594,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
else else
{ {
Task.Run(() => {HttpPostResponseBySign("open", 1, param.code, param.timeout); }); Task.Run(() => { HttpPostResponseBySign("open", 1, param.code, param.timeout); });
@event3.WaitOne(); @event3.WaitOne();
string result = sginStr; string result = sginStr;
SubmitLogs(result, "OpenSign"); SubmitLogs(result, "OpenSign");
@ -686,7 +686,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
} }
else else
{ {
Task.Run(() => {HttpPostResponseByFinger("open", 1, param.timeout); }); Task.Run(() => { HttpPostResponseByFinger("open", 1, param.timeout); });
event2.WaitOne(); event2.WaitOne();
string result = string.Empty; string result = string.Empty;
if (string.IsNullOrEmpty(fingerStr)) if (string.IsNullOrEmpty(fingerStr))
@ -1464,7 +1464,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
{ {
var httpClient = new HttpClient(); var httpClient = new HttpClient();
var uploader = new ChunkedUpload(httpClient); var uploader = new ChunkedUpload(httpClient);
await uploader.PublicSign("close", 2,0); await uploader.PublicSign("close", 2, 0);
await uploader.PublicFinger("close", 2, 0); await uploader.PublicFinger("close", 2, 0);
await uploader.PublicIdcard("close", 2, 0); await uploader.PublicIdcard("close", 2, 0);
@event8.Set(); @event8.Set();
@ -1474,7 +1474,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
//Log.Error("高拍仪异常:" + ex.Message); //Log.Error("高拍仪异常:" + ex.Message);
} }
} }
/// <summary> /// <summary>
/// 初始文件上传 /// 初始文件上传
/// </summary> /// </summary>
@ -1876,7 +1876,8 @@ namespace AKS.EnterpriseLibrary.WebBrowser
return ""; return "";
} }
public static string StartShll() { public static string StartShll()
{
string commod = "lsof -i:9039"; string commod = "lsof -i:9039";
return ""; return "";
} }

2
CPF_Cef/Parame.cs

@ -30,7 +30,7 @@ namespace AksWebBrowser
//高拍仪devIndex //高拍仪devIndex
public static string gpydevIndex = "0"; public static string gpydevIndex = "0";
//签字版、指纹、身份证 //签字版、指纹、身份证
public static string signUrl = "http://127.0.0.1:9399/device"; public static string signUrl = "http://192.168.0.234:9399/device";
public static int timeout = 3000; public static int timeout = 3000;
//票据打印机 //票据打印机
public static string pritPj = "/dev/ttyS7"; public static string pritPj = "/dev/ttyS7";

Loading…
Cancel
Save