|
@@ -16,6 +16,7 @@ namespace GxPress.Service.Implement
|
|
|
private readonly IConfiguration _configuration;
|
|
|
|
|
|
private readonly Repository<UserLogin> _repository;
|
|
|
+ private readonly Repository<User> _userRepository;
|
|
|
|
|
|
public ApiLogService(IConfiguration configuration, IOptionsMonitor<DatabaseOptions> dbOptionsAccessor)
|
|
|
{
|
|
@@ -25,6 +26,7 @@ namespace GxPress.Service.Implement
|
|
|
//_connectionString = dbOptionsAccessor.CurrentValue.ConnectionString;
|
|
|
var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
|
|
|
_repository = new Repository<UserLogin>(database);
|
|
|
+ _userRepository = new Repository<User>(database);
|
|
|
}
|
|
|
|
|
|
public async void DataSave(HttpContext context, long responseTime, int userId)
|
|
@@ -43,7 +45,7 @@ namespace GxPress.Service.Implement
|
|
|
var _reader = new StreamReader(context.Request.Body);
|
|
|
requestBody = _reader.ReadToEnd();
|
|
|
}
|
|
|
- var model=new UserLogin
|
|
|
+ var model = new UserLogin
|
|
|
{
|
|
|
AccessToken = accessToken,
|
|
|
AccessTime = DateTime.Now,
|
|
@@ -57,6 +59,8 @@ namespace GxPress.Service.Implement
|
|
|
UserId = userId
|
|
|
};
|
|
|
await _repository.InsertAsync(model);
|
|
|
+ //
|
|
|
+ await _userRepository.UpdateAsync(Q.Where(nameof(User.Id), userId).Set(nameof(User.LoginTime), DateTime.Now));
|
|
|
//}
|
|
|
}
|
|
|
}
|