李昊 4 年 前
コミット
b18e1b38d5
共有1 個のファイルを変更した5 個の追加8 個の削除を含む
  1. 5 8
      GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

+ 5 - 8
GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -26,6 +26,7 @@ using GxPress.Result.App.User;
 using GxPress.Result.Job;
 using GxPress.Common.Http;
 using System.Net;
+using System.Threading;
 
 namespace GxPress.Repository.Implement
 {
@@ -655,14 +656,9 @@ namespace GxPress.Repository.Implement
                 // {
                 //     ServerCertificateCustomValidationCallback = (message, certificate2, arg3, arg4) => true
                 // };
-                // HttpClientHandler clientHandler = new HttpClientHandler();
-                // clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
-
-                var httpClientHandler = new HttpClientHandler();
-                // Return `true` to allow certificates that are untrusted/invalid
-                httpClientHandler.ServerCertificateCustomValidationCallback =
-        HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
-                HttpClient httpClient = new HttpClient(httpClientHandler); //http对象
+                HttpClientHandler clientHandler = new HttpClientHandler();
+                clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
+                HttpClient httpClient = new HttpClient(clientHandler); //http对象
                 HttpResponseMessage response = await httpClient.PostAsync(
                     $"{imServiceUrl}/users",
                     new JsonContent(new { username = request.Phone, password = "123456", nickname = request.Name }));
@@ -673,6 +669,7 @@ namespace GxPress.Repository.Implement
                     var userEntity = await GetByPhoneAsync(request.Phone);
                     userEntity.ImId = request.Phone;
                     await _repository.UpdateAsync(userEntity);
+                    Thread.Sleep(1000);
                 }
                 else
                 {