|
|
@ -123,7 +123,7 @@ namespace AksWebBrowser.Common |
|
|
|
} |
|
|
|
} |
|
|
|
catch (HttpRequestException e) |
|
|
|
catch (HttpRequestException e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//Log.Error(" get请求: " + e.Message); |
|
|
|
Log.Error(" get请求: " + e.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -250,6 +250,7 @@ namespace AksWebBrowser.Common |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Log.Error("获取签字版数据异常:" + ex.Message); |
|
|
|
//关闭签字版 |
|
|
|
//关闭签字版 |
|
|
|
await PublicSign("close", 2, timeout); |
|
|
|
await PublicSign("close", 2, timeout); |
|
|
|
if (ex.Message.Contains("HttpClient.Timeout")) |
|
|
|
if (ex.Message.Contains("HttpClient.Timeout")) |
|
|
@ -273,17 +274,24 @@ namespace AksWebBrowser.Common |
|
|
|
public 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; |
|
|
|
try |
|
|
|
var client = new HttpClient(); |
|
|
|
{ |
|
|
|
client.Timeout = TimeSpan.FromSeconds(timeout); |
|
|
|
timeout = timeout == 0 ? Parame.timeout : timeout; |
|
|
|
var request = new HttpRequestMessage(HttpMethod.Post, Parame.signUrl); |
|
|
|
var client = new HttpClient(); |
|
|
|
var content = new StringContent("{\r\n \"command\": \"sign\",\r\n \"command_num\": 111,\r\n \"data\": {\r\n \"operation\": \"" + type + "\",\r\n \"operation_code\": " + typeCode + ",\r\n \"parameters\": {\r\n \"data_type\": 1\r\n }\r\n }\r\n}", null, "application/json"); |
|
|
|
client.Timeout = TimeSpan.FromSeconds(timeout); |
|
|
|
request.Content = content; |
|
|
|
var request = new HttpRequestMessage(HttpMethod.Post, Parame.signUrl); |
|
|
|
var response = await client.SendAsync(request); |
|
|
|
var content = new StringContent("{\r\n \"command\": \"sign\",\r\n \"command_num\": 111,\r\n \"data\": {\r\n \"operation\": \"" + type + "\",\r\n \"operation_code\": " + typeCode + ",\r\n \"parameters\": {\r\n \"data_type\": 1\r\n }\r\n }\r\n}", null, "application/json"); |
|
|
|
response.EnsureSuccessStatusCode(); |
|
|
|
request.Content = content; |
|
|
|
if (response.StatusCode.ToString() == "OK") |
|
|
|
var response = await client.SendAsync(request); |
|
|
|
|
|
|
|
response.EnsureSuccessStatusCode(); |
|
|
|
|
|
|
|
if (response.StatusCode.ToString() == "OK") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
body = await response.Content.ReadAsStringAsync(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
body = await response.Content.ReadAsStringAsync(); |
|
|
|
Log.Error("签字版公共请求异常:" + ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
return body; |
|
|
|
return body; |
|
|
|
} |
|
|
|
} |
|
|
@ -298,6 +306,9 @@ namespace AksWebBrowser.Common |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (tts_text.Length <= 2000) |
|
|
|
if (tts_text.Length <= 2000) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
tts_text =Regex.Replace(tts_text, @" ", " ").Trim(); |
|
|
|
|
|
|
|
tts_text = Regex.Replace(tts_text, @"\s+", "").Trim(); |
|
|
|
|
|
|
|
Log.Info("处理后文字:"+tts_text); |
|
|
|
var client = new HttpClient(); |
|
|
|
var client = new HttpClient(); |
|
|
|
var request = new HttpRequestMessage(HttpMethod.Post, Parame.signUrl); |
|
|
|
var request = new HttpRequestMessage(HttpMethod.Post, Parame.signUrl); |
|
|
|
var content = new StringContent("{\r\n \"command\": \"tts\",\r\n \"command_num\": 201,\r\n \"data\": {\r\n \"operation\": \"text_to_wav\",\r\n \"operation_code\": 1,\r\n \"parameters\": {\r\n \"data_type\": 1,\r\n \"tts_text\": \"" + tts_text + "\"\r\n }\r\n }\r\n }", null, "application/json"); |
|
|
|
var content = new StringContent("{\r\n \"command\": \"tts\",\r\n \"command_num\": 201,\r\n \"data\": {\r\n \"operation\": \"text_to_wav\",\r\n \"operation_code\": 1,\r\n \"parameters\": {\r\n \"data_type\": 1,\r\n \"tts_text\": \"" + tts_text + "\"\r\n }\r\n }\r\n }", null, "application/json"); |
|
|
@ -389,6 +400,7 @@ namespace AksWebBrowser.Common |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Log.Error("文字转语音异常:" + ex.Message); |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -500,6 +512,7 @@ namespace AksWebBrowser.Common |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Log.Error("获取指纹异常:" + ex.Message); |
|
|
|
await PublicFinger("close", 2, timeout); |
|
|
|
await PublicFinger("close", 2, timeout); |
|
|
|
if (ex.Message.Contains("HttpClient.Timeout")) |
|
|
|
if (ex.Message.Contains("HttpClient.Timeout")) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -537,9 +550,9 @@ namespace AksWebBrowser.Common |
|
|
|
body = await response.Content.ReadAsStringAsync(); |
|
|
|
body = await response.Content.ReadAsStringAsync(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Log.Error("公共读取指纹异常:" + ex.Message); |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
return body; |
|
|
|
return body; |
|
|
@ -594,6 +607,8 @@ namespace AksWebBrowser.Common |
|
|
|
iDCardModel.StartDate = jo4["validity_begin"].ToString(); |
|
|
|
iDCardModel.StartDate = jo4["validity_begin"].ToString(); |
|
|
|
iDCardModel.EndDate = jo4["balidity_end"].ToString(); |
|
|
|
iDCardModel.EndDate = jo4["balidity_end"].ToString(); |
|
|
|
iDCardModel.ImageBase64 = "data:image/jpg;base64," + base64; |
|
|
|
iDCardModel.ImageBase64 = "data:image/jpg;base64," + base64; |
|
|
|
|
|
|
|
//当前刷身份证的人 |
|
|
|
|
|
|
|
Parame.ImgBase64 = base64; |
|
|
|
var OBJ = new |
|
|
|
var OBJ = new |
|
|
|
{ |
|
|
|
{ |
|
|
|
Data = iDCardModel |
|
|
|
Data = iDCardModel |
|
|
@ -625,6 +640,7 @@ namespace AksWebBrowser.Common |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Log.Error("读取身份证"+ex.Message); |
|
|
|
//关闭身份证 |
|
|
|
//关闭身份证 |
|
|
|
await PublicIdcard(timeout); |
|
|
|
await PublicIdcard(timeout); |
|
|
|
if (ex.Message.Contains("HttpClient.Timeout")) |
|
|
|
if (ex.Message.Contains("HttpClient.Timeout")) |
|
|
@ -663,8 +679,9 @@ namespace AksWebBrowser.Common |
|
|
|
body = await response.Content.ReadAsStringAsync(); |
|
|
|
body = await response.Content.ReadAsStringAsync(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Log.Error("公共读取身份证异常:" + ex.Message); |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
return body; |
|
|
|
return body; |
|
|
@ -695,14 +712,14 @@ namespace AksWebBrowser.Common |
|
|
|
body = await response.Content.ReadAsStringAsync(); |
|
|
|
body = await response.Content.ReadAsStringAsync(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Log.Error("获取问题异常:" + ex.Message); |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
return body; |
|
|
|
return body; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// 读取body数据 |
|
|
|
/// 读取body数据 |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|