去除引用common.props
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
using System.Globalization;
|
||||
using JNPF;
|
||||
using JNPF.API.Entry.Handlers;
|
||||
using JNPF.Common.Core.Filter;
|
||||
using JNPF.Common.Options;
|
||||
using JNPF.EventHandler;
|
||||
using JNPF.JsonSerialization;
|
||||
using JNPF.UnifyResult;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using OnceMi.AspNetCore.OSS;
|
||||
using JNPF.API.Entry.Handlers;
|
||||
using JNPF.Common.Cache;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
@@ -125,7 +120,7 @@ public static class ConfigureMvcControllerExtensions
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
public class MyNewtonsoftDateTimeJsonConverter : NewtonsoftDateTimeJsonConverter
|
||||
{
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
@@ -134,20 +129,20 @@ public static class ConfigureMvcControllerExtensions
|
||||
if (reader.TokenType == JsonToken.Null || string.IsNullOrEmpty(reader.Value.ToString()))
|
||||
{
|
||||
if (!flag)
|
||||
throw new JsonSerializationException(string.Format((IFormatProvider) CultureInfo.InvariantCulture, "Cannot convert null value to {0}.", (object) objectType));
|
||||
return (object) null;
|
||||
throw new JsonSerializationException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Cannot convert null value to {0}.", (object)objectType));
|
||||
return (object)null;
|
||||
}
|
||||
long result = 0;
|
||||
if (reader.TokenType == JsonToken.Integer)
|
||||
result = (long) reader.Value;
|
||||
result = (long)reader.Value;
|
||||
else if (reader.TokenType == JsonToken.String)
|
||||
{
|
||||
if (!long.TryParse((string) reader.Value, out result))
|
||||
return (object) Convert.ToDateTime(reader.Value.ToString());
|
||||
return reader.TokenType == JsonToken.Date ? reader.Value : throw new JsonSerializationException(string.Format((IFormatProvider) CultureInfo.InvariantCulture, "Unexpected token parsing date. Expected Integer or String, got {0}.", (object) reader.TokenType));
|
||||
if (!long.TryParse((string)reader.Value, out result))
|
||||
return (object)Convert.ToDateTime(reader.Value.ToString());
|
||||
return reader.TokenType == JsonToken.Date ? reader.Value : throw new JsonSerializationException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Unexpected token parsing date. Expected Integer or String, got {0}.", (object)reader.TokenType));
|
||||
}
|
||||
if (result < 0L)
|
||||
return (object) DateTime.Now;
|
||||
return (object)DateTime.Now;
|
||||
try
|
||||
{
|
||||
DateTime dt = Convert.ToDateTime(reader.Value.ToString());
|
||||
@@ -158,7 +153,7 @@ public static class ConfigureMvcControllerExtensions
|
||||
DateTimeOffset dateTimeOffset = DateTimeOffset.FromUnixTimeMilliseconds(result);
|
||||
dateTimeOffset = dateTimeOffset.ToLocalTime();
|
||||
DateTime dateTime = dateTimeOffset.DateTime;
|
||||
return (flag ? Nullable.GetUnderlyingType(objectType) : objectType) == typeof (DateTimeOffset) ? (object) new DateTimeOffset(dateTime, TimeSpan.Zero) : (object) dateTime;
|
||||
return (flag ? Nullable.GetUnderlyingType(objectType) : objectType) == typeof(DateTimeOffset) ? (object)new DateTimeOffset(dateTime, TimeSpan.Zero) : (object)dateTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user