From b62ffe3c3a19aa7f2232c72d5fd81e893841c421 Mon Sep 17 00:00:00 2001
From: wx <wx036@qq.com>
Date: 星期五, 18 二月 2022 11:44:22 +0800
Subject: [PATCH] 框架
---
ZTICInterface.Web.Entry/ZTICInterface.Web.Entry.csproj | 34 ++
ZTICInterface.Application/ZTICInterface.Application.csproj | 28 ++
.gitignore | 231 ++++++++++++++-
ZTICInterface.Web.Entry/appsettings.json | 17 +
ZTICInterface.Application/System/SystemAppService.cs | 24 +
ZTICInterface.Core/Extend/MyConstant.cs | 23 +
ZTICInterface.Core/ZTICInterface.Core.csproj | 25 +
ZTICInterface.Application/System/Services/ISystemService.cs | 6
ZTICInterface.Core/ZTICInterface.Core.xml | 8
ZTICInterface.sln | 43 +++
ZTICInterface.Core/RESTfulResultProvider.cs | 110 +++++++
ZTICInterface.Web.Core/ZTICInterface.Web.Core.csproj | 17 +
ZTICInterface.Application/System/Services/SystemService.cs | 11
ZTICInterface.Application/ZTICInterface.Application.xml | 19 +
ZTICInterface.Application/applicationsettings.json | 23 +
ZTICInterface.Web.Entry/Program.cs | 25 +
ZTICInterface.Web.Core/Startup.cs | 44 +++
ZTICInterface.Application/System/Dtos/Mapper.cs | 10
ZTICInterface.Core/SqlsugarSetup.cs | 53 +++
ZTICInterface.Web.Entry/Properties/launchSettings.json | 31 ++
ZTICInterface.Core/Extend/TranReturn.cs | 19 +
ZTICInterface.Web.Entry/appsettings.Development.json | 9
ZTICInterface.Web.Core/Handlers/JwtHandler.cs | 16 +
ZTICInterface.Web.Core/ZTICInterface.Web.Core.xml | 8
24 files changed, 807 insertions(+), 27 deletions(-)
diff --git a/.gitignore b/.gitignore
index 1c38a68..9491a2f 100644
--- a/.gitignore
+++ b/.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
\ No newline at end of file
diff --git a/ZTICInterface.Application/System/Dtos/Mapper.cs b/ZTICInterface.Application/System/Dtos/Mapper.cs
new file mode 100644
index 0000000..055d54f
--- /dev/null
+++ b/ZTICInterface.Application/System/Dtos/Mapper.cs
@@ -0,0 +1,10 @@
+锘縰sing Mapster;
+
+namespace ZTICInterface.Application;
+
+public class Mapper : IRegister
+{
+ public void Register(TypeAdapterConfig config)
+ {
+ }
+}
diff --git a/ZTICInterface.Application/System/Services/ISystemService.cs b/ZTICInterface.Application/System/Services/ISystemService.cs
new file mode 100644
index 0000000..01cfb56
--- /dev/null
+++ b/ZTICInterface.Application/System/Services/ISystemService.cs
@@ -0,0 +1,6 @@
+锘縩amespace ZTICInterface.Application;
+
+public interface ISystemService
+{
+ string GetDescription();
+}
diff --git a/ZTICInterface.Application/System/Services/SystemService.cs b/ZTICInterface.Application/System/Services/SystemService.cs
new file mode 100644
index 0000000..69038b3
--- /dev/null
+++ b/ZTICInterface.Application/System/Services/SystemService.cs
@@ -0,0 +1,11 @@
+锘縰sing Furion.DependencyInjection;
+
+namespace ZTICInterface.Application;
+
+public class SystemService : ISystemService, ITransient
+{
+ public string GetDescription()
+ {
+ return "璁� .NET 寮�鍙戞洿绠�鍗曪紝鏇撮�氱敤锛屾洿娴佽銆�";
+ }
+}
diff --git a/ZTICInterface.Application/System/SystemAppService.cs b/ZTICInterface.Application/System/SystemAppService.cs
new file mode 100644
index 0000000..5d0f69a
--- /dev/null
+++ b/ZTICInterface.Application/System/SystemAppService.cs
@@ -0,0 +1,24 @@
+锘縰sing 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();
+ }
+}
diff --git a/ZTICInterface.Application/ZTICInterface.Application.csproj b/ZTICInterface.Application/ZTICInterface.Application.csproj
new file mode 100644
index 0000000..0be9f23
--- /dev/null
+++ b/ZTICInterface.Application/ZTICInterface.Application.csproj
@@ -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>
diff --git a/ZTICInterface.Application/ZTICInterface.Application.xml b/ZTICInterface.Application/ZTICInterface.Application.xml
new file mode 100644
index 0000000..44367ff
--- /dev/null
+++ b/ZTICInterface.Application/ZTICInterface.Application.xml
@@ -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>
diff --git a/ZTICInterface.Application/applicationsettings.json b/ZTICInterface.Application/applicationsettings.json
new file mode 100644
index 0000000..aa167d8
--- /dev/null
+++ b/ZTICInterface.Application/applicationsettings.json
@@ -0,0 +1,23 @@
+锘縶
+ "SpecificationDocumentSettings": {
+ "DocumentTitle": "Furion | 瑙勮寖鍖栨帴鍙�",
+ "GroupOpenApiInfos": [
+ {
+ "Group": "Default",
+ "Title": "瑙勮寖鍖栨帴鍙f紨绀�",
+ "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"
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ZTICInterface.Core/Extend/MyConstant.cs b/ZTICInterface.Core/Extend/MyConstant.cs
new file mode 100644
index 0000000..335aa62
--- /dev/null
+++ b/ZTICInterface.Core/Extend/MyConstant.cs
@@ -0,0 +1,23 @@
+锘縩amespace 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";
+ }
+}
\ No newline at end of file
diff --git a/ZTICInterface.Core/Extend/TranReturn.cs b/ZTICInterface.Core/Extend/TranReturn.cs
new file mode 100644
index 0000000..df33138
--- /dev/null
+++ b/ZTICInterface.Core/Extend/TranReturn.cs
@@ -0,0 +1,19 @@
+锘縰sing 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;
+ }
+}
\ No newline at end of file
diff --git a/ZTICInterface.Core/RESTfulResultProvider.cs b/ZTICInterface.Core/RESTfulResultProvider.cs
new file mode 100644
index 0000000..cdaba56
--- /dev/null
+++ b/ZTICInterface.Core/RESTfulResultProvider.cs
@@ -0,0 +1,110 @@
+锘縰sing 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()
+ };
+ }
+}
diff --git a/ZTICInterface.Core/SqlsugarSetup.cs b/ZTICInterface.Core/SqlsugarSetup.cs
new file mode 100644
index 0000000..7873d4f
--- /dev/null
+++ b/ZTICInterface.Core/SqlsugarSetup.cs
@@ -0,0 +1,53 @@
+锘縰sing 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);//杩欒竟鏄疭qlSugarScope鐢ˋddSingleton
+ }
+
+
+
+ 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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/ZTICInterface.Core/ZTICInterface.Core.csproj b/ZTICInterface.Core/ZTICInterface.Core.csproj
new file mode 100644
index 0000000..ae887ed
--- /dev/null
+++ b/ZTICInterface.Core/ZTICInterface.Core.csproj
@@ -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>
diff --git a/ZTICInterface.Core/ZTICInterface.Core.xml b/ZTICInterface.Core/ZTICInterface.Core.xml
new file mode 100644
index 0000000..49a6bb1
--- /dev/null
+++ b/ZTICInterface.Core/ZTICInterface.Core.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<doc>
+ <assembly>
+ <name>ZTICInterface.Core</name>
+ </assembly>
+ <members>
+ </members>
+</doc>
diff --git a/ZTICInterface.Web.Core/Handlers/JwtHandler.cs b/ZTICInterface.Web.Core/Handlers/JwtHandler.cs
new file mode 100644
index 0000000..8b67672
--- /dev/null
+++ b/ZTICInterface.Web.Core/Handlers/JwtHandler.cs
@@ -0,0 +1,16 @@
+锘縰sing 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);
+ }
+}
diff --git a/ZTICInterface.Web.Core/Startup.cs b/ZTICInterface.Web.Core/Startup.cs
new file mode 100644
index 0000000..7ebe0e5
--- /dev/null
+++ b/ZTICInterface.Web.Core/Startup.cs
@@ -0,0 +1,44 @@
+锘縰sing 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();
+ });
+ }
+}
diff --git a/ZTICInterface.Web.Core/ZTICInterface.Web.Core.csproj b/ZTICInterface.Web.Core/ZTICInterface.Web.Core.csproj
new file mode 100644
index 0000000..0bfff14
--- /dev/null
+++ b/ZTICInterface.Web.Core/ZTICInterface.Web.Core.csproj
@@ -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>
diff --git a/ZTICInterface.Web.Core/ZTICInterface.Web.Core.xml b/ZTICInterface.Web.Core/ZTICInterface.Web.Core.xml
new file mode 100644
index 0000000..bb8ca3d
--- /dev/null
+++ b/ZTICInterface.Web.Core/ZTICInterface.Web.Core.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<doc>
+ <assembly>
+ <name>ZTICInterface.Web.Core</name>
+ </assembly>
+ <members>
+ </members>
+</doc>
diff --git a/ZTICInterface.Web.Entry/Program.cs b/ZTICInterface.Web.Entry/Program.cs
new file mode 100644
index 0000000..456e96c
--- /dev/null
+++ b/ZTICInterface.Web.Entry/Program.cs
@@ -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();
\ No newline at end of file
diff --git a/ZTICInterface.Web.Entry/Properties/launchSettings.json b/ZTICInterface.Web.Entry/Properties/launchSettings.json
new file mode 100644
index 0000000..6e3020e
--- /dev/null
+++ b/ZTICInterface.Web.Entry/Properties/launchSettings.json
@@ -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"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ZTICInterface.Web.Entry/ZTICInterface.Web.Entry.csproj b/ZTICInterface.Web.Entry/ZTICInterface.Web.Entry.csproj
new file mode 100644
index 0000000..ee936bf
--- /dev/null
+++ b/ZTICInterface.Web.Entry/ZTICInterface.Web.Entry.csproj
@@ -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>
diff --git a/ZTICInterface.Web.Entry/appsettings.Development.json b/ZTICInterface.Web.Entry/appsettings.Development.json
new file mode 100644
index 0000000..45fe774
--- /dev/null
+++ b/ZTICInterface.Web.Entry/appsettings.Development.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information"
+ }
+ }
+}
\ No newline at end of file
diff --git a/ZTICInterface.Web.Entry/appsettings.json b/ZTICInterface.Web.Entry/appsettings.json
new file mode 100644
index 0000000..c38a477
--- /dev/null
+++ b/ZTICInterface.Web.Entry/appsettings.json
@@ -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": "*"
+}
\ No newline at end of file
diff --git a/ZTICInterface.sln b/ZTICInterface.sln
new file mode 100644
index 0000000..0ed4dd1
--- /dev/null
+++ b/ZTICInterface.sln
@@ -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
--
Gitblit v1.8.0