diff --git a/.vs/Bunny.WebApi/DesignTimeBuild/.dtbcache.v2 b/.vs/Bunny.WebApi/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000..ca5892c Binary files /dev/null and b/.vs/Bunny.WebApi/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/Bunny.WebApi/FileContentIndex/db59c62f-ee05-4d14-90fe-e338af5dcbdb.vsidx b/.vs/Bunny.WebApi/FileContentIndex/db59c62f-ee05-4d14-90fe-e338af5dcbdb.vsidx new file mode 100644 index 0000000..cb9361d Binary files /dev/null and b/.vs/Bunny.WebApi/FileContentIndex/db59c62f-ee05-4d14-90fe-e338af5dcbdb.vsidx differ diff --git a/.vs/Bunny.WebApi/v17/.futdcache.v2 b/.vs/Bunny.WebApi/v17/.futdcache.v2 new file mode 100644 index 0000000..68ec319 Binary files /dev/null and b/.vs/Bunny.WebApi/v17/.futdcache.v2 differ diff --git a/.vs/Bunny.WebApi/v17/.suo b/.vs/Bunny.WebApi/v17/.suo new file mode 100644 index 0000000..52055a6 Binary files /dev/null and b/.vs/Bunny.WebApi/v17/.suo differ diff --git a/.vs/Bunny.WebApi/v17/DocumentLayout.json b/.vs/Bunny.WebApi/v17/DocumentLayout.json new file mode 100644 index 0000000..376dcbf --- /dev/null +++ b/.vs/Bunny.WebApi/v17/DocumentLayout.json @@ -0,0 +1,92 @@ +{ + "Version": 1, + "WorkspaceRootPath": "D:\\MyFolder\\Bunny\\Bunny-cli\\CSharp\\CSharp-Single-EFCore\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{28753039-0C3B-4FE5-95F8-7EDC92DCBA26}|Bunny.WebApi\\Bunny.WebApi.csproj|d:\\myfolder\\bunny\\bunny-cli\\csharp\\csharp-single-efcore\\bunny.webapi\\config\\baseconfig.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{28753039-0C3B-4FE5-95F8-7EDC92DCBA26}|Bunny.WebApi\\Bunny.WebApi.csproj|solutionrelative:bunny.webapi\\config\\baseconfig.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{28753039-0C3B-4FE5-95F8-7EDC92DCBA26}|Bunny.WebApi\\Bunny.WebApi.csproj|d:\\myfolder\\bunny\\bunny-cli\\csharp\\csharp-single-efcore\\bunny.webapi\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{28753039-0C3B-4FE5-95F8-7EDC92DCBA26}|Bunny.WebApi\\Bunny.WebApi.csproj|solutionrelative:bunny.webapi\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{28753039-0C3B-4FE5-95F8-7EDC92DCBA26}|Bunny.WebApi\\Bunny.WebApi.csproj|d:\\myfolder\\bunny\\bunny-cli\\csharp\\csharp-single-efcore\\bunny.webapi\\config\\serviceregistration.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{28753039-0C3B-4FE5-95F8-7EDC92DCBA26}|Bunny.WebApi\\Bunny.WebApi.csproj|solutionrelative:bunny.webapi\\config\\serviceregistration.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{28753039-0C3B-4FE5-95F8-7EDC92DCBA26}|Bunny.WebApi\\Bunny.WebApi.csproj|d:\\myfolder\\bunny\\bunny-cli\\csharp\\csharp-single-efcore\\bunny.webapi\\config\\knife4net.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{28753039-0C3B-4FE5-95F8-7EDC92DCBA26}|Bunny.WebApi\\Bunny.WebApi.csproj|solutionrelative:bunny.webapi\\config\\knife4net.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 4, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "Program.cs", + "DocumentMoniker": "D:\\MyFolder\\Bunny\\Bunny-cli\\CSharp\\CSharp-Single-EFCore\\Bunny.WebApi\\Program.cs", + "RelativeDocumentMoniker": "Bunny.WebApi\\Program.cs", + "ToolTip": "D:\\MyFolder\\Bunny\\Bunny-cli\\CSharp\\CSharp-Single-EFCore\\Bunny.WebApi\\Program.cs", + "RelativeToolTip": "Bunny.WebApi\\Program.cs", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-09-02T00:54:57.227Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, + "Title": "ServiceRegistration.cs", + "DocumentMoniker": "D:\\MyFolder\\Bunny\\Bunny-cli\\CSharp\\CSharp-Single-EFCore\\Bunny.WebApi\\Config\\ServiceRegistration.cs", + "RelativeDocumentMoniker": "Bunny.WebApi\\Config\\ServiceRegistration.cs", + "ToolTip": "D:\\MyFolder\\Bunny\\Bunny-cli\\CSharp\\CSharp-Single-EFCore\\Bunny.WebApi\\Config\\ServiceRegistration.cs", + "RelativeToolTip": "Bunny.WebApi\\Config\\ServiceRegistration.cs", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-09-02T00:54:44.07Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 3, + "Title": "Knife4Net.cs", + "DocumentMoniker": "D:\\MyFolder\\Bunny\\Bunny-cli\\CSharp\\CSharp-Single-EFCore\\Bunny.WebApi\\Config\\Knife4Net.cs", + "RelativeDocumentMoniker": "Bunny.WebApi\\Config\\Knife4Net.cs", + "ToolTip": "D:\\MyFolder\\Bunny\\Bunny-cli\\CSharp\\CSharp-Single-EFCore\\Bunny.WebApi\\Config\\Knife4Net.cs", + "RelativeToolTip": "Bunny.WebApi\\Config\\Knife4Net.cs", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-09-02T00:54:28.202Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "BaseConfig.cs", + "DocumentMoniker": "D:\\MyFolder\\Bunny\\Bunny-cli\\CSharp\\CSharp-Single-EFCore\\Bunny.WebApi\\Config\\BaseConfig.cs", + "RelativeDocumentMoniker": "Bunny.WebApi\\Config\\BaseConfig.cs", + "ToolTip": "D:\\MyFolder\\Bunny\\Bunny-cli\\CSharp\\CSharp-Single-EFCore\\Bunny.WebApi\\Config\\BaseConfig.cs", + "RelativeToolTip": "Bunny.WebApi\\Config\\BaseConfig.cs", + "ViewState": "AQIAABAAAAAAAAAAAAAowBwAAAARAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-09-02T00:54:22.184Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/ProjectEvaluation/bunny.webapi.metadata.v8.bin b/.vs/ProjectEvaluation/bunny.webapi.metadata.v8.bin new file mode 100644 index 0000000..529ed14 Binary files /dev/null and b/.vs/ProjectEvaluation/bunny.webapi.metadata.v8.bin differ diff --git a/.vs/ProjectEvaluation/bunny.webapi.projects.v8.bin b/.vs/ProjectEvaluation/bunny.webapi.projects.v8.bin new file mode 100644 index 0000000..a9ff1f6 Binary files /dev/null and b/.vs/ProjectEvaluation/bunny.webapi.projects.v8.bin differ diff --git a/.vs/ProjectEvaluation/bunny.webapi.strings.v8.bin b/.vs/ProjectEvaluation/bunny.webapi.strings.v8.bin new file mode 100644 index 0000000..f916064 Binary files /dev/null and b/.vs/ProjectEvaluation/bunny.webapi.strings.v8.bin differ diff --git a/Bunny.Common/Configuration/JsonDateTimeConverter.cs b/Bunny.Common/Configuration/JsonDateTimeConverter.cs new file mode 100644 index 0000000..05dca84 --- /dev/null +++ b/Bunny.Common/Configuration/JsonDateTimeConverter.cs @@ -0,0 +1,35 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using Bunny.Dao.Model.Constant; + +namespace Bunny.Common.Configuration; + +/// +/// 自定义Json转换器,用于将DateTime类型转换为JSON格式 +/// +public class JsonDateTimeConverter : JsonConverter +{ + /// + /// 重写读取方法,将JSON数据转换为DateTime类型 + /// + /// JSON读取器 + /// 要转换的目标类型 + /// JSON序列化选项 + /// 转换后的DateTime对象 + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return DateTime.TryParse(reader.GetString(), out var date) ? date : default; + } + + /// + /// 重写写入方法,将DateTime对象转换为JSON格式并写入JSON写入器 + /// + /// JSON写入器 + /// 要写入的DateTime对象 + /// JSON序列化选项 + public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) + { + // 将DateTime对象转换为特定格式的字符串并写入JSON写入器 + writer.WriteStringValue(value.ToString(LocalDateTimeConstant.DefaultDateTimeSecondFormat)); + } +} \ No newline at end of file diff --git a/Bunny.Common/Filter/GlobalExceptionFilter.cs b/Bunny.Common/Filter/GlobalExceptionFilter.cs index 775b30a..b5b12c8 100644 --- a/Bunny.Common/Filter/GlobalExceptionFilter.cs +++ b/Bunny.Common/Filter/GlobalExceptionFilter.cs @@ -1,6 +1,6 @@ using Bunny.Common.Exception; -using Bunny.Dao.Entity.Constant; -using Bunny.Dao.Entity.Result; +using Bunny.Dao.Model.Constant; +using Bunny.Dao.Model.Result; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.Logging; diff --git a/Bunny.Common/Filter/ValidateModelStateAttribute.cs b/Bunny.Common/Filter/ValidateModelStateAttribute.cs index a0852b9..dec9952 100644 --- a/Bunny.Common/Filter/ValidateModelStateAttribute.cs +++ b/Bunny.Common/Filter/ValidateModelStateAttribute.cs @@ -1,5 +1,5 @@ using System.Net; -using Bunny.Dao.Entity.Result; +using Bunny.Dao.Model.Result; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; diff --git a/Bunny.Common/Utils/Jwt/JwtParseUtil.cs b/Bunny.Common/Utils/Jwt/JwtParseUtil.cs index bca2bbe..b6010e3 100644 --- a/Bunny.Common/Utils/Jwt/JwtParseUtil.cs +++ b/Bunny.Common/Utils/Jwt/JwtParseUtil.cs @@ -1,7 +1,7 @@ using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; using Bunny.Common.Exception; -using Bunny.Dao.Entity.Constant; +using Bunny.Dao.Model.Constant; using Newtonsoft.Json; namespace Bunny.Common.Utils.Jwt; diff --git a/Bunny.Common/Utils/MinioUtil.cs b/Bunny.Common/Utils/MinioUtil.cs index c5e2190..e23d2a9 100644 --- a/Bunny.Common/Utils/MinioUtil.cs +++ b/Bunny.Common/Utils/MinioUtil.cs @@ -1,6 +1,6 @@ using Bunny.Common.Connect; using Bunny.Common.Exception; -using Bunny.Dao.Entity.Constant; +using Bunny.Dao.Model.Constant; using Microsoft.AspNetCore.Http; using Microsoft.IdentityModel.Tokens; using Minio.DataModel; diff --git a/Bunny.Common/Utils/Net/Response.cs b/Bunny.Common/Utils/Net/Response.cs index 57d3ed5..08b5846 100644 --- a/Bunny.Common/Utils/Net/Response.cs +++ b/Bunny.Common/Utils/Net/Response.cs @@ -1,5 +1,5 @@ using System.Net; -using Bunny.Dao.Entity.Result; +using Bunny.Dao.Model.Result; using Microsoft.AspNetCore.Mvc; namespace Bunny.Common.Utils.Net; diff --git a/Bunny.Dao/Bunny.Dao.csproj b/Bunny.Dao/Bunny.Dao.csproj index 99800de..61a281b 100644 --- a/Bunny.Dao/Bunny.Dao.csproj +++ b/Bunny.Dao/Bunny.Dao.csproj @@ -10,4 +10,8 @@ + + + + diff --git a/Bunny.Dao/Entity/Enum/Enum.cs b/Bunny.Dao/Entity/Enum/Enum.cs deleted file mode 100644 index cd8c2d5..0000000 --- a/Bunny.Dao/Entity/Enum/Enum.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace Bunny.Dao.Entity.Enum; - -public enum Enum -{ -} \ No newline at end of file diff --git a/Bunny.Dao/Entity/Constant/ExceptionConstant.cs b/Bunny.Dao/Model/Constant/ExceptionConstant.cs similarity index 98% rename from Bunny.Dao/Entity/Constant/ExceptionConstant.cs rename to Bunny.Dao/Model/Constant/ExceptionConstant.cs index 35d49aa..e6bbae8 100644 --- a/Bunny.Dao/Entity/Constant/ExceptionConstant.cs +++ b/Bunny.Dao/Model/Constant/ExceptionConstant.cs @@ -1,4 +1,4 @@ -namespace Bunny.Dao.Entity.Constant; +namespace Bunny.Dao.Model.Constant; /// /// 错误常量 diff --git a/Bunny.Dao/Entity/Constant/FileMessageConstant.cs b/Bunny.Dao/Model/Constant/FileMessageConstant.cs similarity index 96% rename from Bunny.Dao/Entity/Constant/FileMessageConstant.cs rename to Bunny.Dao/Model/Constant/FileMessageConstant.cs index d3e01f3..2bf20e2 100644 --- a/Bunny.Dao/Entity/Constant/FileMessageConstant.cs +++ b/Bunny.Dao/Model/Constant/FileMessageConstant.cs @@ -1,4 +1,4 @@ -namespace Bunny.Dao.Entity.Constant; +namespace Bunny.Dao.Model.Constant; /// /// 文件消息相关常量 diff --git a/Bunny.Dao/Entity/Constant/LocalDateTimeConstant.cs b/Bunny.Dao/Model/Constant/LocalDateTimeConstant.cs similarity index 90% rename from Bunny.Dao/Entity/Constant/LocalDateTimeConstant.cs rename to Bunny.Dao/Model/Constant/LocalDateTimeConstant.cs index f62e584..b779f72 100644 --- a/Bunny.Dao/Entity/Constant/LocalDateTimeConstant.cs +++ b/Bunny.Dao/Model/Constant/LocalDateTimeConstant.cs @@ -1,4 +1,4 @@ -namespace Bunny.Dao.Entity.Constant; +namespace Bunny.Dao.Model.Constant; /// /// 事件相关常量 diff --git a/Bunny.Dao/Entity/Constant/MailMessageConstant.cs b/Bunny.Dao/Model/Constant/MailMessageConstant.cs similarity index 92% rename from Bunny.Dao/Entity/Constant/MailMessageConstant.cs rename to Bunny.Dao/Model/Constant/MailMessageConstant.cs index 12227cc..cd151b9 100644 --- a/Bunny.Dao/Entity/Constant/MailMessageConstant.cs +++ b/Bunny.Dao/Model/Constant/MailMessageConstant.cs @@ -1,4 +1,4 @@ -namespace Bunny.Dao.Entity.Constant; +namespace Bunny.Dao.Model.Constant; /// /// 邮箱消息先关常量 diff --git a/Bunny.Dao/Entity/Constant/RedisConstant.cs b/Bunny.Dao/Model/Constant/RedisConstant.cs similarity index 96% rename from Bunny.Dao/Entity/Constant/RedisConstant.cs rename to Bunny.Dao/Model/Constant/RedisConstant.cs index 644d178..1c0b5a8 100644 --- a/Bunny.Dao/Entity/Constant/RedisConstant.cs +++ b/Bunny.Dao/Model/Constant/RedisConstant.cs @@ -1,4 +1,4 @@ -namespace Bunny.Dao.Entity.Constant; +namespace Bunny.Dao.Model.Constant; /// /// Redis相关常量 diff --git a/Bunny.Dao/Entity/Result/Constant/ErrorConstant.cs b/Bunny.Dao/Model/Constant/Result/ErrorConstant.cs similarity index 84% rename from Bunny.Dao/Entity/Result/Constant/ErrorConstant.cs rename to Bunny.Dao/Model/Constant/Result/ErrorConstant.cs index b398666..d125ee9 100644 --- a/Bunny.Dao/Entity/Result/Constant/ErrorConstant.cs +++ b/Bunny.Dao/Model/Constant/Result/ErrorConstant.cs @@ -1,4 +1,4 @@ -namespace Bunny.Dao.Entity.Result.Constant; +namespace Bunny.Dao.Model.Constant.Result; /// /// 发生时的错误敞亮 diff --git a/Bunny.Dao/Entity/Result/Constant/SuccessConstant.cs b/Bunny.Dao/Model/Constant/Result/SuccessConstant.cs similarity index 65% rename from Bunny.Dao/Entity/Result/Constant/SuccessConstant.cs rename to Bunny.Dao/Model/Constant/Result/SuccessConstant.cs index 91be540..6c58310 100644 --- a/Bunny.Dao/Entity/Result/Constant/SuccessConstant.cs +++ b/Bunny.Dao/Model/Constant/Result/SuccessConstant.cs @@ -1,4 +1,4 @@ -namespace Bunny.Dao.Entity.Result.Constant; +namespace Bunny.Dao.Model.Constant.Result; public class SuccessConstant { diff --git a/Bunny.Dao/Entity/Constant/SecurityConstant.cs b/Bunny.Dao/Model/Constant/SecurityConstant.cs similarity index 75% rename from Bunny.Dao/Entity/Constant/SecurityConstant.cs rename to Bunny.Dao/Model/Constant/SecurityConstant.cs index 5e6802e..e7621a0 100644 --- a/Bunny.Dao/Entity/Constant/SecurityConstant.cs +++ b/Bunny.Dao/Model/Constant/SecurityConstant.cs @@ -1,4 +1,4 @@ -namespace Bunny.Dao.Entity.Constant; +namespace Bunny.Dao.Model.Constant; /// /// 鉴权相关常量 diff --git a/Bunny.Dao/Entity/Constant/SqlConstant.cs b/Bunny.Dao/Model/Constant/SqlConstant.cs similarity index 89% rename from Bunny.Dao/Entity/Constant/SqlConstant.cs rename to Bunny.Dao/Model/Constant/SqlConstant.cs index 4f964c7..61d967e 100644 --- a/Bunny.Dao/Entity/Constant/SqlConstant.cs +++ b/Bunny.Dao/Model/Constant/SqlConstant.cs @@ -1,4 +1,4 @@ -namespace Bunny.Dao.Entity.Constant; +namespace Bunny.Dao.Model.Constant; /// /// 数据库相关常量 diff --git a/Bunny.Dao/Entity/Constant/StatusConstant.cs b/Bunny.Dao/Model/Constant/StatusConstant.cs similarity index 78% rename from Bunny.Dao/Entity/Constant/StatusConstant.cs rename to Bunny.Dao/Model/Constant/StatusConstant.cs index 8936e5a..7b9d3b3 100644 --- a/Bunny.Dao/Entity/Constant/StatusConstant.cs +++ b/Bunny.Dao/Model/Constant/StatusConstant.cs @@ -1,4 +1,4 @@ -namespace Bunny.Dao.Entity.Constant; +namespace Bunny.Dao.Model.Constant; /// /// 状态相关常量 diff --git a/Bunny.Dao/Entity/Constant/UserConstant.cs b/Bunny.Dao/Model/Constant/UserConstant.cs similarity index 86% rename from Bunny.Dao/Entity/Constant/UserConstant.cs rename to Bunny.Dao/Model/Constant/UserConstant.cs index 606c083..02baa01 100644 --- a/Bunny.Dao/Entity/Constant/UserConstant.cs +++ b/Bunny.Dao/Model/Constant/UserConstant.cs @@ -1,4 +1,4 @@ -namespace Bunny.Dao.Entity.Constant; +namespace Bunny.Dao.Model.Constant; /// /// 用户相关常量 diff --git a/Bunny.Dao/Model/Enum/Enum.cs b/Bunny.Dao/Model/Enum/Enum.cs new file mode 100644 index 0000000..152baec --- /dev/null +++ b/Bunny.Dao/Model/Enum/Enum.cs @@ -0,0 +1,5 @@ +namespace Bunny.Dao.Model.Enum; + +public enum Enum +{ +} \ No newline at end of file diff --git a/Bunny.Dao/Entity/Result/Pagination.cs b/Bunny.Dao/Model/Result/Pagination.cs similarity index 92% rename from Bunny.Dao/Entity/Result/Pagination.cs rename to Bunny.Dao/Model/Result/Pagination.cs index 48120c4..84fa2bb 100644 --- a/Bunny.Dao/Entity/Result/Pagination.cs +++ b/Bunny.Dao/Model/Result/Pagination.cs @@ -1,4 +1,4 @@ -namespace Bunny.Dao.Entity.Result; +namespace Bunny.Dao.Model.Result; public class PageResult { diff --git a/Bunny.Dao/Entity/Result/Result.cs b/Bunny.Dao/Model/Result/Result.cs similarity index 98% rename from Bunny.Dao/Entity/Result/Result.cs rename to Bunny.Dao/Model/Result/Result.cs index 3596420..945b0dc 100644 --- a/Bunny.Dao/Entity/Result/Result.cs +++ b/Bunny.Dao/Model/Result/Result.cs @@ -1,8 +1,8 @@ using System.Net; -using Bunny.Dao.Entity.Result.Constant; +using Bunny.Dao.Model.Constant.Result; using Microsoft.AspNetCore.Mvc; -namespace Bunny.Dao.Entity.Result; +namespace Bunny.Dao.Model.Result; [Serializable] public class Result(HttpStatusCode code, T? data, string? message) diff --git a/Bunny.Service/Filter/AuthorizationFilter.cs b/Bunny.Service/Filter/AuthorizationFilter.cs index cee6176..18ddfb0 100644 --- a/Bunny.Service/Filter/AuthorizationFilter.cs +++ b/Bunny.Service/Filter/AuthorizationFilter.cs @@ -1,7 +1,7 @@ using System.Net; using Bunny.Common.Utils.Jwt; using Bunny.Common.Utils.Net; -using Bunny.Dao.Entity.Constant; +using Bunny.Dao.Model.Constant; using Bunny.Dao.Vo.User; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Filters; diff --git a/Bunny.Service/IService/IBlogService.cs b/Bunny.Service/IService/IBlogService.cs index 61e93c8..c4da136 100644 --- a/Bunny.Service/IService/IBlogService.cs +++ b/Bunny.Service/IService/IBlogService.cs @@ -1,5 +1,5 @@ -using Bunny.Dao.Entity.Result; -using Bunny.Dao.Entity.System; +using Bunny.Dao.Entity.System; +using Bunny.Dao.Model.Result; namespace Bunny.Service.IService; diff --git a/Bunny.Service/IService/Service/BlogService.cs b/Bunny.Service/IService/Service/BlogService.cs index bd53af2..3344376 100644 --- a/Bunny.Service/IService/Service/BlogService.cs +++ b/Bunny.Service/IService/Service/BlogService.cs @@ -1,6 +1,6 @@ using Bunny.Common.Connect; -using Bunny.Dao.Entity.Result; using Bunny.Dao.Entity.System; +using Bunny.Dao.Model.Result; namespace Bunny.Service.IService.Service; diff --git a/Bunny.Service/IService/Service/LoginService.cs b/Bunny.Service/IService/Service/LoginService.cs index 695112a..01d4c7a 100644 --- a/Bunny.Service/IService/Service/LoginService.cs +++ b/Bunny.Service/IService/Service/LoginService.cs @@ -1,11 +1,4 @@ -using Bunny.Common.Exception; -using Bunny.Common.Utils.Jwt; -using Bunny.Common.Utils.Net; -using Bunny.Dao.Dto.User; -using Bunny.Dao.Entity.Constant; -using Bunny.Dao.Vo.User; - -namespace Bunny.Service.IService.Service; +namespace Bunny.Service.IService.Service; public class LoginService : ILoginService { diff --git a/Bunny.Test.Until/TestResultCodeEnum.cs b/Bunny.Test.Until/TestResultCodeEnum.cs index 4851c49..6f0e78c 100644 --- a/Bunny.Test.Until/TestResultCodeEnum.cs +++ b/Bunny.Test.Until/TestResultCodeEnum.cs @@ -1,6 +1,6 @@ using System.Net; -using Bunny.Dao.Entity.Constant; -using Bunny.Dao.Entity.Result; +using Bunny.Dao.Model.Constant; +using Bunny.Dao.Model.Result; using Newtonsoft.Json; using NUnit.Framework; diff --git a/Bunny.WebApi/Config/BaseConfig.cs b/Bunny.WebApi/Config/BaseConfig.cs index f7de169..9051a78 100644 --- a/Bunny.WebApi/Config/BaseConfig.cs +++ b/Bunny.WebApi/Config/BaseConfig.cs @@ -1,4 +1,5 @@ using Bunny.Common; +using Bunny.Common.Configuration; using Bunny.Common.Connect; using Bunny.Service.WebSocket; @@ -15,21 +16,22 @@ public class BaseConfig(WebApplicationBuilder builder) UseCors(); // 配置日志相关 // builder.Logging.AddLog4Net("Config/log4net.config"); + // 自定义时间格式 + builder.Services.AddControllers().AddJsonOptions(options => + options.JsonSerializerOptions.Converters.Add(new JsonDateTimeConverter())); // 添加使用自定义配置文件 builder.Services.AddSingleton(new AppSettings(builder.Configuration)); // 添加 SignalR builder.Services.AddSignalR(); - builder.WebHost.ConfigureKestrel((context, options) => + builder.WebHost.ConfigureKestrel((_, options) => { // 设置文件最大上传大小 options.Limits.MaxRequestBodySize = 1024 * 1024 * 100; }); // 添加Service服务 builder.AddApplicationServices(); - // 添加后台服务 + // 添加定时任务 builder.AddApplicationBackendServices(); - // 添加验证码 - builder.AddCaptcha(); // 设置过滤器 builder.AddFilterConfigInitialize(); // 初始化Redis @@ -40,6 +42,8 @@ public class BaseConfig(WebApplicationBuilder builder) builder.AddKnife4Net(); // 启动 webSocket builder.AddWebSocketInitial(); + // 添加验证码 + builder.AddCaptcha(); } /// diff --git a/Bunny.WebApi/Config/JsonDateTimeConverter.cs b/Bunny.WebApi/Config/JsonDateTimeConverter.cs deleted file mode 100644 index 2ce19b4..0000000 --- a/Bunny.WebApi/Config/JsonDateTimeConverter.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Bunny.WebApi.Config; - -public class JsonDateTimeConverter : JsonConverter -{ - public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return DateTime.TryParse(reader.GetString(), out var date) ? date : default; - } - - public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) - { - writer.WriteStringValue(value.ToString("yyyy-MM-dd HH:mm:ss")); - } -} \ No newline at end of file diff --git a/Bunny.WebApi/Controllers/BlogController.cs b/Bunny.WebApi/Controllers/BlogController.cs index fe3db16..01c8c67 100644 --- a/Bunny.WebApi/Controllers/BlogController.cs +++ b/Bunny.WebApi/Controllers/BlogController.cs @@ -1,5 +1,5 @@ -using Bunny.Dao.Entity.Result; -using Bunny.Dao.Entity.System; +using Bunny.Dao.Entity.System; +using Bunny.Dao.Model.Result; using Bunny.Service.IService; using Microsoft.AspNetCore.Mvc; diff --git a/Bunny.WebApi/Controllers/CaptchaTestController.cs b/Bunny.WebApi/Controllers/CaptchaTestController.cs index 0f923b5..33abe87 100644 --- a/Bunny.WebApi/Controllers/CaptchaTestController.cs +++ b/Bunny.WebApi/Controllers/CaptchaTestController.cs @@ -1,5 +1,5 @@ -using Bunny.Dao.Entity.Result; -using Bunny.Dao.Entity.Result.Constant; +using Bunny.Dao.Model.Constant.Result; +using Bunny.Dao.Model.Result; using Lazy.Captcha.Core; using Microsoft.AspNetCore.Mvc; diff --git a/Bunny.WebApi/Controllers/JobInitController.cs b/Bunny.WebApi/Controllers/JobInitController.cs index a4c2263..e37335f 100644 --- a/Bunny.WebApi/Controllers/JobInitController.cs +++ b/Bunny.WebApi/Controllers/JobInitController.cs @@ -1,4 +1,4 @@ -using Bunny.Dao.Entity.Result; +using Bunny.Dao.Model.Result; using Bunny.Service.IService; using Microsoft.AspNetCore.Mvc; diff --git a/Bunny.WebApi/Controllers/MinioController.cs b/Bunny.WebApi/Controllers/MinioController.cs index aa002ad..a289ca3 100644 --- a/Bunny.WebApi/Controllers/MinioController.cs +++ b/Bunny.WebApi/Controllers/MinioController.cs @@ -1,4 +1,4 @@ -using Bunny.Dao.Entity.Result; +using Bunny.Dao.Model.Result; using Bunny.Service.IService; using Microsoft.AspNetCore.Mvc; using Minio.DataModel; diff --git a/Bunny.WebApi/Controllers/RedisController.cs b/Bunny.WebApi/Controllers/RedisController.cs index 8258890..4a08823 100644 --- a/Bunny.WebApi/Controllers/RedisController.cs +++ b/Bunny.WebApi/Controllers/RedisController.cs @@ -1,4 +1,4 @@ -using Bunny.Dao.Entity.Result; +using Bunny.Dao.Model.Result; using Bunny.Service.IService; using Microsoft.AspNetCore.Mvc; diff --git a/Bunny.WebApi/Controllers/TemplateController.cs b/Bunny.WebApi/Controllers/TemplateController.cs index 28e3fe0..a6a223c 100644 --- a/Bunny.WebApi/Controllers/TemplateController.cs +++ b/Bunny.WebApi/Controllers/TemplateController.cs @@ -1,4 +1,4 @@ -using Bunny.Dao.Entity.Result; +using Bunny.Dao.Model.Result; using Bunny.Service.IService; using Microsoft.AspNetCore.Mvc;