Commit 63c31015 LN

提示修改。

1 个父辈 1a53db0c
...@@ -42,35 +42,33 @@ namespace BLL ...@@ -42,35 +42,33 @@ namespace BLL
string result = ""; string result = "";
try try
{ {
string body=JsonConvert.SerializeObject (paramMap); string body = JsonConvert.SerializeObject(paramMap);
result = Model.Http.PostWithHeader(apiUrl, body, new Dictionary<string, string>()); result = Model.Http.PostWithHeader(apiUrl, body, new Dictionary<string, string>());
LogNet.log.Info("获取Fuji的token结果为:" + result); LogNet.log.Info("获取Fuji的token结果为:" + result);
Dictionary<string, object> resultObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(result); Dictionary<string, object> resultObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(result);
if (resultObj != null && resultObj.ContainsKey("accessToken")) if (resultObj != null && resultObj.ContainsKey("accessToken"))
{ {
accessToken = resultObj["accessToken"].ToString(); accessToken = resultObj["accessToken"].ToString();
if (String.IsNullOrEmpty(accessToken))
{
errMsg = "accessToken is null";
}
} }
else else
{ {
errMsg = accessToken; errMsg = "result="+ result;
LogNet.log.Info("获取Fuji的token失败,原因:" + errMsg); LogNet.log.Info("获取Fuji的token失败,原因:" + errMsg);
} }
return accessToken;
} }
catch (Exception e) catch (Exception e)
{ {
errMsg = e.ToString(); errMsg = e.Message;
LogNet.log.Info("获取Fuji的token异常:", e); LogNet.log.Info("获取Fuji的token异常:", e);
accessToken = ""; return accessToken;
} }
string status = "";
if (String.IsNullOrEmpty(accessToken))
{
errMsg = "accessToken is null";
status = ERROE;
}
return accessToken;
} }
private string getReelInfo(Dictionary<string, string> reelData, string key) private string getReelInfo(Dictionary<string, string> reelData, string key)
...@@ -127,7 +125,7 @@ namespace BLL ...@@ -127,7 +125,7 @@ namespace BLL
if (String.IsNullOrEmpty(token)) if (String.IsNullOrEmpty(token))
{ {
//获取token为空 //获取token为空
msg = "getAccessToken fail:" + errmsg; msg = "getAccessToken fail:\r\n" + errmsg;
LogNet.log.Info("getAccessToken fail"); LogNet.log.Info("getAccessToken fail");
return false; return false;
} }
...@@ -182,18 +180,18 @@ namespace BLL ...@@ -182,18 +180,18 @@ namespace BLL
{ {
string details = resultObj["details"].ToString(); string details = resultObj["details"].ToString();
msg ="Register new did failed: "+ details; msg ="Register new did failed: "+ details+"\r\n result="+result;
} }
else else
{ {
msg = "Register new did failed, result is null or not contains details "; msg = "Register new did failed : \r\n"+result;
} }
} }
catch (Exception e) catch (Exception e)
{ {
//改为英文提示 //改为英文提示
msg = "Register new did failed, exception message:" + e.ToString(); msg = "Register new did failed:" + e.Message;
LogNet.log.Info("注册Fuji的did失败:", e); LogNet.log.Info("注册Fuji的did失败:", e);
} }
return false; return false;
......
...@@ -136,6 +136,11 @@ namespace Model ...@@ -136,6 +136,11 @@ namespace Model
request.AddJsonBody(body); request.AddJsonBody(body);
IRestResponse response = client.Execute(request); IRestResponse response = client.Execute(request);
if (response.ErrorException != null)
{
LogNet.log.Error("[Post]URL:" + url + " Error: " + response.ErrorException.ToString());
throw response.ErrorException;
}
string s = response.Content; string s = response.Content;
LogNet.log.Info("[Post]URL:" + url + "Return:" + s); LogNet.log.Info("[Post]URL:" + url + "Return:" + s);
return FormatContent(s); return FormatContent(s);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!