瀏覽代碼

判断接口拦截返回数据,是否包含status

lcl 1 年之前
父節點
當前提交
372e710220
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      Areas/Api/Controllers/OutApiController.cs

+ 6 - 3
Areas/Api/Controllers/OutApiController.cs

@@ -130,10 +130,13 @@ namespace MySystem.Areas.Api.Controllers.v1
             string url = AppConfig.Base.ApHost + "api/v1/" + c1 + "/" + c2 + hasDo;
             string url = AppConfig.Base.ApHost + "api/v1/" + c1 + "/" + c2 + hasDo;
             function.WriteLog(url, "接口转发日志");
             function.WriteLog(url, "接口转发日志");
             string result = function.PostWebRequest(url, "value=" + value);
             string result = function.PostWebRequest(url, "value=" + value);
-            function.WriteLog(result, "接口转发日志");
+            function.WriteLog(str: result, "接口转发日志");
             JsonData data = JsonMapper.ToObject(result);
             JsonData data = JsonMapper.ToObject(result);
-            //{"info":"","data":[{"BrandName":"\u76D2\u6613\u4ED8","IconFileName":"hyf","SubData":{"\u73AF\u8FC5":"0","\u6613\u751F":"0","\u6D77\u79D1":"0","\u4E2D\u4ED8":"0"}}],"other":null,"status":"1","timestamp":0}
-            return Json(new AppResultJson() { Status = data["status"].ToString(), Data = data["data"].ToJson(), Info = data["info"].ToString(), Other = data["other"] == null ? "" : data["other"].ToJson(), Timestamp = int.Parse(function.CheckInt(data["timestamp"].ToString())) });
+            if(result.Contains("\"status\""))
+            {
+                return Json(new AppResultJson() { Status = data["status"].ToString(), Data = data["data"].ToJson(), Info = data["info"].ToString(), Other = data["other"] == null ? "" : data["other"].ToJson(), Timestamp = int.Parse(function.CheckInt(data["timestamp"].ToString())) });
+            }
+            return Json(new AppResultJson() { Status = "1", Data = result, Info = "" });
         }
         }
     }
     }
 }
 }