[HttpPost]
public object GetCardInfo([FromBody]string files)
{
try
{
Credential cred = new Credential
{
SecretId = "xxxx",
SecretKey = "xxxx"
};
ClientProfile clientProfile = new ClientProfile();
HttpProfile httpProfile = new HttpProfile();
httpProfile.Endpoint = ("ocr.tencentcloudapi.com");
clientProfile.HttpProfile = httpProfile;
OcrClient client = new OcrClient(cred, "ap-guangzhou", clientProfile);
BusinessCardOCRRequest req = new BusinessCardOCRRequest();
string strParams = "{\"ImageBase64\":\"" + files + "\"}";
req = BusinessCardOCRRequest.FromJsonString<BusinessCardOCRRequest>(strParams);
** BusinessCardOCRResponse resp = client.BusinessCardOCR(req).ConfigureAwait(false).GetAwaiter().GetResult();**
return AbstractModel.ToJsonString(resp);
}
catch (Exception ex)
{
APP_Menber.SaveException(ex.ToString(), "GetCardInfo");
return ex.ToString();
}
}
执行到下面句代码时就停了,也不报异常(控制台程序测试又是正常的)
BusinessCardOCRResponse resp = client.BusinessCardOCR(req).ConfigureAwait(false).GetAwaiter().GetResult();
function ssss(_data) {
console.log(_data.split(',')[1])
mui.ajax(api_url + "/api/YDLCRM/Card/GetCardInfo", {
data: {
"": _data.split(',')[1] || ''
},
type: "post",
success: function(data) {
alert(1)
console.log(JSON.stringify(data));
},
error: function(ex, ex1, ex2) {
alert(2)
console.log(JSON.stringify(ex) + JSON.stringify(ex1) + JSON.stringify(ex2));
}
})
}