Browse Source

高拍仪分离拍照和关闭动作

master
胡超1 1 year ago
parent
commit
89a38e080a
  1. 75
      CPF_Cef/MainModel.cs

75
CPF_Cef/MainModel.cs

@ -1,36 +1,21 @@
using AksWebBrowser;
using AksWebBrowser.Common;
using AksWebBrowser.Common;
using AksWebBrowser.Devices;
using AKSWebBrowser.Commen;
using CPF;
using CPF.Cef;
using CPF.Controls;
using CPF.Linux;
using CPF.Windows;
using Fleck;
using LibVLCSharp.Shared;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SkiaSharp;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.WebSockets;
using System.Reflection.Metadata;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Xml.Linq;
using static System.Net.Mime.MediaTypeNames;
namespace AksWebBrowser
{
@ -108,6 +93,11 @@ namespace AksWebBrowser
result = openCamera(keycode);
//Log.Info("打开高拍仪并且进行快速扫描文件返回:" + result);
break;
//打开高拍仪并且进行快速扫描文件关闭 {"code":"aks100121"}
case "aks100121":
result = StopSn(keycode);
//Log.Info("打开高拍仪并且进行快速扫描文件关闭:" + result);
break;
//aks100105
//打开签字版 {"code":"aks100105"}
case "aks100105":
@ -599,7 +589,7 @@ namespace AksWebBrowser
//拍照
param = getFrame();
Task.Delay(1000).Wait();
Log.Info("拍照结果img2:" + (param));
//Log.Info("拍照结果img2:" + (param));
if (string.IsNullOrEmpty(param))
{
//关闭
@ -611,8 +601,6 @@ namespace AksWebBrowser
else
{
string base64 = Utils.ImagesByRotate(param, 90);
//关闭
StopSn(devindex);
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + param + "\"}";
SubmitLogs(result, "openCamera");
return result;
@ -1461,29 +1449,48 @@ namespace AksWebBrowser
/// 关闭高拍仪
/// </summary>
/// <returns></returns>
public static string StopSn(string dev_idx)
public static string StopSn(string code)
{
//获取设备信息
string param = "/StopPreview?dev_idx=" + dev_idx;
Task.Run(() => HttpResponse(param));
@event6.WaitOne();
if (string.IsNullOrEmpty(gpyStr))
{
return "";
}
else
try
{
JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
if (jo["returnCode"].ToString() == "2" || jo["returnCode"].ToString() == "0")
string devindex = GetSnIndex();
if (string.IsNullOrEmpty(devindex))
{
return "200";
devindex = Parame.gpydevIndex;
}
//获取设备信息
string param = "/StopPreview?dev_idx=" + devindex;
Task.Run(() => HttpResponse(param));
@event6.WaitOne();
if (string.IsNullOrEmpty(gpyStr))
{
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "关闭高拍仪失败" + "\"}";
SubmitLogs(result, "openCamera");
return result;
}
else
{
// // Log.Info(jo["returnMsg"].ToString());
return "";
JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
if (jo["returnCode"].ToString() == "2" || jo["returnCode"].ToString() == "0")
{
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "关闭高拍仪成功" + "\"}";
SubmitLogs(result, "openCamera");
return result;
}
else
{
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "关闭高拍仪失败" + "\"}";
SubmitLogs(result, "openCamera");
return result;
}
}
}
catch (Exception ex)
{
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"" + ex.Message + "\"}";
SubmitLogs(result, "openCamera");
return result;
}
}
/// <summary>

Loading…
Cancel
Save