diff --git a/Cis.Application/Cis.Application.csproj b/Cis.Application/Cis.Application.csproj new file mode 100644 index 0000000..307222f --- /dev/null +++ b/Cis.Application/Cis.Application.csproj @@ -0,0 +1,25 @@ + + + + net6.0 + 1701;1702;1591 + Cis.Application.xml + enable + + + + + + + + + + PreserveNewest + + + + + + + + diff --git a/Cis.Application/Cis.Application.xml b/Cis.Application/Cis.Application.xml new file mode 100644 index 0000000..df7075f --- /dev/null +++ b/Cis.Application/Cis.Application.xml @@ -0,0 +1,19 @@ + + + + Cis.Application + + + + + 系统服务接口 + + + + + 获取系统描述 + + + + + diff --git a/Cis.Application/GlobalUsings.cs b/Cis.Application/GlobalUsings.cs new file mode 100644 index 0000000..1f0aacd --- /dev/null +++ b/Cis.Application/GlobalUsings.cs @@ -0,0 +1,15 @@ +global using Furion; +global using Furion.DataEncryption; +global using Furion.DataValidation; +global using Furion.DependencyInjection; +global using Furion.DynamicApiController; +global using Furion.Extensions; +global using Furion.FriendlyException; +global using Furion.Logging; +global using Mapster; +global using Microsoft.AspNetCore.Authorization; +global using Microsoft.AspNetCore.Http; +global using Microsoft.AspNetCore.Mvc; +global using Microsoft.CodeAnalysis; +global using System.ComponentModel.DataAnnotations; +global using SqlSugar; \ No newline at end of file diff --git a/Cis.Application/applicationsettings.json b/Cis.Application/applicationsettings.json new file mode 100644 index 0000000..331a6c6 --- /dev/null +++ b/Cis.Application/applicationsettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json", + "SpecificationDocumentSettings": { + "DocumentTitle": "Furion | 规范化接口", + "GroupOpenApiInfos": [ + { + "Group": "Default", + "Title": "规范化接口演示", + "Description": "让 .NET 开发更简单,更通用,更流行。", + "Version": "1.0.0", + "TermsOfService": "https://furion.icu", + "Contact": { + "Name": "百小僧", + "Url": "https://gitee.com/monksoul", + "Email": "monksoul@outlook.com" + }, + "License": { + "Name": "Apache-2.0", + "Url": "https://gitee.com/dotnetchina/Furion/blob/rc1/LICENSE" + } + } + ] + }, + "CorsAccessorSettings": { + "WithExposedHeaders": [ + "access-token", + "x-access-token", + "environment" + ] + } +} \ No newline at end of file diff --git a/Cis.Core/Cis.Core.csproj b/Cis.Core/Cis.Core.csproj new file mode 100644 index 0000000..2f2311d --- /dev/null +++ b/Cis.Core/Cis.Core.csproj @@ -0,0 +1,20 @@ + + + + net6.0 + 1701;1702;1591 + Cis.Core.xml + + + + + + + + + + + + + + diff --git a/Cis.Core/Cis.Core.xml b/Cis.Core/Cis.Core.xml new file mode 100644 index 0000000..f4bb90e --- /dev/null +++ b/Cis.Core/Cis.Core.xml @@ -0,0 +1,18 @@ + + + + Cis.Core + + + + + 数据库上下文对象 + + + + + SqlSugar 数据库实例 + + + + diff --git a/Cis.Core/DbContext.cs b/Cis.Core/DbContext.cs new file mode 100644 index 0000000..365d73a --- /dev/null +++ b/Cis.Core/DbContext.cs @@ -0,0 +1,22 @@ +using Furion; +using SqlSugar; +using System.Collections.Generic; + +namespace Cis.Core; + +/// +/// 数据库上下文对象 +/// +public static class DbContext +{ + /// + /// SqlSugar 数据库实例 + /// + public static readonly SqlSugarScope Instance = new( + // 读取 appsettings.json 中的 ConnectionConfigs 配置节点 + App.GetConfig>("ConnectionConfigs") + , db => + { + // 这里配置全局事件,比如拦截执行 SQL + }); +} diff --git a/Cis.Web.Core/Cis.Web.Core.csproj b/Cis.Web.Core/Cis.Web.Core.csproj new file mode 100644 index 0000000..4a8fc98 --- /dev/null +++ b/Cis.Web.Core/Cis.Web.Core.csproj @@ -0,0 +1,17 @@ + + + + net6.0 + 1701;1702;1591 + Cis.Web.Core.xml + + + + + + + + + + + diff --git a/Cis.Web.Core/Cis.Web.Core.xml b/Cis.Web.Core/Cis.Web.Core.xml new file mode 100644 index 0000000..dff0058 --- /dev/null +++ b/Cis.Web.Core/Cis.Web.Core.xml @@ -0,0 +1,8 @@ + + + + Cis.Web.Core + + + + diff --git a/Cis.Web.Core/Handlers/JwtHandler.cs b/Cis.Web.Core/Handlers/JwtHandler.cs new file mode 100644 index 0000000..575a8ca --- /dev/null +++ b/Cis.Web.Core/Handlers/JwtHandler.cs @@ -0,0 +1,16 @@ +using Furion.Authorization; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using System.Threading.Tasks; + +namespace Cis.Web.Core; + +public class JwtHandler : AppAuthorizeHandler +{ + public override Task PipelineAsync(AuthorizationHandlerContext context, DefaultHttpContext httpContext) + { + // 这里写您的授权判断逻辑,授权通过返回 true,否则返回 false + + return Task.FromResult(true); + } +} diff --git a/Cis.Web.Core/Startup.cs b/Cis.Web.Core/Startup.cs new file mode 100644 index 0000000..5083893 --- /dev/null +++ b/Cis.Web.Core/Startup.cs @@ -0,0 +1,51 @@ +using Furion; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace Cis.Web.Core; + +public class Startup : AppStartup +{ + public void ConfigureServices(IServiceCollection services) + { + services.AddJwt(); + + services.AddCorsAccessor(); + + services.AddControllersWithViews() + .AddInjectWithUnifyResult(); + } + + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseExceptionHandler("/Home/Error"); + app.UseHsts(); + } + app.UseHttpsRedirection(); + app.UseStaticFiles(); + + app.UseRouting(); + + app.UseCorsAccessor(); + + app.UseAuthentication(); + app.UseAuthorization(); + + app.UseInject(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllerRoute( + name: "default", + pattern: "{controller=Home}/{action=Index}/{id?}"); + }); + } +} diff --git a/Cis.Web.Entry/Cis.Web.Entry.csproj b/Cis.Web.Entry/Cis.Web.Entry.csproj new file mode 100644 index 0000000..6392984 --- /dev/null +++ b/Cis.Web.Entry/Cis.Web.Entry.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + en-US + + + + + + + diff --git a/Cis.Web.Entry/Controllers/HomeController.cs b/Cis.Web.Entry/Controllers/HomeController.cs new file mode 100644 index 0000000..23ddfb4 --- /dev/null +++ b/Cis.Web.Entry/Controllers/HomeController.cs @@ -0,0 +1,23 @@ +using Cis.Application; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace Cis.Web.Entry.Controllers; + +[AllowAnonymous] +public class HomeController : Controller +{ + private readonly ISystemService _systemService; + + public HomeController(ISystemService systemService) + { + _systemService = systemService; + } + + public IActionResult Index() + { + ViewBag.Description = _systemService.GetDescription(); + + return View(); + } +} diff --git a/Cis.Web.Entry/Program.cs b/Cis.Web.Entry/Program.cs new file mode 100644 index 0000000..611ed5a --- /dev/null +++ b/Cis.Web.Entry/Program.cs @@ -0,0 +1 @@ +Serve.Run(RunOptions.Default.WithArgs(args)); \ No newline at end of file diff --git a/Cis.Web.Entry/Properties/launchSettings.json b/Cis.Web.Entry/Properties/launchSettings.json new file mode 100644 index 0000000..37d1e2f --- /dev/null +++ b/Cis.Web.Entry/Properties/launchSettings.json @@ -0,0 +1,28 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:58595", + "sslPort": 44326 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Cis.Web.Entry": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Cis.Web.Entry/Views/Home/Index.cshtml b/Cis.Web.Entry/Views/Home/Index.cshtml new file mode 100644 index 0000000..d6e2832 --- /dev/null +++ b/Cis.Web.Entry/Views/Home/Index.cshtml @@ -0,0 +1,12 @@ +@{ + ViewData["Title"] = ViewBag.Description; +} + +
+ +
+

