修改多时区问题解决
parent
ca90736366
commit
64b750b06e
|
@ -50,18 +50,10 @@ namespace IRaCIS.Core.API
|
||||||
|
|
||||||
DateTime dateTime;
|
DateTime dateTime;
|
||||||
|
|
||||||
if (reader.ValueType == typeof(string))
|
if (DateTime.TryParse((string)reader.Value, out dateTime) == false)
|
||||||
{
|
{
|
||||||
if (DateTime.TryParse((string)reader.Value, out dateTime) == false)
|
return null;
|
||||||
{
|
|
||||||
throw new JsonSerializationException("Unable to parse DateTime value.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
dateTime = (DateTime)reader.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 将客户端时间转换为服务器时区的时间
|
// 将客户端时间转换为服务器时区的时间
|
||||||
var serverZoneTime = TimeZoneInfo.ConvertTime(dateTime, _clientTimeZone, TimeZoneInfo.Local);
|
var serverZoneTime = TimeZoneInfo.ConvertTime(dateTime, _clientTimeZone, TimeZoneInfo.Local);
|
||||||
|
|
|
@ -136,16 +136,23 @@ namespace IRaCIS.Application.Services.BackGroundJob
|
||||||
throw new BusinessValidationFailedException(StaticData.International("IRaCISCHangfireJob_FileNotFound"));
|
throw new BusinessValidationFailedException(StaticData.International("IRaCISCHangfireJob_FileNotFound"));
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemWatcher watcher = new FileSystemWatcher(Path.GetDirectoryName(filePath), Path.GetFileName(filePath));
|
var watcher = new FileSystemWatcher
|
||||||
|
{
|
||||||
|
Path = Path.GetDirectoryName(filePath)!,
|
||||||
|
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size|NotifyFilters.LastAccess,
|
||||||
|
Filter = Path.GetFileName(filePath),
|
||||||
|
EnableRaisingEvents = true,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
watcher.Changed += (sender, e) => LoadJsonFile(filePath);
|
watcher.Changed += (sender, e) => LoadJsonFile(filePath);
|
||||||
watcher.EnableRaisingEvents = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void LoadJsonFile(string filePath)
|
private void LoadJsonFile(string filePath)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("刷新json内存数据");
|
||||||
IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile(filePath,false,true);
|
IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile(filePath,false,true);
|
||||||
|
|
||||||
IConfigurationRoot enConfiguration = builder.Build();
|
IConfigurationRoot enConfiguration = builder.Build();
|
||||||
|
|
|
@ -45,8 +45,6 @@ namespace IRaCIS.Application.Services
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Subject? mapedSubject = null;
|
Subject? mapedSubject = null;
|
||||||
|
|
||||||
if (subjectCommand.Id == null) //insert
|
if (subjectCommand.Id == null) //insert
|
||||||
|
@ -64,8 +62,6 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await _subjectRepository.SaveChangesAsync();
|
await _subjectRepository.SaveChangesAsync();
|
||||||
|
|
||||||
return ResponseOutput.Ok(mapedSubject.Id.ToString());
|
return ResponseOutput.Ok(mapedSubject.Id.ToString());
|
||||||
|
|
Loading…
Reference in New Issue