必选修规则栏位显示修改

修复swagger接口文档无法正常访问(api合并部署引起)
master
xiaochanghai 8 months ago
parent c1e035733f
commit 9888fe5d66
  1. 16
      Model/Tiobon.Web.pdm
  2. 2
      Tiobon.Core.Api/Program.cs
  3. 6
      Tiobon.Core.Api/Tiobon.Core.Model.xml
  4. 81
      Tiobon.Core.Common/Swagger/SwaggerContextExtension.cs
  5. 8
      Tiobon.Core.Extensions/Middlewares/SwaggerAuthMiddleware.cs
  6. 8
      Tiobon.Core.Extensions/ServiceExtensions/SwaggerSetup.cs
  7. 8
      Tiobon.Core.Model/Base/Ghre/Ghre_StudyRule.Dto.Base.cs
  8. 6
      Tiobon.Core.Model/Models/Ghre/Ghre_StudyRule.cs
  9. 7
      Tiobon.Core.sln
  10. 6
      Tiobon.Core/Tiobon.Core.Model.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?PowerDesigner AppLocale="UTF16" ID="{C294868A-C3F3-41AD-98CC-78B6D4E0CC40}" Label="" LastModificationDate="1730773777" Name="Tiobon" Objects="2232" Symbols="85" Target="Microsoft SQL Server 2008" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="15.0.0.2613"?>
<?PowerDesigner AppLocale="UTF16" ID="{C294868A-C3F3-41AD-98CC-78B6D4E0CC40}" Label="" LastModificationDate="1730947770" Name="Tiobon" Objects="2235" Symbols="85" Target="Microsoft SQL Server 2008" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="15.0.0.2613"?>
<!-- do not edit this file -->
<Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
@ -26483,7 +26483,7 @@ LABL 0 Arial Unicode MS,8,N</a:FontList>
<a:Code>Ghre_StudyRule</a:Code>
<a:CreationDate>1721267637</a:CreationDate>
<a:Creator>Administrator</a:Creator>
<a:ModificationDate>1726122724</a:ModificationDate>
<a:ModificationDate>1730947770</a:ModificationDate>
<a:Modifier>Administrator</a:Modifier>
<a:Comment>必选修规则</a:Comment>
<c:Columns>
@ -26729,13 +26729,13 @@ LABL 0 Arial Unicode MS,8,N</a:FontList>
</o:Column>
<o:Column Id="o1295">
<a:ObjectID>11CD542D-061E-4B85-A96B-7A0543F3C4AE</a:ObjectID>
<a:Name>职称</a:Name>
<a:Name>岗位ID1</a:Name>
<a:Code>TitleId</a:Code>
<a:CreationDate>1721353940</a:CreationDate>
<a:Creator>Administrator</a:Creator>
<a:ModificationDate>1723284422</a:ModificationDate>
<a:ModificationDate>1730947751</a:ModificationDate>
<a:Modifier>Administrator</a:Modifier>
<a:Comment>职称</a:Comment>
<a:Comment>岗位ID</a:Comment>
<a:DataType>nvarchar(2000)</a:DataType>
<a:Length>2000</a:Length>
</o:Column>
@ -26753,13 +26753,13 @@ LABL 0 Arial Unicode MS,8,N</a:FontList>
</o:Column>
<o:Column Id="o1297">
<a:ObjectID>AF5F0E34-DA3F-4286-A4EC-88F51CDA9EF5</a:ObjectID>
<a:Name>岗位</a:Name>
<a:Name>职称</a:Name>
<a:Code>JobId</a:Code>
<a:CreationDate>1721354134</a:CreationDate>
<a:Creator>Administrator</a:Creator>
<a:ModificationDate>1723284422</a:ModificationDate>
<a:ModificationDate>1730947770</a:ModificationDate>
<a:Modifier>Administrator</a:Modifier>
<a:Comment>岗位</a:Comment>
<a:Comment>职称</a:Comment>
<a:DataType>nvarchar(2000)</a:DataType>
<a:Length>2000</a:Length>
</o:Column>

@ -149,7 +149,7 @@ app.UseAllServicesMiddle(builder.Services);
app.UseSession();
app.UseSwaggerAuthorized();
app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("Tiobon.Core.Api.index.html"));
app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("Tiobon.Core.Api.index.html"), app.Environment.IsDevelopment());
app.UseCors(AppSettings.app(new string[] { "Startup", "Cors", "PolicyName" }));
DefaultFilesOptions defaultFilesOptions = new DefaultFilesOptions();

