From 770ecd9c76edb6e99e4bf1d4b1159a7b81b199c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=BA=20=E6=9D=A8?= Date: Tue, 28 Nov 2023 17:32:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=87=E9=A2=98=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E7=94=A8=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Temp/SplitQuestion.aspx.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Temp/SplitQuestion.aspx.cs b/Temp/SplitQuestion.aspx.cs index fdcc2a8..5d43a2d 100644 --- a/Temp/SplitQuestion.aspx.cs +++ b/Temp/SplitQuestion.aspx.cs @@ -76,7 +76,7 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page long subjective = Convert.ToInt64(Globals.Request("subjective")); var checkResult = CheckStatusByApi(subjective); - if (!checkResult.data) + if (!checkResult.data.Value) { Response.Write("验证失败!" + checkResult.message); return; @@ -188,7 +188,11 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page //调用接口 //result r = (result)JsonConvert.DeserializeObject(RequestPost(subjective.ToString(), lt.ToJsonString()), typeof(result)); var r = JsonConvert.DeserializeObject(RequestPost(subjective.ToString(), JsonConvert.SerializeObject(lt))); - if (r.code == "200" && r.data) + if (r == null || r.code != "200") + { + throw new Exception("调用接口失败了!"); + } + if (r.code == "200" && r.data.Value) { Response.Write("1"); } @@ -409,7 +413,7 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page if (Request.Url.Host.ToLower().Contains("w.23544.com")) { // 测试地址 - url = "http://mka.w.23544.com:8880/"; + url = "https://mka.w.23544.com:8843/"; bearer = token; } else if (Request.Url.Host.ToLower().Contains("23544.com")) @@ -441,7 +445,12 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page } //return (result)JsonConvert.DeserializeObject(reponse.Html, typeof(result)); - return JsonConvert.DeserializeObject(reponse.Html); + var ress = JsonConvert.DeserializeObject(reponse.Html); + if (ress == null || ress.code != "200") + { + throw new Exception("验证接口调用失败!" + Response.StatusCode + " ||| " + reponse.Html); + } + return ress; } private string RequestPost(string id, string body) { @@ -451,7 +460,7 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page if (Request.Url.Host.ToLower().Contains("w.23544.com")) { // 测试地址 - url = "http://mka.w.23544.com:8880/"; + url = "https://mka.w.23544.com:8843/"; bearer = token; } else if (Request.Url.Host.ToLower().Contains("23544.com")) @@ -510,7 +519,7 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page public string message { get; set; } public string code { get; set; } - public bool data { get; set; } + public bool? data { get; set; } }