升级依赖以及数据迁移
This commit is contained in:
parent
3d402d01bc
commit
c15e1ed3ac
@ -36,7 +36,6 @@ global using Microsoft.Extensions.Logging;
|
|||||||
global using Microsoft.Extensions.Logging.Abstractions;
|
global using Microsoft.Extensions.Logging.Abstractions;
|
||||||
global using Microsoft.Extensions.Options;
|
global using Microsoft.Extensions.Options;
|
||||||
global using Microsoft.IdentityModel.Tokens;
|
global using Microsoft.IdentityModel.Tokens;
|
||||||
global using Microsoft.OpenApi.Models;
|
|
||||||
global using JiShe.IoT;
|
global using JiShe.IoT;
|
||||||
global using Serilog;
|
global using Serilog;
|
||||||
global using StackExchange.Redis;
|
global using StackExchange.Redis;
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
|
using Google.Protobuf.Compiler;
|
||||||
using Hangfire.Redis.StackExchange;
|
using Hangfire.Redis.StackExchange;
|
||||||
using JiShe.ServicePro.FreeRedisProvider;
|
using JiShe.ServicePro.FreeRedisProvider;
|
||||||
using JiShe.ServicePro.SwaggerConfigs;
|
using JiShe.ServicePro.SwaggerConfigs;
|
||||||
using Medallion.Threading;
|
using Medallion.Threading;
|
||||||
using Medallion.Threading.Redis;
|
using Medallion.Threading.Redis;
|
||||||
using Microsoft.CodeAnalysis;
|
using Microsoft.CodeAnalysis;
|
||||||
|
using Microsoft.OpenApi;
|
||||||
using Volo.Abp.BlobStoring;
|
using Volo.Abp.BlobStoring;
|
||||||
using Volo.Abp.BlobStoring.FileSystem;
|
using Volo.Abp.BlobStoring.FileSystem;
|
||||||
|
|
||||||
@ -145,102 +147,7 @@ public partial class IoTHttpApiHostModule
|
|||||||
|
|
||||||
private void ConfigureSwaggerServices(ServiceConfigurationContext context)
|
private void ConfigureSwaggerServices(ServiceConfigurationContext context)
|
||||||
{
|
{
|
||||||
context.Services.AddSwaggerGen(
|
context.Services.AddJiSheServiceProSwagger("AbpPro");
|
||||||
options =>
|
|
||||||
{
|
|
||||||
// 文件下载类型
|
|
||||||
options.MapType<FileContentResult>(() => new OpenApiSchema() { Type = "file" });
|
|
||||||
|
|
||||||
options.SwaggerDoc("AbpPro", new OpenApiInfo { Title = "AbpPro API", Version = "v1" });
|
|
||||||
|
|
||||||
var configuration = context.Services.GetConfiguration();
|
|
||||||
var groupNames = EnumExtensions.GetEnumTypeValueNameList<SwaggerGroupEnum>();
|
|
||||||
var excludeSwaggerGroups = configuration.GetSection("ExcludeSwaggerGroup").Get<List<string>>() ?? new List<string>();
|
|
||||||
|
|
||||||
groupNames.ForEach(group =>
|
|
||||||
{
|
|
||||||
if (!excludeSwaggerGroups.Where(e => e == group.Key).Any())
|
|
||||||
{
|
|
||||||
options.SwaggerDoc(group.Key,
|
|
||||||
new OpenApiInfo { Title = group.Value, Version = "v1" });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
options.DocInclusionPredicate((docName, description) =>
|
|
||||||
{
|
|
||||||
if (docName == "AbpPro")
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return description.GroupName == docName;
|
|
||||||
});
|
|
||||||
|
|
||||||
//options.EnableAnnotations(enableAnnotationsForInheritance: true, enableAnnotationsForPolymorphism: true); // 启用注解
|
|
||||||
options.DocumentFilter<HiddenAbpDefaultApiFilter>();
|
|
||||||
options.SchemaFilter<EnumSchemaFilter>();
|
|
||||||
// 加载所有xml注释,这里会导致swagger加载有点缓慢
|
|
||||||
var xmlPaths = Directory.GetFiles(AppContext.BaseDirectory, "*.xml");
|
|
||||||
foreach (var xml in xmlPaths)
|
|
||||||
{
|
|
||||||
options.IncludeXmlComments(xml, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加载 模块引入的xml注释
|
|
||||||
// 加载所有xml注释,这里会导致swagger加载有点缓慢
|
|
||||||
var modulePath = Path.Combine(AppContext.BaseDirectory, "moduleSwagger");
|
|
||||||
if (Directory.Exists(modulePath))
|
|
||||||
{
|
|
||||||
var xmlModulePaths = Directory.GetFiles(modulePath, "*.xml");
|
|
||||||
foreach (var xml in xmlModulePaths)
|
|
||||||
{
|
|
||||||
options.IncludeXmlComments(xml, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
options.AddSecurityDefinition(JwtBearerDefaults.AuthenticationScheme,
|
|
||||||
new OpenApiSecurityScheme()
|
|
||||||
{
|
|
||||||
Description = "直接在下框输入JWT生成的Token",
|
|
||||||
Name = "Authorization",
|
|
||||||
In = ParameterLocation.Header,
|
|
||||||
Type = SecuritySchemeType.Http,
|
|
||||||
Scheme = JwtBearerDefaults.AuthenticationScheme,
|
|
||||||
BearerFormat = "JWT"
|
|
||||||
});
|
|
||||||
options.AddSecurityRequirement(new OpenApiSecurityRequirement
|
|
||||||
{
|
|
||||||
{
|
|
||||||
new OpenApiSecurityScheme
|
|
||||||
{
|
|
||||||
Reference = new OpenApiReference
|
|
||||||
{
|
|
||||||
Type = ReferenceType.SecurityScheme, Id = "Bearer"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new List<string>()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
options.AddSecurityDefinition("ApiKey", new OpenApiSecurityScheme()
|
|
||||||
{
|
|
||||||
Type = SecuritySchemeType.ApiKey,
|
|
||||||
In = ParameterLocation.Header,
|
|
||||||
Name = "Accept-Language",
|
|
||||||
Description = "多语言设置,系统预设语言有zh-Hans、en,默认为zh-Hans",
|
|
||||||
});
|
|
||||||
|
|
||||||
options.AddSecurityRequirement(new OpenApiSecurityRequirement
|
|
||||||
{
|
|
||||||
{
|
|
||||||
new OpenApiSecurityScheme
|
|
||||||
{
|
|
||||||
Reference = new OpenApiReference
|
|
||||||
{ Type = ReferenceType.SecurityScheme, Id = "ApiKey" }
|
|
||||||
},
|
|
||||||
Array.Empty<string>()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -88,39 +88,13 @@ namespace JiShe.IoT
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
app.UseSwagger();
|
app.UseJiSheServiceProSwaggerUI(configuration,"/swagger/AbpPro/swagger.json", "AbpPro",true);
|
||||||
app.UseAbpSwaggerUI(options =>
|
|
||||||
{
|
|
||||||
var groupNames = System.EnumExtensions.GetEnumTypeValueNameList<SwaggerGroupEnum>();
|
|
||||||
var excludeSwaggerGroups = configuration.GetSection("ExcludeSwaggerGroup").Get<List<string>>() ?? new List<string>();
|
|
||||||
groupNames.ForEach(attr =>
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!excludeSwaggerGroups.Where(e => e == attr.Key).Any())
|
|
||||||
{
|
|
||||||
options.SwaggerEndpoint($"/swagger/{attr.Key}/swagger.json", attr.Value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
options.SwaggerEndpoint("/swagger/AbpPro/swagger.json", "AbpPro API");
|
|
||||||
|
|
||||||
options.DocExpansion(DocExpansion.None);
|
|
||||||
options.DefaultModelsExpandDepth(-1);
|
|
||||||
});
|
|
||||||
|
|
||||||
app.UseAuditing();
|
app.UseAuditing();
|
||||||
app.UseAbpSerilogEnrichers();
|
app.UseAbpSerilogEnrichers();
|
||||||
app.UseUnitOfWork();
|
app.UseUnitOfWork();
|
||||||
app.UseConfiguredEndpoints(endpoints =>
|
app.UseConfiguredEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
endpoints.MapHealthChecks("/health");
|
endpoints.MapHealthChecks("/health");
|
||||||
|
|
||||||
// endpoints.MapHangfireDashboard("/hangfire", new DashboardOptions()
|
|
||||||
// {
|
|
||||||
// Authorization = new[] { new CustomHangfireAuthorizeFilter() },
|
|
||||||
// IgnoreAntiforgeryToken = true
|
|
||||||
// });
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (configuration.GetValue("Consul:Enabled", false))
|
if (configuration.GetValue("Consul:Enabled", false))
|
||||||
|
|||||||
@ -47,15 +47,15 @@ public class Program
|
|||||||
//options.Limits.MaxConcurrentConnections = 1000;//限制并发连接数,默认无限制
|
//options.Limits.MaxConcurrentConnections = 1000;//限制并发连接数,默认无限制
|
||||||
|
|
||||||
});
|
});
|
||||||
builder.WebHost.UseUrls($"http://+:10500");
|
builder.WebHost.UseUrls($"http://+:20500");
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
await app.InitializeApplicationAsync();
|
await app.InitializeApplicationAsync();
|
||||||
await app.RunAsync();
|
await app.RunAsync();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw;
|
throw ex;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
|
using JiShe.ServicePro.PulsarProvider;
|
||||||
using Volo.Abp.Localization;
|
using Volo.Abp.Localization;
|
||||||
|
|
||||||
namespace JiShe.IoT.DbMigrator
|
namespace JiShe.IoT.DbMigrator
|
||||||
{
|
{
|
||||||
[DependsOn(
|
[DependsOn(
|
||||||
typeof(AbpAutofacModule),
|
typeof(AbpAutofacModule),
|
||||||
typeof(IoTEntityFrameworkCoreModule),
|
typeof(IoTEntityFrameworkCoreModule),
|
||||||
typeof(IoTApplicationContractsModule)
|
typeof(IoTApplicationContractsModule)
|
||||||
)]
|
)]
|
||||||
|
|||||||
@ -89,6 +89,7 @@ namespace JiShe.IoT.EntityFrameworkCore
|
|||||||
public DbSet<OneNETAccountInfos> OneNETAccountInfo { get; set; }
|
public DbSet<OneNETAccountInfos> OneNETAccountInfo { get; set; }
|
||||||
public DbSet<OneNETProductInfos> OneNETProductInfo { get; set; }
|
public DbSet<OneNETProductInfos> OneNETProductInfo { get; set; }
|
||||||
|
|
||||||
|
public DbSet<ResourcePermissionGrant> ResourcePermissionGrants { get; set; }
|
||||||
|
|
||||||
public IoTDbContext(DbContextOptions<IoTDbContext> options)
|
public IoTDbContext(DbContextOptions<IoTDbContext> options)
|
||||||
: base(options)
|
: base(options)
|
||||||
|
|||||||
4492
src/JiShe.IoT.EntityFrameworkCore/Migrations/20260320152205_InitialCreate.Designer.cs
generated
Normal file
4492
src/JiShe.IoT.EntityFrameworkCore/Migrations/20260320152205_InitialCreate.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user