|
|
@ -138,7 +138,7 @@ namespace AksWebBrowser.Common |
|
|
|
{ |
|
|
|
{ |
|
|
|
//关闭签字版 |
|
|
|
//关闭签字版 |
|
|
|
await PublicSign("close", 2, timeout); |
|
|
|
await PublicSign("close", 2, timeout); |
|
|
|
Task.Delay(1000).Wait(); |
|
|
|
Task.Delay(500).Wait(); |
|
|
|
string body = await PublicSign(type, typeCode, timeout); |
|
|
|
string body = await PublicSign(type, typeCode, timeout); |
|
|
|
if (!string.IsNullOrEmpty(body)) |
|
|
|
if (!string.IsNullOrEmpty(body)) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -160,10 +160,10 @@ namespace AksWebBrowser.Common |
|
|
|
} |
|
|
|
} |
|
|
|
else if (jo2["code"].ToString() == "1") |
|
|
|
else if (jo2["code"].ToString() == "1") |
|
|
|
{ |
|
|
|
{ |
|
|
|
Task.Delay(1000).Wait(); |
|
|
|
Task.Delay(500).Wait(); |
|
|
|
//关闭签字版 |
|
|
|
//关闭签字版 |
|
|
|
await PublicSign("close", 2, timeout); |
|
|
|
await PublicSign("close", 2, timeout); |
|
|
|
Task.Delay(1000).Wait(); |
|
|
|
Task.Delay(500).Wait(); |
|
|
|
//打开签字版 |
|
|
|
//打开签字版 |
|
|
|
body = await PublicSign(type, typeCode, timeout); |
|
|
|
body = await PublicSign(type, typeCode, timeout); |
|
|
|
if (!string.IsNullOrEmpty(body)) |
|
|
|
if (!string.IsNullOrEmpty(body)) |
|
|
@ -251,7 +251,7 @@ namespace AksWebBrowser.Common |
|
|
|
/// <param name="typeCode"></param> |
|
|
|
/// <param name="typeCode"></param> |
|
|
|
/// <param name="timeout"></param> |
|
|
|
/// <param name="timeout"></param> |
|
|
|
/// <returns></returns> |
|
|
|
/// <returns></returns> |
|
|
|
public static async Task<string> PublicSign(string type, int typeCode, int timeout) |
|
|
|
public async Task<string> PublicSign(string type, int typeCode, int timeout) |
|
|
|
{ |
|
|
|
{ |
|
|
|
string body = string.Empty; |
|
|
|
string body = string.Empty; |
|
|
|
timeout = timeout == 0 ? Parame.timeout : timeout; |
|
|
|
timeout = timeout == 0 ? Parame.timeout : timeout; |
|
|
@ -385,14 +385,17 @@ namespace AksWebBrowser.Common |
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
await PublicFinger("close", 2, timeout); |
|
|
|
await PublicFinger("close", 2, timeout); |
|
|
|
Task.Delay(1000).Wait(); |
|
|
|
Task.Delay(500).Wait(); |
|
|
|
string body = await PublicFinger(type, typeCode, timeout); |
|
|
|
string body = await PublicFinger(type, typeCode, timeout); |
|
|
|
if (!string.IsNullOrEmpty(body)) |
|
|
|
if (!string.IsNullOrEmpty(body)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
JObject jo = (JObject)JsonConvert.DeserializeObject(body); |
|
|
|
JObject jo = (JObject)JsonConvert.DeserializeObject(body); |
|
|
|
string ret = jo["ret_info"].ToString(); |
|
|
|
string ret = jo["ret_info"].ToString(); |
|
|
|
JObject jo2 = (JObject)JsonConvert.DeserializeObject(ret); |
|
|
|
JObject jo2 = (JObject)JsonConvert.DeserializeObject(ret); |
|
|
|
if (jo2["code"].ToString() == "0") |
|
|
|
if (jo2["code"].ToString() == "0") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (type == "open" && typeCode == 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//读取指纹 |
|
|
|
//读取指纹 |
|
|
|
if (typeCode == 1) |
|
|
|
if (typeCode == 1) |
|
|
@ -413,11 +416,18 @@ namespace AksWebBrowser.Common |
|
|
|
return "200"; |
|
|
|
return "200"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
//关闭指纹 |
|
|
|
|
|
|
|
return "200"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
else if (jo2["code"].ToString() == "1") |
|
|
|
else if (jo2["code"].ToString() == "1") |
|
|
|
{ |
|
|
|
{ |
|
|
|
Task.Delay(1000).Wait(); |
|
|
|
Task.Delay(500).Wait(); |
|
|
|
body = await PublicFinger("close", 2, timeout); |
|
|
|
body = await PublicFinger("close", 2, timeout); |
|
|
|
Task.Delay(1000).Wait(); |
|
|
|
Task.Delay(500).Wait(); |
|
|
|
body = await PublicFinger(type, typeCode, timeout); |
|
|
|
body = await PublicFinger(type, typeCode, timeout); |
|
|
|
if (!string.IsNullOrEmpty(body)) |
|
|
|
if (!string.IsNullOrEmpty(body)) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -457,6 +467,7 @@ namespace AksWebBrowser.Common |
|
|
|
//Log.Error("请求签字失败" + jo["message"].ToString()); |
|
|
|
//Log.Error("请求签字失败" + jo["message"].ToString()); |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
@ -483,7 +494,7 @@ namespace AksWebBrowser.Common |
|
|
|
/// <param name="typeCode"></param> |
|
|
|
/// <param name="typeCode"></param> |
|
|
|
/// <param name="timeout"></param> |
|
|
|
/// <param name="timeout"></param> |
|
|
|
/// <returns></returns> |
|
|
|
/// <returns></returns> |
|
|
|
public static async Task<string> PublicFinger(string type, int typeCode, int timeout) |
|
|
|
public async Task<string> PublicFinger(string type, int typeCode, int timeout) |
|
|
|
{ |
|
|
|
{ |
|
|
|
string body = string.Empty; |
|
|
|
string body = string.Empty; |
|
|
|
timeout = timeout == 0 ? Parame.timeout : timeout; |
|
|
|
timeout = timeout == 0 ? Parame.timeout : timeout; |
|
|
@ -616,5 +627,30 @@ namespace AksWebBrowser.Common |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 公共读取指纹 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="type"></param> |
|
|
|
|
|
|
|
/// <param name="typeCode"></param> |
|
|
|
|
|
|
|
/// <param name="timeout"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
public async Task<string> PublicIdcard(string type, int typeCode, int timeout) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
string body = string.Empty; |
|
|
|
|
|
|
|
timeout = timeout == 0 ? Parame.timeout : timeout; |
|
|
|
|
|
|
|
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\": \"close\",\r\n \"operation_code\": 2,\r\n \"parameters\": {\r\n }\r\n }\r\n}", null, "text/plain"); |
|
|
|
|
|
|
|
request.Content = content; |
|
|
|
|
|
|
|
var response = await client.SendAsync(request); |
|
|
|
|
|
|
|
response.EnsureSuccessStatusCode(); |
|
|
|
|
|
|
|
if (response.StatusCode.ToString() == "OK") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
body = await response.Content.ReadAsStringAsync(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return body; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|