CrazyIter_Bin 4 月之前
父节点
当前提交
3148735adb
共有 1 个文件被更改,包括 16 次插入8 次删除
  1. 16 8
      TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Controllers/IndexController.cs

+ 16 - 8
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Controllers/IndexController.cs

@@ -172,25 +172,33 @@ namespace IES.ExamServer.Controllers
                             {
                             {
                                 string randomCode = $"{json["randomCode"]}";
                                 string randomCode = $"{json["randomCode"]}";
                                 System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
                                 System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
-
-                                var response = await _httpClientFactory.CreateClient().GetAsync($"{CenterUrl}/core/qrcode/check?randomcode={randomCode}&school={school?.id}&client=ExamServer");
-                                if (response.IsSuccessStatusCode)
+                                var rc= _memoryCache.Get<string>($"Login:ExamServer:{school?.id}:{randomCode}");
+                                if (!string.IsNullOrWhiteSpace(rc))
                                 {
                                 {
-                                    string content = await response.Content.ReadAsStringAsync();
-                                    if (!string.IsNullOrWhiteSpace(content))
+                                    var response = await _httpClientFactory.CreateClient().GetAsync($"{CenterUrl}/core/qrcode/check?randomcode={randomCode}&school={school?.id}&client=ExamServer");
+                                    if (response.IsSuccessStatusCode)
                                     {
                                     {
-                                        jsonNode = content.ToObject<JsonNode>();
+                                        string content = await response.Content.ReadAsStringAsync();
+                                        if (!string.IsNullOrWhiteSpace(content))
+                                        {
+                                            jsonNode = content.ToObject<JsonNode>();
+                                        }
+                                        else
+                                        {
+                                            code=400;
+                                            msg="随机码验证失败";
+                                        }
                                     }
                                     }
                                     else
                                     else
                                     {
                                     {
                                         code=400;
                                         code=400;
-                                        msg="随机码验证失败";
+                                        msg="随机码验证错误";
                                     }
                                     }
                                 }
                                 }
                                 else
                                 else
                                 {
                                 {
                                     code=400;
                                     code=400;
-                                    msg="随机码验证错误";
+                                    msg="二维码过期";
                                 }
                                 }
                                 break;
                                 break;
                             }
                             }