|
|
@ -5,6 +5,7 @@ using AKSWebBrowser.Commen; |
|
|
|
using CPF.Cef; |
|
|
|
using CPF.Cef; |
|
|
|
using CPF.Shapes; |
|
|
|
using CPF.Shapes; |
|
|
|
using CPF.Windows; |
|
|
|
using CPF.Windows; |
|
|
|
|
|
|
|
using Fleck; |
|
|
|
using Newtonsoft.Json; |
|
|
|
using Newtonsoft.Json; |
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
using System; |
|
|
|
using System; |
|
|
@ -16,6 +17,8 @@ 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.Security.Authentication; |
|
|
|
using System.Security.Authentication; |
|
|
|
using System.Text; |
|
|
|
using System.Text; |
|
|
|
using System.Text.RegularExpressions; |
|
|
|
using System.Text.RegularExpressions; |
|
|
@ -33,24 +36,29 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
public static void DeviceControllerInit() |
|
|
|
public static void DeviceControllerInit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
List<string> lit = new List<string>(); |
|
|
|
List<string> lit = new List<string>(); |
|
|
|
SAEA.WebSocket.WSServer ws = new SAEA.WebSocket.WSServer(19983); |
|
|
|
var server = new WebSocketServer("ws://0.0.0.0:19983"); |
|
|
|
ws.OnConnected += (s) => |
|
|
|
server.Start(socket => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
socket.OnOpen = () => |
|
|
|
{ |
|
|
|
{ |
|
|
|
string result = "{\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接成功\"}"; |
|
|
|
string result = "{\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接成功\"}"; |
|
|
|
byte[] bytes = SerializeContent(result); |
|
|
|
socket.Send(result); |
|
|
|
ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); |
|
|
|
|
|
|
|
Log.Error("请求连接" + s.ToString()); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
ws.OnMessage += (s, e) => |
|
|
|
socket.OnClose = () => |
|
|
|
{ |
|
|
|
{ |
|
|
|
string content = Encoding.UTF8.GetString(e.Content); |
|
|
|
string result = "{\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接关闭\"}"; |
|
|
|
|
|
|
|
socket.Send(result); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
socket.OnMessage = message => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
string content = message; |
|
|
|
//读取参数 |
|
|
|
//读取参数 |
|
|
|
if (content != "ping" && !string.IsNullOrEmpty(content)) |
|
|
|
if (content != "ping" && !string.IsNullOrEmpty(content)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//返回内容 |
|
|
|
//返回内容 |
|
|
|
string result = string.Empty; |
|
|
|
string result = string.Empty; |
|
|
|
content = Base64str2(content); |
|
|
|
content = Base64str2(content); |
|
|
|
Log.Error("收到请求:" + s.ToString() + " 请求参数:" + content); |
|
|
|
Log.Error("收到请求:" + socket.ConnectionInfo.ClientIpAddress + " 请求参数:" + content); |
|
|
|
if (!string.IsNullOrEmpty(content)) |
|
|
|
if (!string.IsNullOrEmpty(content)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
try |
|
|
|
try |
|
|
@ -120,8 +128,8 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
//aks100109 |
|
|
|
//aks100109 |
|
|
|
//根据文件base64打印(PDF) { "code":"aks100109","base64":"ADFJLAKSDJFLKASJF...","ext":"pdf"} |
|
|
|
//根据文件base64打印(PDF) { "code":"aks100109","base64":"ADFJLAKSDJFLKASJF...","ext":"pdf"} |
|
|
|
case "aks100109": |
|
|
|
case "aks100109": |
|
|
|
//result = PrintBase64(content); |
|
|
|
result = PrintBase64(content); |
|
|
|
result = "{\"keycode\":\"" + "aks100109" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"Base64打印保留原方式\"}"; |
|
|
|
//result = "{\"keycode\":\"" + "aks100109" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"Base64打印保留原方式\"}"; |
|
|
|
break; |
|
|
|
break; |
|
|
|
//aks100110 |
|
|
|
//aks100110 |
|
|
|
//播放音频文件 { "code":"aks100110","url":"http://127.0.0.1/test.wav","ispaye":false} |
|
|
|
//播放音频文件 { "code":"aks100110","url":"http://127.0.0.1/test.wav","ispaye":false} |
|
|
@ -157,12 +165,11 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
{ |
|
|
|
{ |
|
|
|
result = "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; |
|
|
|
result = "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; |
|
|
|
} |
|
|
|
} |
|
|
|
Log.Error("答复请求者:" + s.ToString() + " 返回数据:" + result); |
|
|
|
|
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
//答复请求者(处理完请求后在些答复) |
|
|
|
//答复请求者(处理完请求后在些答复) |
|
|
|
byte[] bytes = SerializeContent(result); |
|
|
|
byte[] bytes = SerializeContent(result); |
|
|
|
ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); |
|
|
|
socket.Send(result); |
|
|
|
} |
|
|
|
} |
|
|
|
catch { result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"400\",\"status\":true,\"data\":\"返回参数失败\"}"; } |
|
|
|
catch { result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"400\",\"status\":true,\"data\":\"返回参数失败\"}"; } |
|
|
|
finally { } |
|
|
|
finally { } |
|
|
@ -171,26 +178,15 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
else if (content == "ping") |
|
|
|
else if (content == "ping") |
|
|
|
{ |
|
|
|
{ |
|
|
|
string result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"收到客户端心跳\"}"; |
|
|
|
string result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"收到客户端心跳\"}"; |
|
|
|
byte[] bytes = SerializeContent(result); |
|
|
|
socket.Send(result); |
|
|
|
ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
string result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"收到客户端心跳\"}"; |
|
|
|
string result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"收到客户端心跳\"}"; |
|
|
|
byte[] bytes = SerializeContent(result); |
|
|
|
socket.Send(result); |
|
|
|
ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
ws.OnDisconnected += (s) => |
|
|
|
}); |
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Log.Error("断开连接" + s.ToString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch { } |
|
|
|
|
|
|
|
finally { } |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
ws.Start(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//解包 |
|
|
|
//解包 |
|
|
@ -234,11 +230,12 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
{ |
|
|
|
{ |
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
//Finger("",""); |
|
|
|
|
|
|
|
IDCard iDCard = new IDCard(); |
|
|
|
IDCard iDCard = new IDCard(); |
|
|
|
string result = iDCard.getIdCard(code); |
|
|
|
string result = iDCard.getIdCard(code); |
|
|
|
SubmitLogs(result, "IDCardRead"); |
|
|
|
SubmitLogs(result, "IDCardRead"); |
|
|
|
return result; |
|
|
|
//LhtCF lht = new LhtCF(); |
|
|
|
|
|
|
|
//string stat = lht.LhtCFFace(code, "/home/aks/aks/wwwroot/Face/20240529134642.bmp"); |
|
|
|
|
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -277,7 +274,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
|
|
|
|
|
|
|
|
if (!isFuncisFuncObject("SendByPrint")) |
|
|
|
if (!isFuncisFuncObject("SendByPrint")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Utils.MessagesBox("打印排队票据设备未授权使用"); |
|
|
|
//Utils.MessagesBox("打印排队票据设备未授权使用"); |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印排队票据设备未授权使用" + "\"}"; |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印排队票据设备未授权使用" + "\"}"; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -336,7 +333,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
bool ispaye = param.ispaye; |
|
|
|
bool ispaye = param.ispaye; |
|
|
|
if (!isFuncisFuncObject("payleText")) |
|
|
|
if (!isFuncisFuncObject("payleText")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Utils.MessagesBox("文字语音播报设备未授权使用"); |
|
|
|
//Utils.MessagesBox("文字语音播报设备未授权使用"); |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "文字语音播报设备未授权使用" + "\"}"; |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "文字语音播报设备未授权使用" + "\"}"; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -472,7 +469,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!isFuncisFuncObject("OpenSign")) |
|
|
|
if (!isFuncisFuncObject("OpenSign")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Utils.MessagesBox("签字版设备未授权使用"); |
|
|
|
//Utils.MessagesBox("签字版设备未授权使用"); |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -505,7 +502,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!isFuncisFuncObject("OpenSign")) |
|
|
|
if (!isFuncisFuncObject("OpenSign")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Utils.MessagesBox("签字版设备未授权使用"); |
|
|
|
//Utils.MessagesBox("签字版设备未授权使用"); |
|
|
|
return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; |
|
|
|
return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -542,7 +539,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!isFuncisFuncObject("ReadFingerData")) |
|
|
|
if (!isFuncisFuncObject("ReadFingerData")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Utils.MessagesBox("指纹设备未授权使用"); |
|
|
|
//Utils.MessagesBox("指纹设备未授权使用"); |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "指纹设备未授权使用" + "\"}"; |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "指纹设备未授权使用" + "\"}"; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -564,7 +561,8 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
SubmitLogs(result, "ReadFingerData"); |
|
|
|
SubmitLogs(result, "ReadFingerData"); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
Task.Run(() => { HttpPostResponseByFinger("open", 1); }); |
|
|
|
Task.Run(() => { HttpPostResponseByFinger("open", 1); }); |
|
|
|
event2.WaitOne(); |
|
|
|
event2.WaitOne(); |
|
|
|
string result = string.Empty; |
|
|
|
string result = string.Empty; |
|
|
@ -623,9 +621,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
//结束录音上传文件 |
|
|
|
//结束录音上传文件 |
|
|
|
if (!string.IsNullOrEmpty(url) && !isopen) |
|
|
|
if (!string.IsNullOrEmpty(url) && !isopen) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Task.Run(() => { HttpPostResponseByRecord("stop_record", 3, ""); }); |
|
|
|
if (StopRecording()) |
|
|
|
event2.WaitOne(); |
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(srpath)) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
Task.Run(async () => |
|
|
|
Task.Run(async () => |
|
|
|
{ |
|
|
|
{ |
|
|
@ -649,16 +645,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
} |
|
|
|
} |
|
|
|
else if (isopen)//开始录音 |
|
|
|
else if (isopen)//开始录音 |
|
|
|
{ |
|
|
|
{ |
|
|
|
string time = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo); |
|
|
|
if (StartRecording()) |
|
|
|
string dirpath = Utils.getSystemPaht() + @"/wwwroot/Record"; |
|
|
|
|
|
|
|
if (!Directory.Exists(dirpath)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Directory.CreateDirectory(dirpath); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
string path = dirpath + "/" + time + ".wav"; |
|
|
|
|
|
|
|
Task.Run(() => { HttpPostResponseByRecord("start_record", 2, path); }); |
|
|
|
|
|
|
|
event2.WaitOne(); |
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(srpath)) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "开始录音" + "\"}"; |
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "开始录音" + "\"}"; |
|
|
|
SubmitLogs(result, "SoundRecording"); |
|
|
|
SubmitLogs(result, "SoundRecording"); |
|
|
@ -673,9 +660,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
} |
|
|
|
} |
|
|
|
else //取消录音 |
|
|
|
else //取消录音 |
|
|
|
{ |
|
|
|
{ |
|
|
|
Task.Run(() => { HttpPostResponseByRecord("stop_record", 3, ""); }); |
|
|
|
if (StopRecording()) |
|
|
|
event2.WaitOne(); |
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(srpath)) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
srpath = string.Empty; |
|
|
|
srpath = string.Empty; |
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "取消录音" + "\"}"; |
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "取消录音" + "\"}"; |
|
|
@ -722,7 +707,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
string ext = param.ext; |
|
|
|
string ext = param.ext; |
|
|
|
if (!isFuncisFuncObject("PrintFile")) |
|
|
|
if (!isFuncisFuncObject("PrintFile")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Utils.MessagesBox("打印机设备未授权使用"); |
|
|
|
//Utils.MessagesBox("打印机设备未授权使用"); |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -774,15 +759,21 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
/// <param name="base64"></param> |
|
|
|
/// <param name="base64"></param> |
|
|
|
/// <param name="ext"></param> |
|
|
|
/// <param name="ext"></param> |
|
|
|
/// <returns></returns> |
|
|
|
/// <returns></returns> |
|
|
|
[JSFunction] |
|
|
|
//[JSFunction] |
|
|
|
public static string PrintBase64(string url, string base64, string ext) |
|
|
|
public static string PrintBase64(string content) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var param = content.ConvertToAnonymousType(new |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
code = default(string), |
|
|
|
|
|
|
|
base64 = default(string), |
|
|
|
|
|
|
|
ext = default(string) |
|
|
|
|
|
|
|
}); |
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!isFuncisFuncObject("PrintBase64")) |
|
|
|
if (!isFuncisFuncObject("PrintBase64")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Utils.MessagesBox("打印机设备未授权使用"); |
|
|
|
//Utils.MessagesBox("打印机设备未授权使用"); |
|
|
|
return "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
@ -797,8 +788,8 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
Directory.CreateDirectory(dirpath); |
|
|
|
Directory.CreateDirectory(dirpath); |
|
|
|
} |
|
|
|
} |
|
|
|
var filepath = System.IO.Path.Combine(dirpath, time); |
|
|
|
var filepath = System.IO.Path.Combine(dirpath, time); |
|
|
|
string path = dirpath + @"/" + time + "." + ext; |
|
|
|
string path = dirpath + @"/" + time + "." + param.ext; |
|
|
|
byte[] bytes = Convert.FromBase64String(base64); |
|
|
|
byte[] bytes = Convert.FromBase64String(param.base64); |
|
|
|
System.IO.FileStream stream = new System.IO.FileStream(path, System.IO.FileMode.CreateNew); |
|
|
|
System.IO.FileStream stream = new System.IO.FileStream(path, System.IO.FileMode.CreateNew); |
|
|
|
System.IO.BinaryWriter writer = new System.IO.BinaryWriter(stream); |
|
|
|
System.IO.BinaryWriter writer = new System.IO.BinaryWriter(stream); |
|
|
|
writer.Write(bytes, 0, bytes.Length); |
|
|
|
writer.Write(bytes, 0, bytes.Length); |
|
|
@ -807,14 +798,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
string command = $"lp -d {PrinterName} {path}"; |
|
|
|
string command = $"lp -d {PrinterName} {path}"; |
|
|
|
ShllCommad(command); |
|
|
|
ShllCommad(command); |
|
|
|
}); |
|
|
|
}); |
|
|
|
string result = "{\"keycode\":\"" + "" + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; |
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":\"" + "打印成功" + "\"}"; |
|
|
|
SubmitLogs(result, "PrintBase64"); |
|
|
|
SubmitLogs(result, "PrintBase64"); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
string result = "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}"; |
|
|
|
SubmitLogs(result, "PrintBase64"); |
|
|
|
SubmitLogs(result, "PrintBase64"); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
@ -840,7 +831,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser |
|
|
|
bool ispaly = param.ispaly; |
|
|
|
bool ispaly = param.ispaly; |
|
|
|
if (!isFuncisFuncObject("PalyFile")) |
|
|
|
if (!isFuncisFuncObject("PalyFile")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Utils.MessagesBox("音频设备未授权使用"); |
|
|
|
//Utils.MessagesBox("音频设备未授权使用"); |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "音频设备未授权使用" + "\"}"; |
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "音频设备未授权使用" + "\"}"; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|