From 8e4c2b0e45bcd8f2fb50e7a42ad4ca56ab55ae2e Mon Sep 17 00:00:00 2001
From: MSuMshk <2039814060@qq.com>
Date: Thu, 4 Dec 2025 11:25:01 +0800
Subject: [PATCH] chore: add documentation comments and stylecop rules
---
.editorconfig | 6 ++
Directory.Build.props | 3 +
.../Controllers/AuthController.cs | 11 ++-
.../Controllers/DeliveriesController.cs | 21 ++++--
.../Controllers/DictionaryController.cs | 29 ++++++--
.../Controllers/FilesController.cs | 9 ++-
.../Controllers/HealthController.cs | 3 +
.../MerchantCategoriesController.cs | 12 ++++
.../Controllers/MerchantsController.cs | 51 ++++++++++++--
.../Controllers/OrdersController.cs | 21 ++++--
.../Controllers/PaymentsController.cs | 21 ++++--
.../Controllers/PermissionsController.cs | 14 ++++
.../Controllers/ProductsController.cs | 21 ++++--
.../Controllers/RolesController.cs | 40 +++++++++++
.../Controllers/StoresController.cs | 21 ++++--
.../Controllers/SystemParametersController.cs | 15 +++++
.../TenantAnnouncementsController.cs | 22 ++++++
.../Controllers/TenantBillingsController.cs | 16 +++++
.../TenantNotificationsController.cs | 8 +++
.../Controllers/TenantPackagesController.cs | 17 +++++
.../Controllers/TenantsController.cs | 33 +++++++++
.../Controllers/UserPermissionsController.cs | 2 +
src/Api/TakeoutSaaS.AdminApi/Program.cs | 19 ++++--
.../Controllers/AuthController.cs | 14 ++--
.../Controllers/FilesController.cs | 9 ++-
.../Controllers/HealthController.cs | 3 +
.../Controllers/MeController.cs | 10 ++-
src/Api/TakeoutSaaS.MiniApi/Program.cs | 11 +++
.../Controllers/HealthController.cs | 3 +
src/Api/TakeoutSaaS.UserApi/Program.cs | 11 +++
.../CreateDeliveryOrderCommandHandler.cs | 14 ++--
.../DeleteDeliveryOrderCommandHandler.cs | 18 ++---
.../GetDeliveryOrderByIdQueryHandler.cs | 15 +++--
.../SearchDeliveryOrdersQueryHandler.cs | 15 +++--
.../UpdateDeliveryOrderCommandHandler.cs | 24 ++++---
.../AddMerchantDocumentCommandHandler.cs | 25 ++++---
.../CreateMerchantCategoryCommandHandler.cs | 18 ++---
.../Handlers/CreateMerchantCommandHandler.cs | 12 ++--
.../CreateMerchantContractCommandHandler.cs | 27 ++++----
.../DeleteMerchantCategoryCommandHandler.cs | 13 ++--
.../Handlers/DeleteMerchantCommandHandler.cs | 14 ++--
.../GetMerchantAuditLogsQueryHandler.cs | 11 +--
.../Handlers/GetMerchantByIdQueryHandler.cs | 9 ++-
.../GetMerchantCategoriesQueryHandler.cs | 9 ++-
.../GetMerchantContractsQueryHandler.cs | 11 ++-
.../Handlers/GetMerchantDetailQueryHandler.cs | 14 ++--
.../GetMerchantDocumentsQueryHandler.cs | 11 ++-
.../ListMerchantCategoriesQueryHandler.cs | 10 +--
...ReorderMerchantCategoriesCommandHandler.cs | 14 ++--
.../Handlers/ReviewMerchantCommandHandler.cs | 23 ++++---
.../ReviewMerchantDocumentCommandHandler.cs | 23 ++++---
.../Handlers/SearchMerchantsQueryHandler.cs | 11 +--
.../Handlers/UpdateMerchantCommandHandler.cs | 14 ++--
...ateMerchantContractStatusCommandHandler.cs | 23 ++++---
.../Handlers/CreateOrderCommandHandler.cs | 18 +++--
.../Handlers/DeleteOrderCommandHandler.cs | 17 +++--
.../Handlers/GetOrderByIdQueryHandler.cs | 18 ++---
.../Handlers/SearchOrdersQueryHandler.cs | 13 ++--
.../Handlers/UpdateOrderCommandHandler.cs | 24 +++----
...ngeTenantSubscriptionPlanCommandHandler.cs | 22 +++---
.../CheckTenantQuotaCommandHandler.cs | 8 ++-
.../CreateTenantAnnouncementCommandHandler.cs | 3 +
.../CreateTenantBillingCommandHandler.cs | 4 ++
.../CreateTenantPackageCommandHandler.cs | 3 +
.../CreateTenantSubscriptionCommandHandler.cs | 26 ++++---
.../DeleteTenantAnnouncementCommandHandler.cs | 3 +
.../DeleteTenantPackageCommandHandler.cs | 3 +
.../GetTenantAnnouncementQueryHandler.cs | 3 +
.../GetTenantAuditLogsQueryHandler.cs | 7 +-
.../Handlers/GetTenantBillQueryHandler.cs | 3 +
.../Handlers/GetTenantByIdQueryHandler.cs | 11 +--
.../GetTenantPackageByIdQueryHandler.cs | 3 +
...arkTenantAnnouncementReadCommandHandler.cs | 4 ++
.../MarkTenantBillingPaidCommandHandler.cs | 4 ++
...arkTenantNotificationReadCommandHandler.cs | 3 +
.../Handlers/RegisterTenantCommandHandler.cs | 28 ++++----
.../Handlers/ReviewTenantCommandHandler.cs | 34 +++++-----
.../SearchTenantAnnouncementsQueryHandler.cs | 7 ++
.../Handlers/SearchTenantBillsQueryHandler.cs | 3 +
.../SearchTenantNotificationsQueryHandler.cs | 3 +
.../SearchTenantPackagesQueryHandler.cs | 3 +
.../Handlers/SearchTenantsQueryHandler.cs | 12 ++--
.../SubmitTenantVerificationCommandHandler.cs | 20 +++---
.../UpdateTenantAnnouncementCommandHandler.cs | 5 ++
.../UpdateTenantPackageCommandHandler.cs | 4 ++
.../Services/DictionaryAppService.cs | 27 +++++++-
.../Handlers/AssignUserRolesCommandHandler.cs | 5 ++
.../BindRolePermissionsCommandHandler.cs | 5 ++
.../CopyRoleTemplateCommandHandler.cs | 6 +-
.../CreatePermissionCommandHandler.cs | 5 ++
.../Handlers/CreateRoleCommandHandler.cs | 5 ++
.../CreateRoleTemplateCommandHandler.cs | 5 ++
.../DeletePermissionCommandHandler.cs | 5 ++
.../Handlers/DeleteRoleCommandHandler.cs | 5 ++
.../DeleteRoleTemplateCommandHandler.cs | 4 ++
.../Handlers/GetRoleTemplateQueryHandler.cs | 4 ++
.../GetUserPermissionsQueryHandler.cs | 29 ++++----
.../Handlers/ListRoleTemplatesQueryHandler.cs | 3 +
.../Handlers/SearchPermissionsQueryHandler.cs | 5 ++
.../Handlers/SearchRolesQueryHandler.cs | 5 ++
.../SearchUserPermissionsQueryHandler.cs | 27 ++++----
.../UpdatePermissionCommandHandler.cs | 4 ++
.../Handlers/UpdateRoleCommandHandler.cs | 4 ++
.../Contracts/SendVerificationCodeRequest.cs | 2 -
.../VerifyVerificationCodeRequest.cs | 2 -
.../Sms/Services/VerificationCodeService.cs | 8 +++
.../Storage/Contracts/DirectUploadRequest.cs | 2 -
.../Storage/Contracts/UploadFileRequest.cs | 2 -
.../Storage/Services/FileStorageService.cs | 10 +++
.../Constants/DatabaseConstants.cs | 2 +-
.../Constants/ErrorCodes.cs | 32 ++++++++-
.../Results/ApiResponse.cs | 21 +++++-
.../Middleware/RequestLoggingMiddleware.cs | 1 -
.../HttpContextCurrentUserAccessor.cs | 2 -
.../Deliveries/Entities/DeliveryOrder.cs | 3 +
.../Repositories/IPermissionRepository.cs | 67 +++++++++++++++++++
.../Repositories/IRolePermissionRepository.cs | 29 ++++++++
.../Identity/Repositories/IRoleRepository.cs | 59 ++++++++++++++++
.../Repositories/IRoleTemplateRepository.cs | 49 ++++++++++++++
.../Repositories/IUserRoleRepository.cs | 30 +++++++++
.../Repositories/IMerchantRepository.cs | 32 +++++++++
.../Queues/Entities/QueueTicket.cs | 3 +
src/Gateway/TakeoutSaaS.ApiGateway/Program.cs | 14 +++-
.../App/Repositories/EfDeliveryRepository.cs | 2 -
.../App/Repositories/EfMerchantRepository.cs | 2 -
.../App/Repositories/EfOrderRepository.cs | 2 -
.../App/Repositories/EfPaymentRepository.cs | 2 -
.../App/Repositories/EfProductRepository.cs | 2 -
.../App/Repositories/EfStoreRepository.cs | 2 -
.../Repositories/EfDictionaryRepository.cs | 1 -
.../Persistence/EfIdentityUserRepository.cs | 1 -
.../Persistence/EfMiniUserRepository.cs | 1 -
.../Services/RabbitMqMessagePublisher.cs | 4 ++
.../Services/RabbitMqMessageSubscriber.cs | 4 ++
.../Services/AliyunSmsSender.cs | 2 -
.../Services/TencentSmsSender.cs | 5 ++
.../Models/StorageDirectUploadRequest.cs | 2 -
.../Models/StorageUploadRequest.cs | 1 -
.../Providers/AliyunOssStorageProvider.cs | 8 +++
.../Providers/S3StorageProviderBase.cs | 7 ++
.../TenantProvider.cs | 2 -
.../TenantResolutionMiddleware.cs | 2 -
142 files changed, 1309 insertions(+), 439 deletions(-)
create mode 100644 .editorconfig
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..32193b8
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,6 @@
+# EditorConfig
+root = true
+
+[*.cs]
+dotnet_diagnostic.SA1600.severity = error
+dotnet_diagnostic.SA1601.severity = error
diff --git a/Directory.Build.props b/Directory.Build.props
index 59c4f40..f83743e 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -6,5 +6,8 @@
latest
false
+
+
+
diff --git a/src/Api/TakeoutSaaS.AdminApi/Controllers/AuthController.cs b/src/Api/TakeoutSaaS.AdminApi/Controllers/AuthController.cs
index 72f23f4..b38d018 100644
--- a/src/Api/TakeoutSaaS.AdminApi/Controllers/AuthController.cs
+++ b/src/Api/TakeoutSaaS.AdminApi/Controllers/AuthController.cs
@@ -13,21 +13,16 @@ using TakeoutSaaS.Shared.Web.Api;
using TakeoutSaaS.Shared.Web.Security;
namespace TakeoutSaaS.AdminApi.Controllers;
-
///
/// 管理后台认证接口
///
-///
-///
-///
-///
+/// 提供登录、刷新 Token 以及用户权限查询能力。
+/// 认证服务
[ApiVersion("1.0")]
[Authorize]
[Route("api/admin/v{version:apiVersion}/auth")]
public sealed class AuthController(IAdminAuthService authService) : BaseApiController
{
-
-
///
/// 登录获取 Token
///
@@ -84,12 +79,14 @@ public sealed class AuthController(IAdminAuthService authService) : BaseApiContr
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status401Unauthorized)]
public async Task> GetProfile(CancellationToken cancellationToken)
{
+ // 1. 从 JWT 中获取当前用户标识
var userId = User.GetUserId();
if (userId == 0)
{
return ApiResponse.Error(ErrorCodes.Unauthorized, "Token 缺少有效的用户标识");
}
+ // 2. 读取用户档案并返回
var profile = await authService.GetProfileAsync(userId, cancellationToken);
return ApiResponse.Ok(profile);
}
diff --git a/src/Api/TakeoutSaaS.AdminApi/Controllers/DeliveriesController.cs b/src/Api/TakeoutSaaS.AdminApi/Controllers/DeliveriesController.cs
index fe5d2cf..ae7c092 100644
--- a/src/Api/TakeoutSaaS.AdminApi/Controllers/DeliveriesController.cs
+++ b/src/Api/TakeoutSaaS.AdminApi/Controllers/DeliveriesController.cs
@@ -16,16 +16,11 @@ namespace TakeoutSaaS.AdminApi.Controllers;
///
/// 配送单管理。
///
-///
-/// 初始化控制器。
-///
[ApiVersion("1.0")]
[Authorize]
[Route("api/admin/v{version:apiVersion}/deliveries")]
public sealed class DeliveriesController(IMediator mediator) : BaseApiController
{
-
-
///
/// 创建配送单。
///
@@ -34,7 +29,10 @@ public sealed class DeliveriesController(IMediator mediator) : BaseApiController
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)]
public async Task> Create([FromBody] CreateDeliveryOrderCommand command, CancellationToken cancellationToken)
{
+ // 1. 创建配送单
var result = await mediator.Send(command, cancellationToken);
+
+ // 2. 返回创建结果
return ApiResponse.Ok(result);
}
@@ -53,6 +51,7 @@ public sealed class DeliveriesController(IMediator mediator) : BaseApiController
[FromQuery] bool sortDesc = true,
CancellationToken cancellationToken = default)
{
+ // 1. 组装查询参数
var result = await mediator.Send(new SearchDeliveryOrdersQuery
{
OrderId = orderId,
@@ -63,6 +62,7 @@ public sealed class DeliveriesController(IMediator mediator) : BaseApiController
SortDescending = sortDesc
}, cancellationToken);
+ // 2. 返回分页结果
return ApiResponse>.Ok(result);
}
@@ -75,7 +75,10 @@ public sealed class DeliveriesController(IMediator mediator) : BaseApiController
[ProducesResponseType(typeof(ApiResponse