diff --git a/Dockerfile b/Dockerfile index a5e310d3..63fa2768 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,10 @@ RUN apt-get update -qq && apt-get -y install libgdiplus libc6-dev EXPOSE 80 EXPOSE 443 +COPY ["src/WMS.Web.Api/wwwroot/Ops.Web.Api.xml", "/app/WMS.Web.Api.xml"] +COPY ["src/WMS.Web.Api/wwwroot/Ops.Web.Core.xml", "/app/WMS.Web.Core.xml"] +COPY ["src/WMS.Web.Api/wwwroot/Ops.Web.Domain.xml", "/app/WMS.Web.Domain.xml"] + FROM registry.cn-hangzhou.aliyuncs.com/yz-ops/base-module:aspnetsdk3.1 AS build WORKDIR /src COPY ["src/WMS.Web.Api/WMS.Web.Api.csproj", "src/WMS.Web.Api/"] diff --git a/src/WMS.Web.Api/Startup.cs b/src/WMS.Web.Api/Startup.cs index 0d1b7ae4..b24d7b03 100644 --- a/src/WMS.Web.Api/Startup.cs +++ b/src/WMS.Web.Api/Startup.cs @@ -48,48 +48,7 @@ namespace WMS.Web.Api builder.AddDbContext( opt => { opt.UseMySql(option.DBConnectionString, serverVersion); }); }); - if (WebHostEnvironment.IsDevelopment()) - { - // 注册Swagger服务 - services.AddSwaggerGen(c => - { - // 添加文档信息 - c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo - { - Title = "WMS", - Version = "v1", - Description = "WMS-Api" - }); - #region 读取xml信息 - // 使用反射获取xml文件。并构造出文件的路径 - //// 启用xml注释. 该方法第二个参数启用控制器的注释,默认为false. - foreach (var file in Directory.GetFiles(AppContext.BaseDirectory, "WMS.*.xml")) c.IncludeXmlComments(file, true); - #endregion - - #region 启用swagger验证功能 - //添加一个必须的全局安全信息,和AddSecurityDefinition方法指定的方案名称一致即可,CoreAPI。 - var securit = new OpenApiSecurityRequirement() - { - { - new OpenApiSecurityScheme - { - Reference=new OpenApiReference { Type=ReferenceType.SecurityScheme,Id= "WMSAPI" } - }, - new string[] { } - } - }; - c.AddSecurityRequirement(securit); - c.AddSecurityDefinition("WMSAPI", new OpenApiSecurityScheme - { - Description = "JWT授权(数据将在请求头中进行传输) 在下方输入Bearer {token} 即可", - Name = "Authorization",//jwt默认的参数名称 - In = ParameterLocation.Header,//jwt默认存放Authorization信息的位置(请求头中) - Type = SecuritySchemeType.ApiKey - }); - #endregion - - }); - } + services.AddControllers(); //移除:http请求的默认日志处理器(备注:也可以实现它,自定义自己想要的日志,文档地址https://docs.microsoft.com/zh-cn/dotnet/core/compatibility/aspnet-core/5.0/http-httpclient-instances-log-integer-status-codes) services.RemoveAll(); diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml index 3e28250d..8e5b0949 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml @@ -915,6 +915,11 @@ + + + 鐢熸垚鍗曟嵁鍙 + + wms鐩樼偣鍗曟槑缁 diff --git a/src/WMS.Web.Repositories/DependencyInjection/AppBuilder.cs b/src/WMS.Web.Repositories/DependencyInjection/AppBuilder.cs index 0cb6e997..bb5e8c89 100644 --- a/src/WMS.Web.Repositories/DependencyInjection/AppBuilder.cs +++ b/src/WMS.Web.Repositories/DependencyInjection/AppBuilder.cs @@ -51,7 +51,7 @@ namespace WMS.Web.Repositories.DependencyInjection { this.AddCors(); this.InitRedis(); - //this.AddSwagger(); + this.AddSwagger(); this.AddOther(); this.AddConfigOptions(); this.AddServiceRepositories();