@ -4957,7 +4957,7 @@
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRuleBase.TitleId">
<summary>
职称
岗位
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRuleBase.GradeId">
@ -4967,7 +4967,7 @@
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRuleBase.JobId">
<summary>
岗位
职称
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRuleBase.Year">
@ -14778,7 +14778,7 @@
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRule.TitleId">
<summary>
职称
岗位
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRule.GradeId">

@ -6,43 +6,46 @@ namespace Tiobon.Core.Common.Swagger;
public static class SwaggerContextExtension
{
public const string SwaggerCodeKey = "swagger-code";
public const string SwaggerJwt = "swagger-jwt";
public static bool IsSuccessSwagger()
{
return App.HttpContext?.GetSession()?.GetString(SwaggerCodeKey) == "success";
}
public static bool IsSuccessSwagger(this HttpContext context)
{
return context.GetSession()?.GetString(SwaggerCodeKey) == "success";
}
public static void SuccessSwagger()
{
App.HttpContext?.GetSession()?.SetString(SwaggerCodeKey, "success");
}
public static void SuccessSwagger(this HttpContext context)
{
context.GetSession()?.SetString(SwaggerCodeKey, "success");
}
public static void SuccessSwaggerJwt(this HttpContext context, string token)
{
context.GetSession()?.SetString(SwaggerJwt, token);
}
public static string GetSuccessSwaggerJwt(this HttpContext context)
{
return context.GetSession()?.GetString(SwaggerJwt);
}
public static void RedirectSwaggerLogin(this HttpContext context)
{
var returnUrl = context.Request.GetDisplayUrl(); //获取当前url地址
context.Response.Redirect("/swg-login.html?returnUrl=" + returnUrl);
}
public const string SwaggerCodeKey = "swagger-code";
public const string SwaggerJwt = "swagger-jwt";
public static bool IsSuccessSwagger()
{
return App.HttpContext?.GetSession()?.GetString(SwaggerCodeKey) == "success";
}
public static bool IsSuccessSwagger(this HttpContext context)
{
return context.GetSession()?.GetString(SwaggerCodeKey) == "success";
}
public static void SuccessSwagger()
{
App.HttpContext?.GetSession()?.SetString(SwaggerCodeKey, "success");
}
public static void SuccessSwagger(this HttpContext context)
{
context.GetSession()?.SetString(SwaggerCodeKey, "success");
}
public static void SuccessSwaggerJwt(this HttpContext context, string token)
{
context.GetSession()?.SetString(SwaggerJwt, token);
}
public static string GetSuccessSwaggerJwt(this HttpContext context)
{
return context.GetSession()?.GetString(SwaggerJwt);
}
public static void RedirectSwaggerLogin(this HttpContext context, bool IsDevelopment)
{
var returnUrl = context.Request.GetDisplayUrl(); //获取当前url地址
if (IsDevelopment)
context.Response.Redirect("/swg-login.html?returnUrl=" + returnUrl);
else
context.Response.Redirect("/Advanced/swg-login.html?returnUrl=" + returnUrl);
}
}

