Przeglądaj źródła

解决验证PIN码失败的问题

Li 3 lat temu
rodzic
commit
fc3a5e7972

Plik diff jest za duży
+ 26 - 446
TEAMModeBI/Controllers/BIHome/StudyStatisController.cs


+ 18 - 11
TEAMModeBI/Controllers/LoginController.cs

@@ -317,18 +317,25 @@ namespace TEAMModeBI.Controllers
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             {
                 string responseBody = await responseMessage.Content.ReadAsStringAsync();
-                var json = responseBody.ToObject<JsonElement>().GetProperty("resule").ToString();
-
-                string[] mobules = json.Split("-");
-                string temp_mobile = mobules.Length >= 2 ? mobules[1] : mobules[0];
-                if (mobile.ToString().Equals(temp_mobile))
-                {
-                     return Ok(new { status = 200, message = "手机号和验证码验证都过了" });
-                }
-                else
+                var json = responseBody.ToObject<JsonElement>();
+                json.TryGetProperty("resule", out JsonElement jsone);
+                if (!string.IsNullOrEmpty($"{jsone}"))
                 {
-                    return Ok(new { status = 1, message = "手机号码不正确" });
+                    string[] mobules = $"{jsone}".Split("-");
+                    string temp_mobile = mobules.Length >= 2 ? mobules[1] : mobules[0];
+                    if (mobile.ToString().Equals(temp_mobile))
+                    {
+                        return Ok(new { status = 200, message = "手机号和验证码验证都过了" });
+                    }
+                    else
+                    {
+                        return Ok(new { status = 5, message = "手机号码不正确" });
+                    }
                 }
+                else {
+
+                    return Ok(json);
+                }                
             }
             else
             {
@@ -554,7 +561,7 @@ namespace TEAMModeBI.Controllers
             {
                 return Ok(new
                 {
-                    status = 4,
+                    status = 1,
                     location = _option.Location                    
                 });
             }