wx
2022-02-18 b62ffe3c3a19aa7f2232c72d5fd81e893841c421
框架
1个文件已修改
23个文件已添加
834 ■■■■■ 已修改文件
.gitignore 231 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Application/System/Dtos/Mapper.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Application/System/Services/ISystemService.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Application/System/Services/SystemService.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Application/System/SystemAppService.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Application/ZTICInterface.Application.csproj 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Application/ZTICInterface.Application.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Application/applicationsettings.json 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Core/Extend/MyConstant.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Core/Extend/TranReturn.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Core/RESTfulResultProvider.cs 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Core/SqlsugarSetup.cs 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Core/ZTICInterface.Core.csproj 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Core/ZTICInterface.Core.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Web.Core/Handlers/JwtHandler.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Web.Core/Startup.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Web.Core/ZTICInterface.Web.Core.csproj 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Web.Core/ZTICInterface.Web.Core.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Web.Entry/Program.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Web.Entry/Properties/launchSettings.json 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Web.Entry/ZTICInterface.Web.Entry.csproj 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Web.Entry/appsettings.Development.json 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Web.Entry/appsettings.json 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.sln 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -1,10 +1,20 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
@@ -12,35 +22,64 @@
[Rr]elease/
[Rr]eleases/
x64/
build/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Roslyn cache directories
*.ide/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
#NUNIT
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
@@ -50,6 +89,7 @@
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
@@ -65,14 +105,21 @@
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
@@ -85,18 +132,29 @@
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
@@ -124,43 +182,71 @@
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
packages/*
*.nupkg
## TODO: If the tool you use requires repositories.config
## uncomment the next line
#!packages/repositories.config
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Enable "build/" folder in the NuGet Packages folder since
# NuGet packages use it for MSBuild targets.
# This line needs to be after the ignore of the build folder
# (and the packages folder if the line above has been uncommented)
!packages/build/
# Windows Azure Build Output
# Microsoft Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
@@ -172,15 +258,106 @@
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
ZTICInterface.Application/System/Dtos/Mapper.cs
New file
@@ -0,0 +1,10 @@
using Mapster;
namespace ZTICInterface.Application;
public class Mapper : IRegister
{
    public void Register(TypeAdapterConfig config)
    {
    }
}
ZTICInterface.Application/System/Services/ISystemService.cs
New file
@@ -0,0 +1,6 @@
namespace ZTICInterface.Application;
public interface ISystemService
{
    string GetDescription();
}
ZTICInterface.Application/System/Services/SystemService.cs
New file
@@ -0,0 +1,11 @@
using Furion.DependencyInjection;
namespace ZTICInterface.Application;
public class SystemService : ISystemService, ITransient
{
    public string GetDescription()
    {
        return "让 .NET 开发更简单,更通用,更流行。";
    }
}
ZTICInterface.Application/System/SystemAppService.cs
New file
@@ -0,0 +1,24 @@
using Furion.DynamicApiController;
namespace ZTICInterface.Application;
/// <summary>
/// 系统服务接口
/// </summary>
public class SystemAppService : IDynamicApiController
{
    private readonly ISystemService _systemService;
    public SystemAppService(ISystemService systemService)
    {
        _systemService = systemService;
    }
    /// <summary>
    /// 获取系统描述
    /// </summary>
    /// <returns></returns>
    public string GetDescription()
    {
        return _systemService.GetDescription();
    }
}
ZTICInterface.Application/ZTICInterface.Application.csproj
New file
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <NoWarn>1701;1702;1591</NoWarn>
    <DocumentationFile>ZTICInterface.Application.xml</DocumentationFile>
  </PropertyGroup>
  <ItemGroup>
    <None Remove="applicationsettings.json" />
    <None Remove="ZTICInterface.Application.xml" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="applicationsettings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\ZTICInterface.Core\ZTICInterface.Core.csproj" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="System\Services\" />
  </ItemGroup>
</Project>
ZTICInterface.Application/ZTICInterface.Application.xml
New file
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>ZTICInterface.Application</name>
    </assembly>
    <members>
        <member name="T:ZTICInterface.Application.SystemAppService">
            <summary>
            系统服务接口
            </summary>
        </member>
        <member name="M:ZTICInterface.Application.SystemAppService.GetDescription">
            <summary>
            获取系统描述
            </summary>
            <returns></returns>
        </member>
    </members>
</doc>
ZTICInterface.Application/applicationsettings.json
New file
@@ -0,0 +1,23 @@
{
  "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"
        }
      }
    ]
  }
}
ZTICInterface.Core/Extend/MyConstant.cs
New file
@@ -0,0 +1,23 @@
namespace ZTICInterface.Core.Extend;
public class MyConstant
{
    /// <summary>
    /// 缓存key
    /// </summary>
    public struct MyCacheKey
    {
        /// <summary>
        /// 自建进料page显示列
        /// </summary>
        public const string FeedSelfPageCol = "FeedSelfPageCol";
        /// <summary>
        /// 历史进料page显示列
        /// </summary>
        public const string FeedHistoryPageCol = "FeedHistoryPageCol";
        /// <summary>
        /// 工况page显示列
        /// </summary>
        public const string CasePageCol = "CasePageCol";
    }
}
ZTICInterface.Core/Extend/TranReturn.cs
New file
@@ -0,0 +1,19 @@
using SqlSugar;
namespace ZTICInterface.Core.Extend;
public class TranReturn
{
    /// <summary>
    /// 事务返回
    /// </summary>
    /// <typeparam name="TR"></typeparam>
    /// <param name="result"></param>
    /// <returns></returns>
    public static TR Return<TR>(DbResult<TR> result)
    {
        if (!result.IsSuccess)
            throw result.ErrorException;
        return result.Data;
    }
}
ZTICInterface.Core/RESTfulResultProvider.cs
New file
@@ -0,0 +1,110 @@
using System;
using System.Threading.Tasks;
using Furion;
using Furion.DataValidation;
using Furion.DependencyInjection;
using Furion.UnifyResult;
using Furion.UnifyResult.Internal;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
namespace ZTICInterface.Core;
/// <summary>
/// RESTful 风格返回值
/// </summary>
[SuppressSniffer, UnifyModel(typeof(RESTfulResult<>))]
public class RESTfulResultProvider : IUnifyResultProvider
{
    /// <summary>
    /// 异常返回值
    /// </summary>
    /// <param name="context"></param>
    /// <param name="metadata"></param>
    /// <returns></returns>
    public IActionResult OnException(ExceptionContext context, ExceptionMetadata metadata)
    {
        var msg = metadata.Errors.ToString();
        if (metadata.StatusCode == 500)
            msg = "系统有点小问题";
        return new JsonResult(RESTfulResult(metadata.StatusCode == 400 ? 200 : metadata.StatusCode, msg: msg,
            errors: metadata.Errors));
    }
    /// <summary>
    /// 成功返回值
    /// </summary>
    /// <param name="context"></param>
    /// <param name="data"></param>
    /// <returns></returns>
    public IActionResult OnSucceeded(ActionExecutedContext context, object data)
    {
        return new JsonResult(RESTfulResult(StatusCodes.Status200OK, true, data));
    }
    /// <summary>
    /// 验证失败返回值
    /// </summary>
    /// <param name="context"></param>
    /// <param name="metadata"></param>
    /// <returns></returns>
    public IActionResult OnValidateFailed(ActionExecutingContext context, ValidationMetadata metadata)
    {
        return new JsonResult(RESTfulResult(StatusCodes.Status400BadRequest, errors: metadata.ValidationResult));
    }
    /// <summary>
    /// 特定状态码返回值
    /// </summary>
    /// <param name="context"></param>
    /// <param name="statusCode"></param>
    /// <param name="unifyResultSettings"></param>
    /// <returns></returns>
    public async Task OnResponseStatusCodes(HttpContext context, int statusCode,
        UnifyResultSettingsOptions unifyResultSettings)
    {
        // 设置响应状态码
        UnifyContext.SetResponseStatusCodes(context, statusCode, unifyResultSettings);
        switch (statusCode)
        {
            // 处理 401 状态码
            case StatusCodes.Status401Unauthorized:
                await context.Response.WriteAsJsonAsync(RESTfulResult(statusCode, errors: "401 Unauthorized")
                    , App.GetOptions<JsonOptions>()?.JsonSerializerOptions);
                break;
            // 处理 403 状态码
            case StatusCodes.Status403Forbidden:
                await context.Response.WriteAsJsonAsync(RESTfulResult(statusCode, errors: "403 Forbidden")
                    , App.GetOptions<JsonOptions>()?.JsonSerializerOptions);
                break;
            default: break;
        }
    }
    /// <summary>
    /// 返回 RESTful 风格结果集
    /// </summary>
    /// <param name="statusCode"></param>
    /// <param name="succeeded"></param>
    /// <param name="msg"></param>
    /// <param name="data"></param>
    /// <param name="errors"></param>
    /// <returns></returns>
    private static RESTfulResult<object> RESTfulResult(int statusCode, bool succeeded = default, object data = default,
        string msg = default, object errors = default)
    {
        return new RESTfulResult<object>
        {
            StatusCode = statusCode,
            Succeeded = succeeded,
            Data = data,
            Errors = errors,
            Extras = msg,
            Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
        };
    }
}
ZTICInterface.Core/SqlsugarSetup.cs
New file
@@ -0,0 +1,53 @@
using System;
using Furion;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
namespace ZTICInterface.Core;
public static class SqlsugarSetup
{
    public static void AddSqlsugarSetup(this IServiceCollection services, IConfiguration configuration, string dbName = "db_master")
    {
        //如果多个数数据库传 List<ConnectionConfig>
        var configConnection = new ConnectionConfig()
        {
            DbType = (DbType)Enum.Parse(typeof(DbType), App.Configuration["DatabaseSettings:Data:DbType"]),
            ConnectionString = App.Configuration["DatabaseSettings:MainDb:ConnectionString"],
            IsAutoCloseConnection = true,
        };
        SqlSugarScope sqlSugar = new SqlSugarScope(configConnection,
            db =>
            {
                //单例参数配置,所有上下文生效
                db.Aop.OnLogExecuting = (sql, p) =>
                {
                    Console.WriteLine(SqlProfiler.ParameterFormat(sql, p));
                    Console.WriteLine();
                    App.PrintToMiniProfiler("SqlSugar", "Info", SqlProfiler.ParameterFormat(sql, p));
                };
            });
        services.AddSingleton<ISqlSugarClient>(sqlSugar);//这边是SqlSugarScope用AddSingleton
    }
    public class SqlProfiler
    {
        public static string ParameterFormat(string sql, SugarParameter[] pars)
        {
            for (int index = pars.Length - 1; index >= 0; --index)
                sql = pars[index].DbType == System.Data.DbType.String || pars[index].DbType == System.Data.DbType.DateTime || pars[index].DbType == System.Data.DbType.Date || pars[index].DbType == System.Data.DbType.Time || pars[index].DbType == System.Data.DbType.DateTime2 || pars[index].DbType == System.Data.DbType.DateTimeOffset || pars[index].DbType == System.Data.DbType.Guid || pars[index].DbType == System.Data.DbType.VarNumeric || pars[index].DbType == System.Data.DbType.AnsiStringFixedLength || pars[index].DbType == System.Data.DbType.AnsiString || pars[index].DbType == System.Data.DbType.StringFixedLength ? sql.Replace(pars[index].ParameterName, "'" + pars[index].Value?.ToString() + "'") : (pars[index].DbType != System.Data.DbType.Boolean ? sql.Replace(pars[index].ParameterName, pars[index].Value?.ToString()) : sql.Replace(pars[index].ParameterName, Convert.ToBoolean(pars[index].Value) ? "1" : "0"));
            return sql;
        }
        public static string ParameterFormat(string sql, object pars)
        {
            SugarParameter[] pars1 = (SugarParameter[])pars;
            return SqlProfiler.ParameterFormat(sql, pars1);
        }
    }
}
ZTICInterface.Core/ZTICInterface.Core.csproj
New file
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <NoWarn>1701;1702;1591</NoWarn>
    <DocumentationFile>ZTICInterface.Core.xml</DocumentationFile>
  </PropertyGroup>
  <ItemGroup>
    <None Remove="ZTICInterface.Core.xml" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Furion" Version="3.0.6" />
    <PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="3.0.6" />
    <PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="3.0.6" />
    <PackageReference Include="SqlSugar.IOC" Version="1.7.0" />
    <PackageReference Include="SqlSugarCore" Version="5.0.5.4" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Extend\" />
  </ItemGroup>
</Project>
ZTICInterface.Core/ZTICInterface.Core.xml
New file
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>ZTICInterface.Core</name>
    </assembly>
    <members>
    </members>
</doc>
ZTICInterface.Web.Core/Handlers/JwtHandler.cs
New file
@@ -0,0 +1,16 @@
using Furion.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
namespace ZTICInterface.Web.Core;
public class JwtHandler : AppAuthorizeHandler
{
    public override Task<bool> PipelineAsync(AuthorizationHandlerContext context, DefaultHttpContext httpContext)
    {
        // 这里写您的授权判断逻辑,授权通过返回 true,否则返回 false
        return Task.FromResult(true);
    }
}
ZTICInterface.Web.Core/Startup.cs
New file
@@ -0,0 +1,44 @@
using Furion;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace ZTICInterface.Web.Core;
public class Startup : AppStartup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddJwt<JwtHandler>();
        services.AddCorsAccessor();
        services.AddControllers()
                .AddInjectWithUnifyResult();
    }
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        app.UseHttpsRedirection();
        app.UseRouting();
        app.UseCorsAccessor();
        app.UseAuthentication();
        app.UseAuthorization();
        app.UseInject(string.Empty);
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapControllers();
        });
    }
}
ZTICInterface.Web.Core/ZTICInterface.Web.Core.csproj
New file
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <NoWarn>1701;1702;1591</NoWarn>
    <DocumentationFile>ZTICInterface.Web.Core.xml</DocumentationFile>
  </PropertyGroup>
  <ItemGroup>
    <None Remove="ZTICInterface.Web.Core.xml" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\ZTICInterface.Application\ZTICInterface.Application.csproj" />
  </ItemGroup>
</Project>
ZTICInterface.Web.Core/ZTICInterface.Web.Core.xml
New file
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>ZTICInterface.Web.Core</name>
    </assembly>
    <members>
    </members>
</doc>
ZTICInterface.Web.Entry/Program.cs
New file
@@ -0,0 +1,25 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using ZTICInterface.Core;
var builder = WebApplication.CreateBuilder(args).Inject();
builder.Services.AddControllers()
    .AddInjectWithUnifyResult<RESTfulResultProvider>()
    .AddNewtonsoftJson(options =>
    {
        options.SerializerSettings.ContractResolver =
            new CamelCasePropertyNamesContractResolver(); //序列化时key为驼峰样式
        options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Local;
        options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
        options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; //忽略循环引用
    });
var app = builder.Build();
app.Run();
ZTICInterface.Web.Entry/Properties/launchSettings.json
New file
@@ -0,0 +1,31 @@
{
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:53785",
      "sslPort": 44342
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "ZTICInterface.Web.Entry": {
      "commandName": "Project",
      "dotnetRunMessages": "true",
      "launchBrowser": true,
      "launchUrl": "",
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}
ZTICInterface.Web.Entry/ZTICInterface.Web.Entry.csproj
New file
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
    <PropertyGroup>
        <TargetFramework>net6.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
    </PropertyGroup>
    <ItemGroup>
        <Compile Remove="Controllers\**" />
        <Compile Remove="wwwroot\**" />
        <Content Remove="Controllers\**" />
        <Content Remove="wwwroot\**" />
        <EmbeddedResource Remove="Controllers\**" />
        <EmbeddedResource Remove="wwwroot\**" />
        <None Remove="Controllers\**" />
        <None Remove="wwwroot\**" />
    </ItemGroup>
    <ItemGroup>
        <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.2" />
        <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.1">
            <PrivateAssets>all</PrivateAssets>
            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
        </PackageReference>
    </ItemGroup>
    <ItemGroup>
        <ProjectReference Include="..\ZTICInterface.Web.Core\ZTICInterface.Web.Core.csproj" />
    </ItemGroup>
    <ProjectExtensions>
        <VisualStudio>
            <UserProperties properties_4launchsettings_1json__JsonSchema="" />
        </VisualStudio>
    </ProjectExtensions>
</Project>
ZTICInterface.Web.Entry/appsettings.Development.json
New file
@@ -0,0 +1,9 @@
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  }
}
ZTICInterface.Web.Entry/appsettings.json
New file
@@ -0,0 +1,17 @@
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information",
      "Microsoft.EntityFrameworkCore": "Information"
    }
  },
  "DatabaseSettings": {
    "MainDb": {
      "ConnectionString": "Data Source=47.103.92.119,1433;Initial Catalog=RRSoftDB;User ID=sa;Password=win2021!",
      "DbType": "SqlServer"
    }
  },
  "AllowedHosts": "*"
}
ZTICInterface.sln
New file
@@ -0,0 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31912.275
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZTICInterface.Application", "ZTICInterface.Application\ZTICInterface.Application.csproj", "{AB699EE9-43A8-46F2-A855-04A26DE63372}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZTICInterface.Web.Core", "ZTICInterface.Web.Core\ZTICInterface.Web.Core.csproj", "{9D14BB78-DA2A-4040-B9DB-5A515B599181}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZTICInterface.Core", "ZTICInterface.Core\ZTICInterface.Core.csproj", "{4FB30091-15C7-4FD9-AB7D-266814F360F5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZTICInterface.Web.Entry", "ZTICInterface.Web.Entry\ZTICInterface.Web.Entry.csproj", "{C8D99F52-EDC7-411F-8300-6DB14BF59E8C}"
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
        {C8D99F52-EDC7-411F-8300-6DB14BF59E8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {C8D99F52-EDC7-411F-8300-6DB14BF59E8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {C8D99F52-EDC7-411F-8300-6DB14BF59E8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {C8D99F52-EDC7-411F-8300-6DB14BF59E8C}.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