diff --git a/CPF_Cef/AksVideoPlayer.cs b/CPF_Cef/AksVideoPlayer.cs
index 7ec125d..8aca6df 100644
--- a/CPF_Cef/AksVideoPlayer.cs
+++ b/CPF_Cef/AksVideoPlayer.cs
@@ -11,6 +11,7 @@ using CPF.Animation;
using CPF.Svg;
using CPF.Input;
using static System.Net.Mime.MediaTypeNames;
+using LibVLCSharp.Shared;
namespace AksWebBrowser
{
@@ -41,13 +42,13 @@ namespace AksWebBrowser
window.Children.Add(mask);
window.Children.Add(this);
mask.TransitionValue(a => a.Background, "0,0,0,100", TimeSpan.FromSeconds(0.3), null, AnimateMode.Linear);
- //this.TransitionValue(a => a.MarginTop, 100, TimeSpan.FromSeconds(0.3), new PowerEase { }, AnimateMode.EaseOut);
}
private Window window;
protected override void OnInitialized()
{
base.OnInitialized();
+
//@"http://192.168.0.34:92/CaseFile/card/2024-06-03/20240603120112952.mp4"
vplayer.Play(new Uri(url));//播放
}
@@ -55,8 +56,8 @@ namespace AksWebBrowser
{
IsAntiAlias = true;
CornerRadius = "3,3,3,3";
- Height = "600";
- Width = "800";
+ Height = "360";
+ Width = "640";
Background = "#2c2c2c";
ZIndex = 100;
Children.Add(new TextBlock
@@ -65,7 +66,7 @@ namespace AksWebBrowser
MarginTop = 10f,
Classes = "imgAndText",
FontFamily = "微软雅黑",//Alibaba PuHuiTi
- Text = "关闭",
+ Text = "Close",
FontSize = 16,
Cursor = CPF.Cursors.Hand,
Foreground = Color.White,
@@ -88,17 +89,16 @@ namespace AksWebBrowser
}
});
- Children.Add(new TextBlock
- {
- FontSize = 16f,
- MarginLeft = 12.6f,
- MarginTop = 9.6f,
- Classes = "imgAndText",
- Foreground = Color.White,
- Text = videoTitle,
- FontFamily = "微软雅黑",
- });
-
+ //Children.Add(new TextBlock
+ //{
+ // FontSize = 16f,
+ // MarginLeft = 12.6f,
+ // MarginTop = 9.6f,
+ // Classes = "imgAndText",
+ // Foreground = Color.White,
+ // // Text = videoTitle,
+ // FontFamily = "微软雅黑",
+ //});
Children.Add(vplayer);
}
diff --git a/CPF_Cef/Common/ChunkedUpload.cs b/CPF_Cef/Common/ChunkedUpload.cs
index 21a5373..45625f6 100644
--- a/CPF_Cef/Common/ChunkedUpload.cs
+++ b/CPF_Cef/Common/ChunkedUpload.cs
@@ -173,6 +173,8 @@ namespace AksWebBrowser.Common
jo2 = (JObject)JsonConvert.DeserializeObject(ret);
if (jo2["code"].ToString() == "0")
{
+ //关闭签字版
+ await PublicSign("close", 2, timeout);
//读取data数据
string data = jo["data"].ToString();
JObject jo3 = (JObject)JsonConvert.DeserializeObject(data);
@@ -184,16 +186,22 @@ namespace AksWebBrowser.Common
}
else
{
+ //关闭签字版
+ await PublicSign("close", 2, timeout);
//Log.Error("请求签字失败" + jo["message"].ToString());
return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字失败" + "\"}";
}
}
else if (jo2["code"].ToString() == "2")
{
+ //关闭签字版
+ await PublicSign("close", 2, timeout);
return "{\"timestamp\":\"" + "" + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "取消签字" + "\"}";
}
else
{
+ //关闭签字版
+ await PublicSign("close", 2, timeout);
if (type == "open" && typeCode == 1)
{
return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字失败" + "\"}";
@@ -206,21 +214,29 @@ namespace AksWebBrowser.Common
}
else if (jo2["code"].ToString() == "2")
{
+ //关闭签字版
+ await PublicSign("close", 2, timeout);
return "{\"timestamp\":\"" + "" + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "取消签字" + "\"}";
}
else
{
+ //关闭签字版
+ await PublicSign("close", 2, timeout);
//Log.Error("请求签字失败" + jo["message"].ToString());
return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字失败" + "\"}";
}
}
else
{
+ //关闭签字版
+ await PublicSign("close", 2, timeout);
return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"png\",\"data\":\"" + "关闭成功" + "\"}";
}
}
else
{
+ //关闭签字版
+ await PublicSign("close", 2, timeout);
if (type == "open" && typeCode == 1)
{
return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "签字失败" + "\"}";
@@ -233,6 +249,8 @@ namespace AksWebBrowser.Common
}
catch (Exception ex)
{
+ //关闭签字版
+ await PublicSign("close", 2, timeout);
if (ex.Message.Contains("HttpClient.Timeout"))
{
return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"suffix\":\"png\",\"data\":\"" + "在规定时间内未签字" + "\"}";
@@ -295,7 +313,6 @@ namespace AksWebBrowser.Common
JObject jo2 = (JObject)JsonConvert.DeserializeObject(ret);
if (jo2["code"].ToString() == "0")
{
- //读取data数据
//读取data数据
string data = jo["data"].ToString();
JObject jo3 = (JObject)JsonConvert.DeserializeObject(data);
@@ -341,7 +358,6 @@ namespace AksWebBrowser.Common
JObject jo2 = (JObject)JsonConvert.DeserializeObject(ret);
if (jo2["code"].ToString() == "0")
{
- //读取data数据
//读取data数据
string data = jo["data"].ToString();
JObject jo3 = (JObject)JsonConvert.DeserializeObject(data);
@@ -400,6 +416,7 @@ namespace AksWebBrowser.Common
//读取指纹
if (typeCode == 1)
{
+ await PublicFinger("close", 2, timeout);
//读取data数据
string data = jo["data"].ToString();
JObject jo3 = (JObject)JsonConvert.DeserializeObject(data);
@@ -412,12 +429,14 @@ namespace AksWebBrowser.Common
}
else
{
+ await PublicFinger("close", 2, timeout);
//关闭指纹
return "200";
}
}
else
{
+ await PublicFinger("close", 2, timeout);
//关闭指纹
return "200";
}
@@ -436,6 +455,7 @@ namespace AksWebBrowser.Common
jo2 = (JObject)JsonConvert.DeserializeObject(ret);
if (jo2["code"].ToString() == "0")
{
+ await PublicFinger("close", 2, timeout);
//读取指纹
if (typeCode == 1)
{
@@ -457,13 +477,15 @@ namespace AksWebBrowser.Common
}
else
{
+ await PublicFinger("close", 2, timeout);
return "";
}
}
- else { return ""; }
+ else { await PublicFinger("close", 2, timeout); return ""; }
}
else
{
+ await PublicFinger("close", 2, timeout);
//Log.Error("请求签字失败" + jo["message"].ToString());
return "";
}
@@ -471,11 +493,13 @@ namespace AksWebBrowser.Common
}
else
{
+ await PublicFinger("close", 2, timeout);
return "";
}
}
catch (Exception ex)
{
+ await PublicFinger("close", 2, timeout);
if (ex.Message.Contains("HttpClient.Timeout"))
{
return "HttpClient.Timeout";
@@ -529,7 +553,7 @@ namespace AksWebBrowser.Common
try
{
//关闭身份证
- await PublicIdcard(type, typeCode, timeout);
+ await PublicIdcard(timeout);
timeout = timeout == 0 ? Parame.timeout : timeout;
var client = new HttpClient();
client.Timeout = TimeSpan.FromSeconds(timeout);
@@ -549,6 +573,8 @@ namespace AksWebBrowser.Common
{
if (typeCode == 1)
{
+ //关闭身份证
+ await PublicIdcard(timeout);
//读取data数据
string data = jo["data"].ToString();
JObject jo3 = (JObject)JsonConvert.DeserializeObject(data);
@@ -575,23 +601,31 @@ namespace AksWebBrowser.Common
}
else
{
+ //关闭身份证
+ await PublicIdcard(timeout);
//关闭
return "200";
}
}
else
{
+ //关闭身份证
+ await PublicIdcard(timeout);
//Log.Error("请求签字失败" + jo["message"].ToString());
return "";
}
}
else
{
+ //关闭身份证
+ await PublicIdcard(timeout);
return "";
}
}
catch (Exception ex)
{
+ //关闭身份证
+ await PublicIdcard(timeout);
if (ex.Message.Contains("HttpClient.Timeout"))
{
return "HttpClient.Timeout";
@@ -610,7 +644,7 @@ namespace AksWebBrowser.Common
///
///
///
- public async Task PublicIdcard(string type, int typeCode, int timeout)
+ public async Task PublicIdcard(int timeout)
{
string body = string.Empty;
try
diff --git a/CPF_Cef/Devices/PrintPJ.cs b/CPF_Cef/Devices/PrintPJ.cs
index 8b89154..5b6265b 100644
--- a/CPF_Cef/Devices/PrintPJ.cs
+++ b/CPF_Cef/Devices/PrintPJ.cs
@@ -1,4 +1,5 @@
+using AksWebBrowser.Common;
using AKSWebBrowser.Commen;
using CPF.Windows;
using System;
diff --git a/CPF_Cef/MainModel.cs b/CPF_Cef/MainModel.cs
index b4b754a..3f2df32 100644
--- a/CPF_Cef/MainModel.cs
+++ b/CPF_Cef/MainModel.cs
@@ -66,6 +66,7 @@ namespace AksWebBrowser
{
try
{
+ Log.Info("接受参数:" + content);
var json = content.ConvertToAnonymousType(new
{
code = default(string)
@@ -164,7 +165,8 @@ namespace AksWebBrowser
case "aks100117":
result = ReadQuestionAnswer(content);
break;
- //读取问答:{ "code":"aks100118", "isCloseHttp":true,"data": "{}"}
+ //读取问答:{ "code":"
+ //", "isCloseHttp":true,"data": "{}"}
case "aks100118":
result = SendSQ(content);
break;
@@ -342,20 +344,14 @@ namespace AksWebBrowser
}
else
{
- PrintPJ print = new PrintPJ(Parame.pritPj, Parame.pritPjPort);
- var data = print.SendPrint(ph, ddrs, qrcode, ywmc);
- if (data == 0)
+ Task.Run(() =>
{
- 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 ? "打印机未连接" : "打印机初始化失败")) + "\"}";
- SubmitLogs(result, "SendByPrint");
- return result;
- }
+ PrintPJ print = new PrintPJ(Parame.pritPj, Parame.pritPjPort);
+ print.SendPrint(ph, ddrs, qrcode, ywmc);
+ });
+ string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + param.code + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"" + "已推送打印" + "\"}";
+ SubmitLogs(result, "SendByPrint");
+ return result;
}
}
catch (Exception ex)
@@ -415,6 +411,7 @@ namespace AksWebBrowser
Directory.CreateDirectory(dirpath);
}
var tempFile = dirpath + $"/{ywid}.wav";
+ //Log.Info("aks100103文字语音播报:" + tempFile);
string result = string.Empty;
if (!File.Exists(tempFile))
{
@@ -427,7 +424,13 @@ namespace AksWebBrowser
}
else
{
- Task.Run(() => { string command = $"sox {ttsStr} -d"; ShllCommad(command); });
+ Task.Run(() =>
+ {
+ string command = $"pkill sox";
+ ShllCommad(command);
+ command = $"sox {ttsStr} -d";
+ ShllCommad(command);
+ });
if (!string.IsNullOrEmpty(ywid))
{
string filename = Path.GetFileName(ttsStr);
@@ -1072,8 +1075,10 @@ namespace AksWebBrowser
{
try
{
- // 在你的窗口或应用程序需要时调用
- Bash("/usr/bin/python3 /usr/bin/onboard");
+ Task.Run(() => {
+ // 在你的窗口或应用程序需要时调用
+ Bash("/usr/bin/python3 /usr/bin/onboard");
+ });
return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"" + "唤醒键盘成功" + "\"}";
}
catch (Exception ex)
@@ -1702,9 +1707,9 @@ namespace AksWebBrowser
{
var httpClient = new HttpClient();
var uploader = new ChunkedUpload(httpClient);
- await uploader.PublicSign("close", 2, 5);
- await uploader.PublicFinger("close", 2, 5);
- await uploader.PublicIdcard("close", 2, 5);
+ await uploader.PublicSign("close", 2, 50);
+ await uploader.PublicFinger("close", 2, 50);
+ await uploader.PublicIdcard(50);
@event8.Set();
}
catch (Exception ex)
@@ -2183,7 +2188,7 @@ namespace AksWebBrowser
string zxjg = Bash(commod);
if (string.IsNullOrEmpty(zxjg))
{
- commod = "chmod -R 777 /data/home/aks/lhtserver/lhtserver && cd /data/home/aks/lhtserver/lhtserver && nohup ./LhtCamServer.sh &";
+ commod = "chmod -R 777 /opt/lhtserver/files/bin && cd /opt/lhtserver/files/bin && nohup ./LhtCamServer.sh &";
Bash(commod);
Task.Delay(3000).Wait();
}
@@ -2192,5 +2197,36 @@ namespace AksWebBrowser
catch { }
finally { }
}
+
+ ///
+ /// 播放文件
+ ///
+ ///
+ public static void PlayMedia(string filePath)
+ {
+ ProcessStartInfo startInfo = new ProcessStartInfo
+ {
+ FileName = "mplayer",
+ Arguments = $"{filePath} -slave -quiet",
+ UseShellExecute = false,
+ RedirectStandardInput = true,
+ RedirectStandardOutput = true,
+ CreateNoWindow = true
+ };
+
+ using (Process process = Process.Start(startInfo))
+ {
+ using (var sw = process.StandardInput)
+ {
+ if (sw.BaseStream.CanWrite)
+ {
+ sw.WriteLine("loadfile \"your_media_file.mp3\"");
+ sw.WriteLine("play");
+ }
+ }
+
+ process.WaitForExit();
+ }
+ }
}
}