star fork GitHub stars GitHub forks GitHub license nuget

+
+

@ViewBag.Description

+

API 接口      源码地址

+
\ No newline at end of file diff --git a/Cis.Web.Entry/Views/Shared/_Layout.cshtml b/Cis.Web.Entry/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..f5f94a0 --- /dev/null +++ b/Cis.Web.Entry/Views/Shared/_Layout.cshtml @@ -0,0 +1,11 @@ + + + + + + @ViewData["Title"] - Furion + + + @RenderBody() + + \ No newline at end of file diff --git a/Cis.Web.Entry/Views/_ViewImports.cshtml b/Cis.Web.Entry/Views/_ViewImports.cshtml new file mode 100644 index 0000000..51c915c --- /dev/null +++ b/Cis.Web.Entry/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@using Cis.Web.Entry +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers \ No newline at end of file diff --git a/Cis.Web.Entry/Views/_ViewStart.cshtml b/Cis.Web.Entry/Views/_ViewStart.cshtml new file mode 100644 index 0000000..1af6e49 --- /dev/null +++ b/Cis.Web.Entry/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} \ No newline at end of file diff --git a/Cis.Web.Entry/appsettings.Development.json b/Cis.Web.Entry/appsettings.Development.json new file mode 100644 index 0000000..5f187ae --- /dev/null +++ b/Cis.Web.Entry/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json", + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning", + "Microsoft.EntityFrameworkCore": "Information" + } + } +} \ No newline at end of file diff --git a/Cis.Web.Entry/appsettings.json b/Cis.Web.Entry/appsettings.json new file mode 100644 index 0000000..8b4498e --- /dev/null +++ b/Cis.Web.Entry/appsettings.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json", + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning", + "Microsoft.EntityFrameworkCore": "Information" + } + }, + "AllowedHosts": "*", + "ConnectionConfigs": [ + { + "ConnectionString": "Data Source=./Furion.db", + "DbType": "Sqlite", + "IsAutoCloseConnection": true + } + ] +} \ No newline at end of file diff --git a/Cis.Web.Entry/wwwroot/images/logo.png b/Cis.Web.Entry/wwwroot/images/logo.png new file mode 100644 index 0000000..166b801 Binary files /dev/null and b/Cis.Web.Entry/wwwroot/images/logo.png differ diff --git a/Cis.sln b/Cis.sln new file mode 100644 index 0000000..3ce8f72 --- /dev/null +++ b/Cis.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32519.111 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cis.Application", "Cis.Application\Cis.Application.csproj", "{AB699EE9-43A8-46F2-A855-04A26DE63372}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cis.Web.Core", "Cis.Web.Core\Cis.Web.Core.csproj", "{9D14BB78-DA2A-4040-B9DB-5A515B599181}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cis.Core", "Cis.Core\Cis.Core.csproj", "{4FB30091-15C7-4FD9-AB7D-266814F360F5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cis.Web.Entry", "Cis.Web.Entry\Cis.Web.Entry.csproj", "{9826E365-EEE9-4721-A738-B02AB64D47E5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AB699EE9-43A8-46F2-A855-04A26DE63372}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AB699EE9-43A8-46F2-A855-04A26DE63372}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AB699EE9-43A8-46F2-A855-04A26DE63372}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AB699EE9-43A8-46F2-A855-04A26DE63372}.Release|Any CPU.Build.0 = Release|Any CPU + {9D14BB78-DA2A-4040-B9DB-5A515B599181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D14BB78-DA2A-4040-B9DB-5A515B599181}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D14BB78-DA2A-4040-B9DB-5A515B599181}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D14BB78-DA2A-4040-B9DB-5A515B599181}.Release|Any CPU.Build.0 = Release|Any CPU + {4FB30091-15C7-4FD9-AB7D-266814F360F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4FB30091-15C7-4FD9-AB7D-266814F360F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4FB30091-15C7-4FD9-AB7D-266814F360F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4FB30091-15C7-4FD9-AB7D-266814F360F5}.Release|Any CPU.Build.0 = Release|Any CPU + {9826E365-EEE9-4721-A738-B02AB64D47E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9826E365-EEE9-4721-A738-B02AB64D47E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9826E365-EEE9-4721-A738-B02AB64D47E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9826E365-EEE9-4721-A738-B02AB64D47E5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B2073C2C-0FD3-452B-8047-8134D68E12CE} + EndGlobalSection +EndGlobal