mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-05 09:10:53 +08:00
短信发送
This commit is contained in:
@@ -4,6 +4,7 @@ using Microsoft.OpenApi.Models;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Yi.Framework.Common.IOCOptions;
|
||||
using Yi.Framework.Core;
|
||||
|
||||
namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
{
|
||||
@@ -17,6 +18,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
if (Appsettings.appBool("RabbitMQ_Enabled"))
|
||||
{
|
||||
services.Configure<RabbitMQOptions>(Appsettings.appConfiguration("RabbitConn"));
|
||||
services.AddTransient<RabbitMQInvoker>();
|
||||
}
|
||||
return services;
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Yi.Framework.Common.IOCOptions;
|
||||
using Yi.Framework.Core;
|
||||
using Yi.Framework.Core.SMS;
|
||||
|
||||
namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
{
|
||||
/// <summary>
|
||||
/// Redis扩展
|
||||
/// </summary>
|
||||
public static class SMSExtension
|
||||
{
|
||||
public static IServiceCollection AddSMSService(this IServiceCollection services)
|
||||
{
|
||||
if (Appsettings.appBool("SMS_Enabled"))
|
||||
{
|
||||
|
||||
services.Configure<SMSOptions>(Appsettings.appConfiguration("SMS"));
|
||||
services.AddTransient<AliyunSMSInvoker>();
|
||||
}
|
||||
return services;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using IGeekFan.AspNetCore.Knife4jUI;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System;
|
||||
@@ -32,7 +34,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
var apiXmlPath = Path.Combine(basePath, @"SwaggerDoc.xml");//控制器层注释
|
||||
//var entityXmlPath = Path.Combine(basePath, @"SwaggerDoc.xml");//实体注释
|
||||
//c.IncludeXmlComments(apiXmlPath, true);//true表示显示控制器注释
|
||||
c.IncludeXmlComments(apiXmlPath);
|
||||
c.IncludeXmlComments(apiXmlPath,true);
|
||||
|
||||
//添加控制器注释
|
||||
//c.DocumentFilter<SwaggerDocTag>();
|
||||
@@ -59,6 +61,17 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
}
|
||||
}, Array.Empty<string>() }
|
||||
});
|
||||
|
||||
c.AddServer(new OpenApiServer()
|
||||
{
|
||||
Url = "https://ccnetcore.com",
|
||||
Description = "Yi-Framework"
|
||||
});
|
||||
c.CustomOperationIds(apiDesc =>
|
||||
{
|
||||
var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor;
|
||||
return controllerAction.ActionName;
|
||||
});
|
||||
});
|
||||
#endregion
|
||||
|
||||
@@ -70,11 +83,14 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
//在 Startup.Configure 方法中,启用中间件为生成的 JSON 文档和 Swagger UI 提供服务:
|
||||
// Enable middleware to serve generated Swagger as a JSON endpoint.
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c =>
|
||||
|
||||
|
||||
app.UseKnife4UI(c =>
|
||||
{
|
||||
c.RoutePrefix = "swagger"; // serve the UI at root
|
||||
if (swaggerModels.Length == 0)
|
||||
{
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi.Framework");
|
||||
c.SwaggerEndpoint("/v1/swagger.json", "Yi.Framework");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -83,10 +99,25 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
c.SwaggerEndpoint(k.url, k.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
//app.UseSwaggerUI(c =>
|
||||
//{
|
||||
// if (swaggerModels.Length == 0)
|
||||
// {
|
||||
// c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi.Framework");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// foreach (var k in swaggerModels)
|
||||
// {
|
||||
// c.SwaggerEndpoint(k.url, k.name);
|
||||
// }
|
||||
// }
|
||||
|
||||
);
|
||||
//}
|
||||
|
||||
//);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user