diff --git a/CPF_Cef/Common/ChunkedUpload.cs b/CPF_Cef/Common/ChunkedUpload.cs index c6eb675..b29d2c5 100644 --- a/CPF_Cef/Common/ChunkedUpload.cs +++ b/CPF_Cef/Common/ChunkedUpload.cs @@ -20,6 +20,7 @@ using static System.Net.Mime.MediaTypeNames; using System.Text.RegularExpressions; using AksWebBrowser.Devices; using LibVLCSharp.Shared; +using System.Threading; namespace AksWebBrowser.Common { @@ -143,11 +144,12 @@ namespace AksWebBrowser.Common /// 获取签字版数据 /// /// - public async Task PostSign(string type, int typeCode, string code) + public async Task PostSign(string type, int typeCode, string code, int timeout) { try { var client = new HttpClient(); + client.Timeout = TimeSpan.FromSeconds(timeout); var request = new HttpRequestMessage(HttpMethod.Post, Parame.signUrl); var content = new StringContent("{\r\n \"command\": \"sign\",\r\n \"command_num\": 111,\r\n \"data\": {\r\n \"operation\": \"" + type + "\",\r\n \"operation_code\": " + typeCode + ",\r\n \"parameters\": {\r\n \"data_type\": 1\r\n }\r\n }\r\n}", null, "application/json"); request.Content = content; @@ -171,47 +173,41 @@ namespace AksWebBrowser.Common string parameters = jo3["parameters"].ToString(); JObject jo4 = (JObject)JsonConvert.DeserializeObject(parameters); string sign_pic = jo4["sign_pic"].ToString(); - - //string dirpath = Utils.getSystemPaht() + @"/wwwroot/SignFile"; - //if (!Directory.Exists(dirpath)) - //{ - // Directory.CreateDirectory(dirpath); - //} - //var tempFile = dirpath + "/sign.jpg"; - //string command = $"convert {sign_pic_path} -quality 10 {tempFile}"; - //MainModel.ShllCommad(command); - //byte[] byteArray = File.ReadAllBytes(tempFile); - //string base64String = Convert.ToBase64String(byteArray); - - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"success\",\"code\":200,\"status\":true,\"suffix\":\"png\",\"data\":\"" + sign_pic + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":200,\"status\":true,\"suffix\":\"png\",\"data\":\"" + sign_pic + "\"}"; } else { //Log.Error("请求签字失败" + jo["message"].ToString()); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字失败" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字失败" + "\"}"; } } else { - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"png\",\"data\":\"" + "关闭成功" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"png\",\"data\":\"" + "关闭成功" + "\"}"; } } else { if (type == "open" && typeCode == 1) { - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字失败" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字失败" + "\"}"; } else { - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "关闭签字失败" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "关闭签字失败" + "\"}"; } } } catch (Exception ex) { - //Log.Error("签字异常:" + ex.Message); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字异常" + "\"}"; + if (ex.Message.Contains("HttpClient.Timeout")) + { + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "在规定时间内未签字" + "\"}"; + } + else + { + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字异常" + "\"}"; + } } } @@ -263,7 +259,6 @@ namespace AksWebBrowser.Common } catch (Exception ex) { - //Log.Error("签字异常:" + ex.Message); return ""; } } @@ -272,11 +267,12 @@ namespace AksWebBrowser.Common /// 获取指纹 /// /// - public async Task PostFinger(string type, int typeCode) + public async Task PostFinger(string type, int typeCode,int timeout) { try { var client = new HttpClient(); + client.Timeout = TimeSpan.FromSeconds(timeout); var request = new HttpRequestMessage(HttpMethod.Post, Parame.signUrl); var content = new StringContent("{\r\n \"command\": \"finger\",\r\n \"command_num\": 121,\r\n \"data\": {\r\n \"operation\": \"open\",\r\n \"operation_code\": 1,\r\n \"parameters\": {\r\n }\r\n }\r\n}", null, "text/plain"); request.Content = content; @@ -324,8 +320,14 @@ namespace AksWebBrowser.Common } catch (Exception ex) { - //Log.Error("签字异常:" + ex.Message); - return ""; + if (ex.Message.Contains("HttpClient.Timeout")) + { + return "HttpClient.Timeout"; + } + else + { + return ""; + } } } @@ -333,11 +335,12 @@ namespace AksWebBrowser.Common /// 读取身份证 /// /// - public async Task OpenGetIdcard(string type, int typeCode) + public async Task OpenGetIdcard(string type, int typeCode, int timeout) { try { var client = new HttpClient(); + client.Timeout = TimeSpan.FromSeconds(timeout); var request = new HttpRequestMessage(HttpMethod.Post, Parame.signUrl); var content = new StringContent("{\r\n \"command\": \"idcard\",\r\n \"command_num\": 141,\r\n \"data\": {\r\n \"operation\": \"open\",\r\n \"operation_code\": 1,\r\n \"parameters\": {\r\n }\r\n }\r\n}", null, "text/plain"); request.Content = content; @@ -458,8 +461,14 @@ namespace AksWebBrowser.Common } catch (Exception ex) { - //Log.Error("签字异常:" + ex.Message); - return ""; + if (ex.Message.Contains("HttpClient.Timeout")) + { + return "HttpClient.Timeout"; + } + else + { + return ""; + } } } diff --git a/CPF_Cef/MainModel.cs b/CPF_Cef/MainModel.cs index a23660a..83c520c 100644 --- a/CPF_Cef/MainModel.cs +++ b/CPF_Cef/MainModel.cs @@ -13,6 +13,7 @@ using System.IO; using System.Linq; using System.Net; using System.Net.Http; +using System.Reflection.Metadata; using System.Text; using System.Text.RegularExpressions; using System.Threading; @@ -36,12 +37,12 @@ namespace AKS.EnterpriseLibrary.WebBrowser Parame.socket = socket; socket.OnOpen = () => { - 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.OnClose = () => { - 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.OnMessage = message => @@ -52,7 +53,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser { //返回内容 string result = string.Empty; - content = Base64str2(content); + //content = Base64str2(content); // Log.Info("收到请求:" + socket.ConnectionInfo.ClientIpAddress + " 请求参数:" + content); if (!string.IsNullOrEmpty(content)) { @@ -69,11 +70,9 @@ namespace AKS.EnterpriseLibrary.WebBrowser switch (keycode) { //aks100101 - //读取身份证卡号 {"code":"aks100101"} + //读取身份证卡号 {"code":"aks100101","timeout":30} case "aks100101": - result = IDCardRead(keycode); - //Log.Info("读取身份证卡号" + result); - //result = "{\"keycode\":\"aks100101\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":{\"Data\":{\"Name\":\"谢洪基\",\"Sex\":\"男\",\"Nation_Code\":null,\"Nation\":\"汉\",\"Id\":\"510125199702062315\",\"BirthDay\":\"19970206\",\"Addr\":\"成都市新都区马家镇升庵村11组\",\"Regorg\":\"成都市公安局新都分局\",\"StartDate\":\"20171027\",\"EndDate\":\"20271027\",\"Reserv\":null,\"WltFileName\":null,\"BmpFilePath\":null,\"Status\":null,\"ImageBase64\":\"data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgr/wAARCAB+AGYDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVld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AwVq8Fx+Dv2sr5ktzHbaijTWxA+9hsMfz4/CvnS0f7FIJI+CPWv13hzH081yTD4mXxTim/Vn5zm+HeDx86fRPT0P7lPCPxM+HXj5FfwR470jV98AmC6dqMczCPj5iqsSB8wHI4JAor+KXwn8W/F+h6d9k0zxZqNpHx+7tL+SIfiEYZor3fYeZ5ntDzi4u1PQ96qXNzlGG6jt+NUr+VoywU1mZP4z3n/glHaC+/wCCgvgOKQ/KdRuCffFrKR+oFf0DWNlIY0uguSor+ff/AIJUXUtt+3l8PZ4mwz64YyfZ4XQ/o1f0N6eAtoyKMBWwMV/MPjdVdPiDDP8A6dv/ANKP13ghXyqp/i/Ql0q8bQrw6tYwIpc5uot3Ep/vHvkCu78Oa/pOvlZoYjHnojJj+deftEPIFwTkg5H51YsdYvo286KUqw6EGvleH+N6+SxVGsr03r5ryXkejj6ENZHqlwljChQvWZqMllDA0glUn+6WrhbvxxrattknL+5NVDrV7qVxiWQgnPIPSvocZ4p4OM3HCpt+a0POo0Yy3NjWtQa8fETAKpwYh0Y9j9RXMeKLiaOGZ5ZCf3bd/at+C0CJveUud3U1znjVs6bevjlW2j6EGvzbPc6xWY13Wq7y19PJeR9BhKMYR0Pxm/4Lb2n2n44+HNVbqNInUE+gmyP1J/Ovi6G7FzgB+uK+7v8AgurpkGl+O/Alxb9bvw5cyScdxPivgDTZXXGD0xX9ZeG85T4Xwt/5EflnFn/Izkb0T+Uu3rRVP7XLRX6UfLH/2QA=\"}}}"; + result = IDCardRead(content); break; //aks100102 //打印排队票据 {"code":"aks100102","ph":"100101","ddrs":"中国检察","qrcode":"90087100100124433002","ywmc":"信访"} @@ -82,8 +81,8 @@ namespace AKS.EnterpriseLibrary.WebBrowser break; //aks100103 //文字语音播报 - //播放:{ "code":"aks100103","text":"你好!","ispaye":false}, - //停止播放:{ "code":"aks100104","text":"","ispaye":true} + //播放:{ "code":"aks100103","text":"你好!","ispaye":false,"ywid":"1234567890"}, + //停止播放:{ "code":"aks100104","text":"","ispaye":true,"ywid":"1234567890"} case "aks100103": result = payleText(content); //Log.Info("文字语音播报返回:" + result); @@ -139,22 +138,29 @@ namespace AKS.EnterpriseLibrary.WebBrowser case "aks100111": result = openKey(keycode); break; + //aks100114 + //文字语音播报 + //播放:{ "code":"aks100114","text":"你好!","ispaye":false,"ywid":"1234567890"}, + case "aks100114": + result = payleTextByWav(content); + //Log.Info("文字语音播报返回:" + result); + break; default: - result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; break; } } else { - result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"400\",\"status\":true,\"data\":\"参数解析错误\"}"; + 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\":\"参数解析错误\"}"; } + catch { result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"400\",\"status\":true,\"data\":\"参数解析错误\"}"; } finally { } } else { - result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; } try { @@ -164,18 +170,18 @@ namespace AKS.EnterpriseLibrary.WebBrowser //byte[] bytes = SerializeContent(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\":\"返回参数失败\"}"; } finally { } } //监听心跳并且回复客户端“已ping作为关键字” else if (content == "ping") { - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"收到客户端心跳\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"收到客户端心跳\"}"; socket.Send(result); } else { - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"收到客户端心跳\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"收到客户端心跳\"}"; socket.Send(result); } }; @@ -224,28 +230,36 @@ namespace AKS.EnterpriseLibrary.WebBrowser /// /// /// - public static string IDCardRead(string code) + public static string IDCardRead(string content) { + try { - //IDCard iDCard = new IDCard(); - //string result = iDCard.getIdCard(code); - Task.Run(() => { HttpPostResponseByIdcard("open", 1); }); + var param = content.ConvertToAnonymousType(new + { + code = default(string), + timeout = default(int) + }); + Task.Run(() => { HttpPostResponseByIdcard("open", 1, param.timeout); }); @event7.WaitOne(); string result = IdcardStr; if (string.IsNullOrEmpty(IdcardStr)) { - result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "读取身份证失败" + "\"}"; + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "读取身份证失败" + "\"}"; } else { if (IdcardStr == "500") { - result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "身份证持有者非本人" + "\"}"; + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "身份证持有者非本人" + "\"}"; + } + else if (IdcardStr.Contains("HttpClient.Timeout")) + { + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"data\":\"" + "身份证读取失败" + "\"}"; } else { - result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":" + IdcardStr + "}"; + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":" + IdcardStr + "}"; } } SubmitLogs(result, "IDCardRead"); @@ -254,7 +268,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser catch (Exception ex) { //Log.Error("读取身份证卡号异常: " + ex.Message + ""); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" +""+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "IDCardRead"); return result; } @@ -270,19 +284,19 @@ namespace AKS.EnterpriseLibrary.WebBrowser /// public static string SendByPrint(string content) { - var param = content.ConvertToAnonymousType(new - { - code = default(string), - ph = default(string), - ddrs = default(string), - qrcode = default(string), - ywmc = default(string) - }); try { + var param = content.ConvertToAnonymousType(new + { + code = default(string), + ph = default(string), + ddrs = default(string), + qrcode = default(string), + ywmc = default(string) + }); if (param == null) { - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; } string ph = param.ph; string ddrs = param.ddrs; @@ -292,7 +306,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser if (!isFuncisFuncObject("SendByPrint")) { //Utils.MessagesBox("打印排队票据设备未授权使用"); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印排队票据设备未授权使用" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印排队票据设备未授权使用" + "\"}"; } else { @@ -300,13 +314,13 @@ namespace AKS.EnterpriseLibrary.WebBrowser var data = print.SendPrint(ph, ddrs, qrcode, ywmc); if (data == 0) { - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; SubmitLogs(result, "SendByPrint"); return result; } else { - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + (data == 1 ? "打印失败" : (data == 2 ? "打印机未连接" : "打印机初始化失败")) + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + (data == 1 ? "打印失败" : (data == 2 ? "打印机未连接" : "打印机初始化失败")) + "\"}"; SubmitLogs(result, "SendByPrint"); return result; } @@ -315,21 +329,12 @@ namespace AKS.EnterpriseLibrary.WebBrowser catch (Exception ex) { //Log.Error("打印排队票据异常: " + ex.Message + ""); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" +"" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "SendByPrint"); return result; } } - /// - /// 文字语音播报(已国产化) - /// apt install sox - /// apt install libsox-fmt-all - /// - /// - /// - /// - public static string tempWav = string.Empty; /// /// aks100103文字语音播报 /// @@ -337,25 +342,26 @@ namespace AKS.EnterpriseLibrary.WebBrowser /// public static string payleText(string content) { - var param = content.ConvertToAnonymousType(new - { - code = default(string), - text = default(string), - ispaye = default(bool), - }); - try { + var param = content.ConvertToAnonymousType(new + { + code = default(string), + text = default(string), + ywid = default(string), + ispaye = default(bool), + }); if (param == null) { - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; } string text = param.text; + string ywid = param.ywid; bool ispaye = param.ispaye; if (!isFuncisFuncObject("payleText")) { //Utils.MessagesBox("文字语音播报设备未授权使用"); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "文字语音播报设备未授权使用" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "文字语音播报设备未授权使用" + "\"}"; } else { @@ -383,25 +389,46 @@ namespace AKS.EnterpriseLibrary.WebBrowser } // AutoAudio(false, ""); }); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "停止播放成功" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "停止播放成功" + "\"}"; SubmitLogs(result, "payleText"); return result; } else { - Task.Run(() => { HttpPostResponseByTTS("text_to_wav", 1, text); }); - event2.WaitOne(); + string dirpath = Utils.getSystemPaht() + @"/wwwroot/SignFile"; + if (!Directory.Exists(dirpath)) + { + Directory.CreateDirectory(dirpath); + } + var tempFile = dirpath + $"/{ywid}.wav"; string result = string.Empty; - if (string.IsNullOrEmpty(ttsStr)) + if (!File.Exists(tempFile)) { - result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "播放失败" + "\"}"; - SubmitLogs(result, "payleText"); + Task.Run(() => { HttpPostResponseByTTS("text_to_wav", 1, text); }); + event2.WaitOne(); + if (string.IsNullOrEmpty(ttsStr)) + { + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "播放失败" + "\"}"; + SubmitLogs(result, "payleText"); + } + else + { + Task.Run(() => { string command = $"sox {ttsStr} -d"; ShllCommad(command); }); + string filename = Path.GetFileName(ttsStr); + Log.Info(filename); + string source_file = dirpath + $"/{filename}"; + Log.Info(source_file); + string command = $"cp {ttsStr} -t {dirpath} && mv {source_file} {tempFile}"; + ShllCommad(command); + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "开始播放" + "\"}"; + } } else { - Task.Run(() => { string command = $"sox {ttsStr} -d"; ShllCommad(command); }); - result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "开始播放" + "\"}"; + Task.Run(() => { string command = $"sox {tempFile} -d"; ShllCommad(command); }); + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "开始播放" + "\"}"; } + SubmitLogs(result, "payleText"); return result; } @@ -410,12 +437,66 @@ namespace AKS.EnterpriseLibrary.WebBrowser catch (Exception ex) { //Log.Error("文字语音播报异常2: " + ex.Message + ""); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" +"" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "payleText"); return result; } } + /// + /// aks100103文字语音播报 + /// + /// + /// + public static string payleTextByWav(string content) + { + try + { + var param = content.ConvertToAnonymousType(new + { + code = default(string), + text = default(string), + ywid = default(string), + ispaye = default(bool), + }); + if (param == null) + { + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; + } + string text = param.text; + string ywid = param.ywid; + bool ispaye = param.ispaye; + Task.Run(() => { HttpPostResponseByTTS("text_to_wav", 1, text); }); + event2.WaitOne(); + string result = string.Empty; + if (string.IsNullOrEmpty(ttsStr)) + { + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "生成失败" + "\"}"; + } + else + { + string dirpath = Utils.getSystemPaht() + @"/wwwroot/SignFile"; + if (!Directory.Exists(dirpath)) + { + Directory.CreateDirectory(dirpath); + } + var tempFile = dirpath + $"/{ywid}.wav"; + string filename = Path.GetFileName(ttsStr); + string source_file = dirpath + $"/{filename}"; + string command = $"cp {ttsStr} -t {dirpath} && mv {source_file} {tempFile}"; + ShllCommad(command); + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "生成成功" + "\"}"; + } + return result; + } + catch (Exception ex) + { + //Log.Error("文字语音播报异常2: " + ex.Message + ""); + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + ""+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + return result; + } + } + /// /// aks100104打开高拍仪并且进行快速扫描文件 (已国产化) /// @@ -434,7 +515,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser { //关闭 //StopSn("0"); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; SubmitLogs(result, "openCamera"); return result; } @@ -442,7 +523,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser { //关闭 //StopSn("0"); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; SubmitLogs(result, "openCamera"); return result; } @@ -453,7 +534,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser string param = OpenSn("0"); if (string.IsNullOrEmpty(param)) { - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "扫描仪打开失败" + "\"}"; SubmitLogs(result, "openCamera"); return result; } @@ -467,7 +548,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser { //关闭 //StopSn("0"); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"jpg\",\"data\":\"" + "获取图片失败" + "\"}"; SubmitLogs(result, "openCamera"); return result; } @@ -475,7 +556,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser { //关闭 //StopSn("0"); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}"; SubmitLogs(result, "openCamera"); return result; } @@ -488,7 +569,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser catch (Exception ex) { //Log.Error("打开高拍仪并且进行快速扫描文件异常: " + ex.Message + ""); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "openCamera"); return result; } @@ -501,26 +582,32 @@ namespace AKS.EnterpriseLibrary.WebBrowser /// public static string OpenSign(string content) { - var param = content.ConvertToAnonymousType(new - { - code = default(string) - }); + try { + var param = content.ConvertToAnonymousType(new + { + code = default(string), + timeout = default(int) + }); if (param == null) { - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; } if (!isFuncisFuncObject("OpenSign")) { //Utils.MessagesBox("签字版设备未授权使用"); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; } else { - Task.Run(() => { HttpPostResponseBySign("open", 1, param.code); }); + Task.Run(() => { HttpPostResponseBySign("open", 1, param.code, param.timeout); }); @event3.WaitOne(); string result = sginStr; + if (sginStr.Contains("")) + { + result = " {\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "在规定时间内未签字" + "\"}"; + } SubmitLogs(result, "OpenSign"); return result; } @@ -528,7 +615,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser catch (Exception ex) { //Log.Error("打开签字版异常: " + ex.Message + ""); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + ""+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "OpenSign"); return result; } @@ -546,12 +633,12 @@ namespace AKS.EnterpriseLibrary.WebBrowser if (!isFuncisFuncObject("OpenSign")) { //Utils.MessagesBox("签字版设备未授权使用"); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; } else { - Task.Run(() => HttpPostResponseBySign("close", 2, "")); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "签字版已关闭" + "\"}"; + Task.Run(() => HttpPostResponseBySign("close", 2, "",5)); + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "签字版已关闭" + "\"}"; SubmitLogs(result, "openCamera"); return result; } @@ -559,7 +646,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser catch (Exception ex) { //Log.Error("关闭签字版异常: " + ex.Message + ""); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "OpenSign"); return result; } @@ -572,55 +659,56 @@ namespace AKS.EnterpriseLibrary.WebBrowser /// public static string ReadFingerData(string content) { - var param = content.ConvertToAnonymousType(new - { - code = default(string), - isclose = default(bool) - }); try { + var param = content.ConvertToAnonymousType(new + { + code = default(string), + isclose = default(bool), + timeout = default(int) + }); if (param == null) { - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; } if (!isFuncisFuncObject("ReadFingerData")) { //Utils.MessagesBox("指纹设备未授权使用"); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "指纹设备未授权使用" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "指纹设备未授权使用" + "\"}"; } else { if (param.isclose) { - Task.Run(() => { HttpPostResponseByFinger("close", 2); }); + Task.Run(() => { HttpPostResponseByFinger("close", 2, param.timeout); }); event2.WaitOne(); string result = string.Empty; if (string.IsNullOrEmpty(fingerStr)) { - result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "关闭失败" + "\"}"; + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "关闭失败" + "\"}"; SubmitLogs(result, "ReadFingerData"); } else { - result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "关闭成功" + "\"}"; + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "关闭成功" + "\"}"; } SubmitLogs(result, "ReadFingerData"); return result; } else { - Task.Run(() => { HttpPostResponseByFinger("open", 1); }); + Task.Run(() => { HttpPostResponseByFinger("open", 1, param.timeout); }); event2.WaitOne(); string result = string.Empty; Log.Info("指纹数据" + fingerStr); if (string.IsNullOrEmpty(fingerStr)) { - result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "读取失败" + "\"}"; + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "读取失败" + "\"}"; SubmitLogs(result, "ReadFingerData"); } else { - result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + fingerStr + "\"}"; + result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + fingerStr + "\"}"; } SubmitLogs(result, "ReadFingerData"); return result; @@ -630,7 +718,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser catch (Exception ex) { //Log.Error("指纹异常: " + ex.Message + ""); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "ReadFingerData"); return result; } @@ -646,25 +734,25 @@ namespace AKS.EnterpriseLibrary.WebBrowser /// public static string SoundRecording(string content) { - var param = content.ConvertToAnonymousType(new - { - code = default(string), - isopen = default(bool), - url = default(string) - }); - try { + var param = content.ConvertToAnonymousType(new + { + code = default(string), + isopen = default(bool), + url = default(string) + }); + if (param == null) { - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; } bool isopen = param.isopen; string url = param.url; if (!isFuncisFuncObject("SoundRecording")) { Utils.MessagesBox("录音设备未授权使用"); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "录音设备未授权使用" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "录音设备未授权使用" + "\"}"; } else { @@ -682,13 +770,13 @@ namespace AKS.EnterpriseLibrary.WebBrowser MatchCollection mc = re.Matches(url);//获取的是一个数组 string reurl = mc[0].ToString() + "://" + mc[1].ToString() + urlpath; - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + reurl + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + reurl + "\"}"; SubmitLogs(result, "SoundRecording"); return result; } else { - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"suffix\":\"wav\",\"data\":\"" + "结束录音失败" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"suffix\":\"wav\",\"data\":\"" + "结束录音失败" + "\"}"; SubmitLogs(result, "SoundRecording"); return result; } @@ -697,13 +785,13 @@ namespace AKS.EnterpriseLibrary.WebBrowser { if (StartRecording()) { - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "开始录音" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "开始录音" + "\"}"; SubmitLogs(result, "SoundRecording"); return result; } else { - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"suffix\":\"wav\",\"data\":\"" + "录音失败" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"fali\",\"code\":\"400\",\"status\":false,\"suffix\":\"wav\",\"data\":\"" + "录音失败" + "\"}"; SubmitLogs(result, "SoundRecording"); return result; } @@ -713,14 +801,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser if (StopRecording()) { srpath = string.Empty; - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "取消录音" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "取消录音" + "\"}"; SubmitLogs(result, "SoundRecording"); return result; } else { srpath = string.Empty; - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"wav\",\"data\":\"" + "取消录音失败" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"wav\",\"data\":\"" + "取消录音失败" + "\"}"; SubmitLogs(result, "SoundRecording"); return result; } @@ -731,7 +819,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser catch (Exception ex) { //Log.Error("开始录音、取消录音、结束录音异常: " + ex.Message + ""); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "SoundRecording"); return result; } @@ -744,24 +832,25 @@ namespace AKS.EnterpriseLibrary.WebBrowser /// public static string PrintFile(string content) { - var param = content.ConvertToAnonymousType(new - { - code = default(string), - url = default(string), - ext = default(string) - }); + try { + var param = content.ConvertToAnonymousType(new + { + code = default(string), + url = default(string), + ext = default(string) + }); if (param == null) { - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; } string url = param.url; string ext = param.ext; if (!isFuncisFuncObject("PrintFile")) { //Utils.MessagesBox("打印机设备未授权使用"); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; } else { @@ -791,7 +880,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser string command = $"lp -d {PrinterName} {path}"; ShllCommad(command); }); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; SubmitLogs(result, "PrintFile"); return result; } @@ -799,7 +888,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser catch (Exception ex) { //Log.Error("根据文件地址在线打印异常: " + ex.Message + ""); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "PrintFile"); return result; } @@ -815,22 +904,22 @@ namespace AKS.EnterpriseLibrary.WebBrowser //[JSFunction] public static string PrintBase64(string content) { - var param = content.ConvertToAnonymousType(new - { - code = default(string), - base64 = default(string), - ext = default(string) - }); try { + var param = content.ConvertToAnonymousType(new + { + code = default(string), + base64 = default(string), + ext = default(string) + }); if (param == null) { - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; } if (!isFuncisFuncObject("PrintBase64")) { //Utils.MessagesBox("打印机设备未授权使用"); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; } else { @@ -855,14 +944,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser string command = $"lp -d {PrinterName} {path}"; ShllCommad(command); }); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; SubmitLogs(result, "PrintBase64"); return result; } } catch (Exception ex) { - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "PrintBase64"); return result; } @@ -876,24 +965,25 @@ namespace AKS.EnterpriseLibrary.WebBrowser /// public static string PalyFile(string content) { - var param = content.ConvertToAnonymousType(new - { - code = default(string), - url = default(string), - ispaye = default(bool) - }); + try { + var param = content.ConvertToAnonymousType(new + { + code = default(string), + url = default(string), + ispaye = default(bool) + }); if (param == null) { - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "参数解析错误" + "\"}"; } string url = param.url; bool ispaly = param.ispaye; if (!isFuncisFuncObject("PalyFile")) { //Utils.MessagesBox("音频设备未授权使用"); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "音频设备未授权使用" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "音频设备未授权使用" + "\"}"; } else { @@ -914,7 +1004,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } //AutoAudio(ispaly, ""); }); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "停止播放成功" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "停止播放成功" + "\"}"; SubmitLogs(result, "PalyFile"); return result; } @@ -967,7 +1057,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser ShllCommad(command); //AutoAudio(ispaly, path); }); - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "开始播放" + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "开始播放" + "\"}"; SubmitLogs(result, "PalyFile"); return result; } @@ -975,7 +1065,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser } catch (Exception ex) { - string result = "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; SubmitLogs(result, "PalyFile"); return result; } @@ -994,12 +1084,12 @@ namespace AKS.EnterpriseLibrary.WebBrowser { Bash("/usr/bin/python3 /usr/bin/onboard"); }); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"" + "唤醒键盘成功" + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"" + "唤醒键盘成功" + "\"}"; } catch (Exception ex) { //Log.Error("唤醒键盘异常: " + ex.Message + ""); - return "{\"timestamp\":\"" + Utils.GetTimestamp()+ "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; + return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; } } @@ -1290,13 +1380,13 @@ namespace AKS.EnterpriseLibrary.WebBrowser /// /// 签字版 /// - private static async void HttpPostResponseBySign(string type, int typeCode, string code) + private static async void HttpPostResponseBySign(string type, int typeCode, string code,int timeout) { try { var httpClient = new HttpClient(); var uploader = new ChunkedUpload(httpClient); - sginStr = await uploader.PostSign(type, typeCode, code); + sginStr = await uploader.PostSign(type, typeCode, code, timeout); @event3.Set(); } catch (Exception ex) @@ -1329,13 +1419,13 @@ namespace AKS.EnterpriseLibrary.WebBrowser /// /// 指紋 /// - private static async void HttpPostResponseByFinger(string type, int typeCode) + private static async void HttpPostResponseByFinger(string type, int typeCode,int timeout) { try { var httpClient = new HttpClient(); var uploader = new ChunkedUpload(httpClient); - fingerStr = await uploader.PostFinger(type, typeCode); + fingerStr = await uploader.PostFinger(type, typeCode, timeout); @event2.Set(); } catch (Exception ex) @@ -1350,13 +1440,13 @@ namespace AKS.EnterpriseLibrary.WebBrowser /// /// 读取身份证 /// - private static async void HttpPostResponseByIdcard(string type, int typeCode) + private static async void HttpPostResponseByIdcard(string type, int typeCode, int timeout) { try { var httpClient = new HttpClient(); var uploader = new ChunkedUpload(httpClient); - IdcardStr = await uploader.OpenGetIdcard(type, typeCode); + IdcardStr = await uploader.OpenGetIdcard(type, typeCode, timeout); @event7.Set(); } catch (Exception ex) diff --git a/CPF_Cef/Parame.cs b/CPF_Cef/Parame.cs index 00451bc..f01d95a 100644 --- a/CPF_Cef/Parame.cs +++ b/CPF_Cef/Parame.cs @@ -26,7 +26,7 @@ namespace AksWebBrowser //高拍仪url public static string gpyUrl = "http://127.0.0.1:6543"; //签字版、指纹、身份证 - public static string signUrl = "http://127.0.0.1:9399/device"; + public static string signUrl = "http://192.168.0.234:9399/device"; //票据打印机 public static string pritPj = "/dev/ttyS7"; //波特率