From 461847e4ed0c486afd776e0145f42f02c07701b4 Mon Sep 17 00:00:00 2001 From: wanghu Date: Mon, 7 Sep 2026 10:15:23 +0800 Subject: [PATCH] sw --- .../Controllers/Api/DocPrint/WY_listController.cs | 4 ++-- src/YhCore.WebApi/Startup.cs | 6 ++++++ src/YhCore.WebApi/YhCore.WebApi.csproj | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/YhCore.WebApi/Controllers/Api/DocPrint/WY_listController.cs b/src/YhCore.WebApi/Controllers/Api/DocPrint/WY_listController.cs index 5b74bc6..3770114 100644 --- a/src/YhCore.WebApi/Controllers/Api/DocPrint/WY_listController.cs +++ b/src/YhCore.WebApi/Controllers/Api/DocPrint/WY_listController.cs @@ -81,8 +81,8 @@ namespace YhCore.WebApi.Controllers.Api.DocPrint => await _classify.DictionaryTypeListAsync(SchSerID(), name, showAll, typeID); /// 添加公共类别(复用字典添加逻辑)。前端 api/index.js 固定以 x-www-form-urlencoded 提交 - /// (TypeId/Name/typeName 表单字段,大小写不敏感绑定到 typeID/Name/typeName),故用 [FromForm]—— - /// [FromForm] 会因 Content-Type 不符返回 415。 + /// (TypeId/Name/typeName 表单字段,大小写不敏感绑定到 typeID/Name/typeName),故用 [FromForm]; + /// 若误用 [FromBody],Content-Type 不符会返回 415。 [HttpPost("AddDictionaryType")] public async Task AddDictionaryType([FromForm] Common_Dictionary model) { diff --git a/src/YhCore.WebApi/Startup.cs b/src/YhCore.WebApi/Startup.cs index 909e4c0..9590e54 100644 --- a/src/YhCore.WebApi/Startup.cs +++ b/src/YhCore.WebApi/Startup.cs @@ -185,6 +185,12 @@ namespace YhCore.WebApi In = ParameterLocation.Header, Description = "登录后携带的令牌(对接 CAS SSO 后使用)" }); + // 加载 XML 注释:控制器/动作的 summary 中文描述展示到 Swagger(csproj GenerateDocumentationFile) + var xml = $"{System.AppContext.BaseDirectory}{System.Reflection.Assembly.GetExecutingAssembly().GetName().Name}.xml"; + if (System.IO.File.Exists(xml)) + { + c.IncludeXmlComments(xml, includeControllerXmlComments: true); + } }); // 任务调度:Quartz 宿主 + Job 模板(对应 Java scheduler 包) diff --git a/src/YhCore.WebApi/YhCore.WebApi.csproj b/src/YhCore.WebApi/YhCore.WebApi.csproj index 3dc0acc..599b86f 100644 --- a/src/YhCore.WebApi/YhCore.WebApi.csproj +++ b/src/YhCore.WebApi/YhCore.WebApi.csproj @@ -6,6 +6,9 @@ YhCore.WebApi 9.0 disable + + true + $(NoWarn);1591