优化切题接口调用提示

This commit is contained in:
强 杨 2023-11-28 17:32:49 +08:00
parent f08a432dc3
commit 770ecd9c76
1 changed files with 15 additions and 6 deletions

View File

@ -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<result>(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<result>(reponse.Html);
var ress = JsonConvert.DeserializeObject<result>(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; }
}