@ -3,6 +3,8 @@ using System.Threading.Tasks;
using Tiobon.Core.Common.Swagger;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace Tiobon.Core.Extensions.Middlewares
{
@ -10,10 +12,12 @@ namespace Tiobon.Core.Extensions.Middlewares
{
private readonly RequestDelegate next;
private readonly IWebHostEnvironment Env;
public SwaggerAuthMiddleware(RequestDelegate next)
public SwaggerAuthMiddleware(RequestDelegate next, IWebHostEnvironment env)
{
this.next = next;
Env = env;
}
public async Task InvokeAsync(HttpContext context)
@ -29,7 +33,7 @@ namespace Tiobon.Core.Extensions.Middlewares
}
// 无权限,跳转swagger登录页
context.RedirectSwaggerLogin();
context.RedirectSwaggerLogin(Env.IsDevelopment());
}
else
{

@ -111,7 +111,7 @@ namespace Tiobon.Core.Extensions
services.AddSwaggerGenNewtonsoftSupport();
}
public static void UseSwaggerMiddle(this IApplicationBuilder app, Func<Stream> streamHtml)
public static void UseSwaggerMiddle(this IApplicationBuilder app, Func<Stream> streamHtml, bool IsDevelopment)
{
if (app == null) throw new ArgumentNullException(nameof(app));
@ -121,7 +121,11 @@ namespace Tiobon.Core.Extensions
// 遍历分组信息,生成Json
ApiInfos.ForEach(x =>
{
options.SwaggerEndpoint($"/swagger/{x.UrlPrefix}/swagger.json", x.Name);
if (IsDevelopment)
options.SwaggerEndpoint($"/swagger/{x.UrlPrefix}/swagger.json", x.Name);
else
options.SwaggerEndpoint($"/Advanced/swagger/{x.UrlPrefix}/swagger.json", x.Name);
});
// 模型的默认扩展深度,设置为 -1 完全隐藏模型
options.DefaultModelsExpandDepth(-1);

@ -61,9 +61,9 @@ namespace Tiobon.Core.Model.Models
public string DeptId { get; set; }
/// <summary>
/// 职称
/// 岗位
/// </summary>
[Display(Name = "TitleId"), Description("职称"), MaxLength(2000, ErrorMessage = "职称 不能超过 2000 个字符")]
[Display(Name = "TitleId"), Description("岗位"), MaxLength(2000, ErrorMessage = "岗位 不能超过 2000 个字符")]
public string TitleId { get; set; }
/// <summary>
@ -73,9 +73,9 @@ namespace Tiobon.Core.Model.Models
public string GradeId { get; set; }
/// <summary>
/// 岗位
/// 职称
/// </summary>
[Display(Name = "JobId"), Description("岗位"), MaxLength(2000, ErrorMessage = "岗位 不能超过 2000 个字符")]
[Display(Name = "JobId"), Description("职称"), MaxLength(2000, ErrorMessage = "职称 不能超过 2000 个字符")]
public string JobId { get; set; }
/// <summary>

@ -63,9 +63,9 @@ namespace Tiobon.Core.Model.Models
public string DeptId { get; set; }
/// <summary>
/// 职称
/// 岗位
/// </summary>
[Display(Name = "TitleId"), Description("职称"), MaxLength(2000, ErrorMessage = "职称 不能超过 2000 个字符")]
[Display(Name = "TitleId"), Description("岗位"), MaxLength(2000, ErrorMessage = "岗位 不能超过 2000 个字符")]
public string TitleId { get; set; }
/// <summary>
@ -77,7 +77,7 @@ namespace Tiobon.Core.Model.Models
/// <summary>
/// 岗位
/// </summary>
[Display(Name = "JobId"), Description("岗位"), MaxLength(2000, ErrorMessage = "岗位 不能超过 2000 个字符")]
[Display(Name = "JobId"), Description("职称"), MaxLength(2000, ErrorMessage = "职称 不能超过 2000 个字符")]
public string JobId { get; set; }
/// <summary>

@ -68,6 +68,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tiobon.Core.PublishHelper",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tiobon.Core.Jobs", "Tiobon.Core.Jobs\Tiobon.Core.Jobs.csproj", "{CF66C4DE-8E0C-4FAD-901A-2B7E1E485ABA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tiobon.Core.OPS.Tool", "Tiobon.Core.OPS.Tool\Tiobon.Core.OPS.Tool.csproj", "{1C0E27D6-B516-4D30-B559-C9097476DEEC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -150,6 +152,10 @@ Global
{CF66C4DE-8E0C-4FAD-901A-2B7E1E485ABA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF66C4DE-8E0C-4FAD-901A-2B7E1E485ABA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF66C4DE-8E0C-4FAD-901A-2B7E1E485ABA}.Release|Any CPU.Build.0 = Release|Any CPU
{1C0E27D6-B516-4D30-B559-C9097476DEEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C0E27D6-B516-4D30-B559-C9097476DEEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C0E27D6-B516-4D30-B559-C9097476DEEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C0E27D6-B516-4D30-B559-C9097476DEEC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -162,6 +168,7 @@ Global
{1CD6CC3C-D58C-47D1-9F9A-671BB9261A46} = {EDA8901E-541E-4ADC-B71E-59697D5F9549}
{BA7081E8-08F2-4CC2-ACD9-E878C0CDE313} = {047A9723-9AAC-42E3-8C69-B3835F15FF96}
{9B5E9966-1B4E-427E-838F-4AF0B742BE6C} = {047A9723-9AAC-42E3-8C69-B3835F15FF96}
{1C0E27D6-B516-4D30-B559-C9097476DEEC} = {047A9723-9AAC-42E3-8C69-B3835F15FF96}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AB40D0C5-E3EA-4A9B-86C2-38F0BB33FC04}

@ -4957,7 +4957,7 @@
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRuleBase.TitleId">
<summary>
职称
岗位
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRuleBase.GradeId">
@ -4967,7 +4967,7 @@
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRuleBase.JobId">
<summary>
岗位
职称
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRuleBase.Year">
@ -14778,7 +14778,7 @@
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRule.TitleId">
<summary>
职称
岗位
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRule.GradeId">

Loading…
Cancel
Save