feat: 完善各个模块功能

This commit is contained in:
橙子
2023-02-19 16:49:11 +08:00
parent 8eda2cd814
commit e6f95d0cd8
28 changed files with 260 additions and 334 deletions

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Yi.Framework.Data.Json
{
public class DateTimeJsonConverter : JsonConverter<DateTime>
{
private readonly string Format;
public DateTimeJsonConverter(string format)
{
Format = format;
}
public override void Write(Utf8JsonWriter writer, DateTime date, JsonSerializerOptions options)
{
writer.WriteStringValue(date.ToString(Format));
}
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return DateTime.ParseExact(reader.GetString(), Format, null);
}
}
}