|
@@ -27,6 +27,8 @@ using GxPress.Result.Job;
|
|
|
using GxPress.Common.Http;
|
|
|
using System.Net;
|
|
|
using System.Threading;
|
|
|
+using Newtonsoft.Json.Linq;
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
|
|
|
namespace GxPress.Repository.Implement
|
|
|
{
|
|
@@ -37,13 +39,15 @@ namespace GxPress.Repository.Implement
|
|
|
private readonly Repository<Role> _roleRepository;
|
|
|
private readonly IMapper _mapper;
|
|
|
private readonly IWebHostEnvironment _environment;
|
|
|
+
|
|
|
+ private readonly ILogger<UserRepository> _logger;
|
|
|
private readonly IDistributedCache _cache;
|
|
|
//private readonly string _connectionString;
|
|
|
//private readonly string _databaseTypestr;
|
|
|
private readonly string _connectionString;
|
|
|
private readonly string _databaseTypeStr;
|
|
|
public UserRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper,
|
|
|
- IWebHostEnvironment environment, IDistributedCache cache)
|
|
|
+ IWebHostEnvironment environment, IDistributedCache cache,ILogger<UserRepository> logger)
|
|
|
{
|
|
|
_databaseTypeStr = dbOptionsAccessor.CurrentValue.DatabaseType;
|
|
|
_connectionString = dbOptionsAccessor.CurrentValue.ConnectionString;
|
|
@@ -59,6 +63,7 @@ namespace GxPress.Repository.Implement
|
|
|
_roleRepository = new Repository<Role>(database);
|
|
|
_mapper = mapper;
|
|
|
_cache = cache;
|
|
|
+ _logger=logger;
|
|
|
}
|
|
|
|
|
|
public IDatabase Database => _repository.Database;
|
|
@@ -665,6 +670,12 @@ namespace GxPress.Repository.Implement
|
|
|
if (response.IsSuccessStatusCode)
|
|
|
{
|
|
|
string result = await response.Content.ReadAsStringAsync();
|
|
|
+ _logger.LogDebug(result);
|
|
|
+ _logger.LogError(result);
|
|
|
+ var model = JsonConvert.DeserializeObject<dynamic>(result);
|
|
|
+ var entities = model["entities"];
|
|
|
+ var jtokenEntities = (JToken)entities;
|
|
|
+ request.Phone = jtokenEntities[0]["username"].ToString();
|
|
|
//成功后修改用户
|
|
|
var userEntity = await GetByPhoneAsync(request.Phone);
|
|
|
userEntity.ImId = request.Phone;
|