|
|
|
@ -5,6 +5,7 @@ using AKSWebBrowser.Commen;
|
|
|
|
|
using CPF.Cef; |
|
|
|
|
using CPF.Shapes; |
|
|
|
|
using CPF.Windows; |
|
|
|
|
using Fleck; |
|
|
|
|
using Newtonsoft.Json; |
|
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
|
using System; |
|
|
|
@ -16,6 +17,8 @@ using System.IO;
|
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Net; |
|
|
|
|
using System.Net.Http; |
|
|
|
|
using System.Net.WebSockets; |
|
|
|
|
using System.Reflection.Metadata; |
|
|
|
|
using System.Security.Authentication; |
|
|
|
|
using System.Text; |
|
|
|
|
using System.Text.RegularExpressions; |
|
|
|
@ -33,164 +36,157 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
public static void DeviceControllerInit() |
|
|
|
|
{ |
|
|
|
|
List<string> lit = new List<string>(); |
|
|
|
|
SAEA.WebSocket.WSServer ws = new SAEA.WebSocket.WSServer(19983); |
|
|
|
|
ws.OnConnected += (s) => |
|
|
|
|
{ |
|
|
|
|
string result = "{\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接成功\"}"; |
|
|
|
|
byte[] bytes = SerializeContent(result); |
|
|
|
|
ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); |
|
|
|
|
Log.Error("请求连接" + s.ToString()); |
|
|
|
|
}; |
|
|
|
|
ws.OnMessage += (s, e) => |
|
|
|
|
{ |
|
|
|
|
string content = Encoding.UTF8.GetString(e.Content); |
|
|
|
|
//读取参数 |
|
|
|
|
if (content != "ping" && !string.IsNullOrEmpty(content)) |
|
|
|
|
var server = new WebSocketServer("ws://0.0.0.0:19983"); |
|
|
|
|
server.Start(socket => |
|
|
|
|
{ |
|
|
|
|
socket.OnOpen = () => |
|
|
|
|
{ |
|
|
|
|
string result = "{\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接成功\"}"; |
|
|
|
|
socket.Send(result); |
|
|
|
|
}; |
|
|
|
|
socket.OnClose = () => |
|
|
|
|
{ |
|
|
|
|
string result = "{\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接关闭\"}"; |
|
|
|
|
socket.Send(result); |
|
|
|
|
}; |
|
|
|
|
socket.OnMessage = message => |
|
|
|
|
{ |
|
|
|
|
//返回内容 |
|
|
|
|
string result = string.Empty; |
|
|
|
|
content = Base64str2(content); |
|
|
|
|
Log.Error("收到请求:" + s.ToString() + " 请求参数:" + content); |
|
|
|
|
if (!string.IsNullOrEmpty(content)) |
|
|
|
|
string content = message; |
|
|
|
|
//读取参数 |
|
|
|
|
if (content != "ping" && !string.IsNullOrEmpty(content)) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
//返回内容 |
|
|
|
|
string result = string.Empty; |
|
|
|
|
content = Base64str2(content); |
|
|
|
|
Log.Error("收到请求:" + socket.ConnectionInfo.ClientIpAddress + " 请求参数:" + content); |
|
|
|
|
if (!string.IsNullOrEmpty(content)) |
|
|
|
|
{ |
|
|
|
|
var json = content.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
code = default(string) |
|
|
|
|
}); |
|
|
|
|
if (json != null) |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
//接收指令和参数 |
|
|
|
|
string keycode = json.code; |
|
|
|
|
switch (keycode) |
|
|
|
|
var json = content.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
//aks100101 |
|
|
|
|
//读取身份证卡号 {"code":"aks100101"} |
|
|
|
|
case "aks100101": |
|
|
|
|
result = IDCardRead(keycode); |
|
|
|
|
break; |
|
|
|
|
//aks100102 |
|
|
|
|
//打印排队票据 {"code":"aks100102","ph":"100101","ddrs":"中国检察","qrcode":"90087100100124433002","ywmc":"信访"} |
|
|
|
|
case "aks100102": |
|
|
|
|
result = SendByPrint(content); |
|
|
|
|
break; |
|
|
|
|
//aks100103 |
|
|
|
|
//文字语音播报 |
|
|
|
|
//播放:{ "code":"aks100103","text":"你好!","ispaye":false}, |
|
|
|
|
//停止播放:{ "code":"aks100104","text":"","ispaye":true} |
|
|
|
|
case "aks100103": |
|
|
|
|
result = payleText(content); |
|
|
|
|
Log.Info("文字语音播报返回:" + result); |
|
|
|
|
break; |
|
|
|
|
//aks100104 |
|
|
|
|
//打开高拍仪并且进行快速扫描文件 {"code":"aks100104"} |
|
|
|
|
case "aks100104": |
|
|
|
|
result = openCamera(keycode); |
|
|
|
|
break; |
|
|
|
|
//aks100105 |
|
|
|
|
//打开签字版 {"code":"aks100105"} |
|
|
|
|
case "aks100105": |
|
|
|
|
result = OpenSign(content); |
|
|
|
|
Log.Info("签字版数据返回:" + result); |
|
|
|
|
break; |
|
|
|
|
//aks100112 |
|
|
|
|
//关闭签字版 {"code":"aks100112"} |
|
|
|
|
case "aks100112": |
|
|
|
|
result = CloseSign(keycode); |
|
|
|
|
break; |
|
|
|
|
//aks100106 |
|
|
|
|
//指纹 {"code":"aks100106"} |
|
|
|
|
case "aks100106": |
|
|
|
|
result = ReadFingerData(keycode); |
|
|
|
|
break; |
|
|
|
|
//aks100107 开始录音、取消录音、结束录音 |
|
|
|
|
// 开始录音:{ "code":"aks100107","url":"","isopen":true} |
|
|
|
|
// 取消录音: { "code":"aks100107","url":"","isopen":false} |
|
|
|
|
// 结束录音: { "code":"aks100107","url":"http://127.0.0.1/Upload","isopen":false} |
|
|
|
|
case "aks100107": |
|
|
|
|
result = SoundRecording(content); |
|
|
|
|
Log.Info("开始录音、取消录音、结束录音返回:" + result); |
|
|
|
|
break; |
|
|
|
|
//aks100108 |
|
|
|
|
//根据文件地址在线打印 { "code":"aks100108","url":"http://127.0.0.1/test.doc","ext":"doc"} |
|
|
|
|
case "aks100108": |
|
|
|
|
result = PrintFile(content); |
|
|
|
|
break; |
|
|
|
|
//aks100109 |
|
|
|
|
//根据文件base64打印(PDF) { "code":"aks100109","base64":"ADFJLAKSDJFLKASJF...","ext":"pdf"} |
|
|
|
|
case "aks100109": |
|
|
|
|
//result = PrintBase64(content); |
|
|
|
|
result = "{\"keycode\":\"" + "aks100109" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"Base64打印保留原方式\"}"; |
|
|
|
|
break; |
|
|
|
|
//aks100110 |
|
|
|
|
//播放音频文件 { "code":"aks100110","url":"http://127.0.0.1/test.wav","ispaye":false} |
|
|
|
|
//停止播放音频文件 { "code":"aks100110","url":"","ispaye":true} |
|
|
|
|
case "aks100110": |
|
|
|
|
result = PalyFile(content); |
|
|
|
|
break; |
|
|
|
|
//aks100111 唤醒键盘 {"code":"aks100111"} |
|
|
|
|
case "aks100111": |
|
|
|
|
result = openKey(keycode); |
|
|
|
|
break; |
|
|
|
|
//aks100113 |
|
|
|
|
//读取指纹 {"code":"aks100113","isclose":false} |
|
|
|
|
//关闭指纹 {"code":"aks100113","isclose":true} |
|
|
|
|
case "aks100113": |
|
|
|
|
result = ReadFingerData(content); |
|
|
|
|
Log.Info("指纹返回:" + result); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
result = "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; |
|
|
|
|
break; |
|
|
|
|
code = default(string) |
|
|
|
|
}); |
|
|
|
|
if (json != null) |
|
|
|
|
{ |
|
|
|
|
//接收指令和参数 |
|
|
|
|
string keycode = json.code; |
|
|
|
|
switch (keycode) |
|
|
|
|
{ |
|
|
|
|
//aks100101 |
|
|
|
|
//读取身份证卡号 {"code":"aks100101"} |
|
|
|
|
case "aks100101": |
|
|
|
|
result = IDCardRead(keycode); |
|
|
|
|
break; |
|
|
|
|
//aks100102 |
|
|
|
|
//打印排队票据 {"code":"aks100102","ph":"100101","ddrs":"中国检察","qrcode":"90087100100124433002","ywmc":"信访"} |
|
|
|
|
case "aks100102": |
|
|
|
|
result = SendByPrint(content); |
|
|
|
|
break; |
|
|
|
|
//aks100103 |
|
|
|
|
//文字语音播报 |
|
|
|
|
//播放:{ "code":"aks100103","text":"你好!","ispaye":false}, |
|
|
|
|
//停止播放:{ "code":"aks100104","text":"","ispaye":true} |
|
|
|
|
case "aks100103": |
|
|
|
|
result = payleText(content); |
|
|
|
|
Log.Info("文字语音播报返回:" + result); |
|
|
|
|
break; |
|
|
|
|
//aks100104 |
|
|
|
|
//打开高拍仪并且进行快速扫描文件 {"code":"aks100104"} |
|
|
|
|
case "aks100104": |
|
|
|
|
result = openCamera(keycode); |
|
|
|
|
break; |
|
|
|
|
//aks100105 |
|
|
|
|
//打开签字版 {"code":"aks100105"} |
|
|
|
|
case "aks100105": |
|
|
|
|
result = OpenSign(content); |
|
|
|
|
Log.Info("签字版数据返回:" + result); |
|
|
|
|
break; |
|
|
|
|
//aks100112 |
|
|
|
|
//关闭签字版 {"code":"aks100112"} |
|
|
|
|
case "aks100112": |
|
|
|
|
result = CloseSign(keycode); |
|
|
|
|
break; |
|
|
|
|
//aks100106 |
|
|
|
|
//指纹 {"code":"aks100106"} |
|
|
|
|
case "aks100106": |
|
|
|
|
result = ReadFingerData(keycode); |
|
|
|
|
break; |
|
|
|
|
//aks100107 开始录音、取消录音、结束录音 |
|
|
|
|
// 开始录音:{ "code":"aks100107","url":"","isopen":true} |
|
|
|
|
// 取消录音: { "code":"aks100107","url":"","isopen":false} |
|
|
|
|
// 结束录音: { "code":"aks100107","url":"http://127.0.0.1/Upload","isopen":false} |
|
|
|
|
case "aks100107": |
|
|
|
|
result = SoundRecording(content); |
|
|
|
|
Log.Info("开始录音、取消录音、结束录音返回:" + result); |
|
|
|
|
break; |
|
|
|
|
//aks100108 |
|
|
|
|
//根据文件地址在线打印 { "code":"aks100108","url":"http://127.0.0.1/test.doc","ext":"doc"} |
|
|
|
|
case "aks100108": |
|
|
|
|
result = PrintFile(content); |
|
|
|
|
break; |
|
|
|
|
//aks100109 |
|
|
|
|
//根据文件base64打印(PDF) { "code":"aks100109","base64":"ADFJLAKSDJFLKASJF...","ext":"pdf"} |
|
|
|
|
case "aks100109": |
|
|
|
|
result = PrintBase64(content); |
|
|
|
|
//result = "{\"keycode\":\"" + "aks100109" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"Base64打印保留原方式\"}"; |
|
|
|
|
break; |
|
|
|
|
//aks100110 |
|
|
|
|
//播放音频文件 { "code":"aks100110","url":"http://127.0.0.1/test.wav","ispaye":false} |
|
|
|
|
//停止播放音频文件 { "code":"aks100110","url":"","ispaye":true} |
|
|
|
|
case "aks100110": |
|
|
|
|
result = PalyFile(content); |
|
|
|
|
break; |
|
|
|
|
//aks100111 唤醒键盘 {"code":"aks100111"} |
|
|
|
|
case "aks100111": |
|
|
|
|
result = openKey(keycode); |
|
|
|
|
break; |
|
|
|
|
//aks100113 |
|
|
|
|
//读取指纹 {"code":"aks100113","isclose":false} |
|
|
|
|
//关闭指纹 {"code":"aks100113","isclose":true} |
|
|
|
|
case "aks100113": |
|
|
|
|
result = ReadFingerData(content); |
|
|
|
|
Log.Info("指纹返回:" + result); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
result = "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"400\",\"status\":true,\"data\":\"参数解析错误\"}"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"400\",\"status\":true,\"data\":\"参数解析错误\"}"; |
|
|
|
|
} |
|
|
|
|
catch { result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"400\",\"status\":true,\"data\":\"参数解析错误\"}"; } |
|
|
|
|
finally { } |
|
|
|
|
} |
|
|
|
|
catch { result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"400\",\"status\":true,\"data\":\"参数解析错误\"}"; } |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
result = "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; |
|
|
|
|
} |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
//答复请求者(处理完请求后在些答复) |
|
|
|
|
byte[] bytes = SerializeContent(result); |
|
|
|
|
socket.Send(result); |
|
|
|
|
} |
|
|
|
|
catch { result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"400\",\"status\":true,\"data\":\"返回参数失败\"}"; } |
|
|
|
|
finally { } |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
//监听心跳并且回复客户端“已ping作为关键字” |
|
|
|
|
else if (content == "ping") |
|
|
|
|
{ |
|
|
|
|
result = "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; |
|
|
|
|
string result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"收到客户端心跳\"}"; |
|
|
|
|
socket.Send(result); |
|
|
|
|
} |
|
|
|
|
Log.Error("答复请求者:" + s.ToString() + " 返回数据:" + result); |
|
|
|
|
try |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
//答复请求者(处理完请求后在些答复) |
|
|
|
|
byte[] bytes = SerializeContent(result); |
|
|
|
|
ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); |
|
|
|
|
string result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"收到客户端心跳\"}"; |
|
|
|
|
socket.Send(result); |
|
|
|
|
} |
|
|
|
|
catch { result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"400\",\"status\":true,\"data\":\"返回参数失败\"}"; } |
|
|
|
|
finally { } |
|
|
|
|
} |
|
|
|
|
//监听心跳并且回复客户端“已ping作为关键字” |
|
|
|
|
else if (content == "ping") |
|
|
|
|
{ |
|
|
|
|
string result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"收到客户端心跳\"}"; |
|
|
|
|
byte[] bytes = SerializeContent(result); |
|
|
|
|
ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes)); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
string result = "{\"keycode\":\"" + "hert" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"收到客户端心跳\"}"; |
|
|
|
|
byte[] bytes = SerializeContent(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 |
|
|
|
|
{ |
|
|
|
|
//Finger("",""); |
|
|
|
|
IDCard iDCard = new IDCard(); |
|
|
|
|
string result = iDCard.getIdCard(code); |
|
|
|
|
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) |
|
|
|
|
{ |
|
|
|
@ -277,7 +274,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
|
|
|
|
|
if (!isFuncisFuncObject("SendByPrint")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("打印排队票据设备未授权使用"); |
|
|
|
|
//Utils.MessagesBox("打印排队票据设备未授权使用"); |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印排队票据设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -336,7 +333,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
bool ispaye = param.ispaye; |
|
|
|
|
if (!isFuncisFuncObject("payleText")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("文字语音播报设备未授权使用"); |
|
|
|
|
//Utils.MessagesBox("文字语音播报设备未授权使用"); |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "文字语音播报设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -472,7 +469,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
{ |
|
|
|
|
if (!isFuncisFuncObject("OpenSign")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("签字版设备未授权使用"); |
|
|
|
|
//Utils.MessagesBox("签字版设备未授权使用"); |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -505,7 +502,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
{ |
|
|
|
|
if (!isFuncisFuncObject("OpenSign")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("签字版设备未授权使用"); |
|
|
|
|
//Utils.MessagesBox("签字版设备未授权使用"); |
|
|
|
|
return "{\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "签字版设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -542,7 +539,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
{ |
|
|
|
|
if (!isFuncisFuncObject("ReadFingerData")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("指纹设备未授权使用"); |
|
|
|
|
//Utils.MessagesBox("指纹设备未授权使用"); |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "指纹设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -564,7 +561,8 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
SubmitLogs(result, "ReadFingerData"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Task.Run(() => { HttpPostResponseByFinger("open", 1); }); |
|
|
|
|
event2.WaitOne(); |
|
|
|
|
string result = string.Empty; |
|
|
|
@ -623,9 +621,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
//结束录音上传文件 |
|
|
|
|
if (!string.IsNullOrEmpty(url) && !isopen) |
|
|
|
|
{ |
|
|
|
|
Task.Run(() => { HttpPostResponseByRecord("stop_record", 3, ""); }); |
|
|
|
|
event2.WaitOne(); |
|
|
|
|
if (string.IsNullOrEmpty(srpath)) |
|
|
|
|
if (StopRecording()) |
|
|
|
|
{ |
|
|
|
|
Task.Run(async () => |
|
|
|
|
{ |
|
|
|
@ -649,16 +645,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
} |
|
|
|
|
else if (isopen)//开始录音 |
|
|
|
|
{ |
|
|
|
|
string time = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo); |
|
|
|
|
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)) |
|
|
|
|
if (StartRecording()) |
|
|
|
|
{ |
|
|
|
|
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"wav\",\"data\":\"" + "开始录音" + "\"}"; |
|
|
|
|
SubmitLogs(result, "SoundRecording"); |
|
|
|
@ -673,9 +660,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
} |
|
|
|
|
else //取消录音 |
|
|
|
|
{ |
|
|
|
|
Task.Run(() => { HttpPostResponseByRecord("stop_record", 3, ""); }); |
|
|
|
|
event2.WaitOne(); |
|
|
|
|
if (string.IsNullOrEmpty(srpath)) |
|
|
|
|
if (StopRecording()) |
|
|
|
|
{ |
|
|
|
|
srpath = string.Empty; |
|
|
|
|
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; |
|
|
|
|
if (!isFuncisFuncObject("PrintFile")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("打印机设备未授权使用"); |
|
|
|
|
//Utils.MessagesBox("打印机设备未授权使用"); |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -774,15 +759,21 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
/// <param name="base64"></param> |
|
|
|
|
/// <param name="ext"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[JSFunction] |
|
|
|
|
public static string PrintBase64(string url, string base64, string ext) |
|
|
|
|
//[JSFunction] |
|
|
|
|
public static string PrintBase64(string content) |
|
|
|
|
{ |
|
|
|
|
var param = content.ConvertToAnonymousType(new |
|
|
|
|
{ |
|
|
|
|
code = default(string), |
|
|
|
|
base64 = default(string), |
|
|
|
|
ext = default(string) |
|
|
|
|
}); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
if (!isFuncisFuncObject("PrintBase64")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("打印机设备未授权使用"); |
|
|
|
|
return "{\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; |
|
|
|
|
//Utils.MessagesBox("打印机设备未授权使用"); |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "打印机设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -797,8 +788,8 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
Directory.CreateDirectory(dirpath); |
|
|
|
|
} |
|
|
|
|
var filepath = System.IO.Path.Combine(dirpath, time); |
|
|
|
|
string path = dirpath + @"/" + time + "." + ext; |
|
|
|
|
byte[] bytes = Convert.FromBase64String(base64); |
|
|
|
|
string path = dirpath + @"/" + time + "." + param.ext; |
|
|
|
|
byte[] bytes = Convert.FromBase64String(param.base64); |
|
|
|
|
System.IO.FileStream stream = new System.IO.FileStream(path, System.IO.FileMode.CreateNew); |
|
|
|
|
System.IO.BinaryWriter writer = new System.IO.BinaryWriter(stream); |
|
|
|
|
writer.Write(bytes, 0, bytes.Length); |
|
|
|
@ -807,14 +798,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
string command = $"lp -d {PrinterName} {path}"; |
|
|
|
|
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"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
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"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -840,7 +831,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
|
bool ispaly = param.ispaly; |
|
|
|
|
if (!isFuncisFuncObject("PalyFile")) |
|
|
|
|
{ |
|
|
|
|
Utils.MessagesBox("音频设备未授权使用"); |
|
|
|
|
//Utils.MessagesBox("音频设备未授权使用"); |
|
|
|
|
return "{\"keycode\":\"" + param.code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + "音频设备未授权使用" + "\"}"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|