Bläddra i källkod

修改项目信息

devin.zhu@doverfs.com 1 år sedan
incheckning
77abbd4cc2
42 ändrade filer med 2266 tillägg och 0 borttagningar
  1. 63 0
      .gitattributes
  2. 402 0
      .gitignore
  3. 7 0
      FuelCloud/Fuel.Payment.Repositories/Class1.cs
  4. 13 0
      FuelCloud/Fuel.Payment.Repositories/Fuel.Payment.Repositories.csproj
  5. 58 0
      FuelCloud/FuelCloud.sln
  6. 7 0
      FuelCloud/src/Fuel.Payment.Core/Class1.cs
  7. 19 0
      FuelCloud/src/Fuel.Payment.Core/Fuel.Payment.Core.csproj
  8. 12 0
      FuelCloud/src/Fuel.Payment.Core/Services/IOrderServer.cs
  9. 12 0
      FuelCloud/src/Fuel.Payment.Core/Services/IPaymentServer.cs
  10. 7 0
      FuelCloud/src/Fuel.Payment.ExtServer/Class1.cs
  11. 9 0
      FuelCloud/src/Fuel.Payment.ExtServer/Fuel.Payment.ExtServer.csproj
  12. 33 0
      FuelCloud/src/Fuel.Payment.Server/Controllers/WeatherForecastController.cs
  13. 24 0
      FuelCloud/src/Fuel.Payment.Server/Fuel.PaymentServer.csproj
  14. 6 0
      FuelCloud/src/Fuel.Payment.Server/Fuel.PaymentServer.http
  15. 29 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Authorize/DfsAuthorizationHandler.cs
  16. 37 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Authorize/DfsAuthorizationRequirement.cs
  17. 51 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/ClientAuthorize/Model/OpenClient.cs
  18. 53 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/CodeGenerate/ExceptionModel.cs
  19. 174 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/CodeGenerate/ExceptionTemp.cs
  20. 170 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Filters/ServiceExceptionFilter.cs
  21. 120 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Filters/StandardResultFilter.cs
  22. 78 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Filters/ValidationActionFilter.cs
  23. 71 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/HttpContextExcention.cs
  24. 15 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/IAuhUser.cs
  25. 272 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/Impl/AuthService.cs
  26. 25 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/Impl/IAuth.cs
  27. 38 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/Impl/ITokenManage.cs
  28. 72 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/Impl/JWTManager.cs
  29. 47 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/JwtBuildHelp.cs
  30. 29 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/JwtConfig.cs
  31. 15 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/JwtServiceCollectionExtension.cs
  32. 54 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/Model/TokenModel.cs
  33. 15 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Middlewares/LogMiddleware.cs
  34. 45 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/Results/StandardObjectResult.cs
  35. 57 0
      FuelCloud/src/Fuel.Payment.Server/MicServer/WebAppliactionExtend.cs
  36. 36 0
      FuelCloud/src/Fuel.Payment.Server/Program.cs
  37. 41 0
      FuelCloud/src/Fuel.Payment.Server/Properties/launchSettings.json
  38. 13 0
      FuelCloud/src/Fuel.Payment.Server/WeatherForecast.cs
  39. 8 0
      FuelCloud/src/Fuel.Payment.Server/appsettings.Development.json
  40. 9 0
      FuelCloud/src/Fuel.Payment.Server/appsettings.json
  41. 7 0
      FuelCloud/src/Fuel.Payment.Service/Class1.cs
  42. 13 0
      FuelCloud/src/Fuel.Payment.Service/Fuel.Payment.Service.csproj

+ 63 - 0
.gitattributes

@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs     diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following 
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln       merge=binary
+#*.csproj    merge=binary
+#*.vbproj    merge=binary
+#*.vcxproj   merge=binary
+#*.vcproj    merge=binary
+#*.dbproj    merge=binary
+#*.fsproj    merge=binary
+#*.lsproj    merge=binary
+#*.wixproj   merge=binary
+#*.modelproj merge=binary
+#*.sqlproj   merge=binary
+#*.wwaproj   merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg   binary
+#*.png   binary
+#*.gif   binary
+
+###############################################################################
+# diff behavior for common document formats
+# 
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the 
+# entries below.
+###############################################################################
+#*.doc   diff=astextplain
+#*.DOC   diff=astextplain
+#*.docx  diff=astextplain
+#*.DOCX  diff=astextplain
+#*.dot   diff=astextplain
+#*.DOT   diff=astextplain
+#*.pdf   diff=astextplain
+#*.PDF   diff=astextplain
+#*.rtf   diff=astextplain
+#*.RTF   diff=astextplain

+ 402 - 0
.gitignore

@@ -0,0 +1,402 @@
+## 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/main/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/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+
+# 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
+*.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
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.tlog
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+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/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# 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.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# 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
+*.nupkg
+# 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
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# 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
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+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/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+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 6 auto-generated project file (contains which files were open etc.)
+*.vbp
+
+# Visual Studio 6 workspace and project file (working project files containing files to include in project)
+*.dsw
+*.dsp
+
+# Visual Studio 6 technical files
+*.ncb
+*.aps
+
+# 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/
+
+# Visual Studio History (VSHistory) files
+.vshistory/
+
+# 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
+
+# VS Code files for those working on multiple tools
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+# Windows Installer files from build outputs
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# JetBrains Rider
+*.sln.iml
+
+**/wwwroot/upload
+/Dfs.IMes.sln
+/PcClient/protools/SerialPort

+ 7 - 0
FuelCloud/Fuel.Payment.Repositories/Class1.cs

@@ -0,0 +1,7 @@
+namespace Fuel.Payment.Repositories
+{
+    public class Class1
+    {
+
+    }
+}

+ 13 - 0
FuelCloud/Fuel.Payment.Repositories/Fuel.Payment.Repositories.csproj

@@ -0,0 +1,13 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Folder Include="Impl\" />
+  </ItemGroup>
+
+</Project>

+ 58 - 0
FuelCloud/FuelCloud.sln

@@ -0,0 +1,58 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34601.278
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PaymentServer", "PaymentServer", "{A70E5B56-8E5C-4EB2-92F0-66FA7E67A2D1}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fuel.PaymentServer", "src\Fuel.Payment.Server\Fuel.PaymentServer.csproj", "{C6136845-5F8D-4021-9C6B-028CB386647A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fuel.Payment.Core", "src\Fuel.Payment.Core\Fuel.Payment.Core.csproj", "{82ADD4DA-C4A6-49EA-8297-D2477CA6EAF3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fuel.Payment.Service", "src\Fuel.Payment.Service\Fuel.Payment.Service.csproj", "{92947E0E-4C48-4D94-A243-F097081B3694}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fuel.Payment.Repositories", "Fuel.Payment.Repositories\Fuel.Payment.Repositories.csproj", "{8D22ECD9-B1F9-46AD-84B5-CB737B318DDE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fuel.Payment.ExtServer", "src\Fuel.Payment.ExtServer\Fuel.Payment.ExtServer.csproj", "{ADB9278E-D932-422B-8585-DFA0F0333D3B}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{C6136845-5F8D-4021-9C6B-028CB386647A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C6136845-5F8D-4021-9C6B-028CB386647A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C6136845-5F8D-4021-9C6B-028CB386647A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C6136845-5F8D-4021-9C6B-028CB386647A}.Release|Any CPU.Build.0 = Release|Any CPU
+		{82ADD4DA-C4A6-49EA-8297-D2477CA6EAF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{82ADD4DA-C4A6-49EA-8297-D2477CA6EAF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{82ADD4DA-C4A6-49EA-8297-D2477CA6EAF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{82ADD4DA-C4A6-49EA-8297-D2477CA6EAF3}.Release|Any CPU.Build.0 = Release|Any CPU
+		{92947E0E-4C48-4D94-A243-F097081B3694}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{92947E0E-4C48-4D94-A243-F097081B3694}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{92947E0E-4C48-4D94-A243-F097081B3694}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{92947E0E-4C48-4D94-A243-F097081B3694}.Release|Any CPU.Build.0 = Release|Any CPU
+		{8D22ECD9-B1F9-46AD-84B5-CB737B318DDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{8D22ECD9-B1F9-46AD-84B5-CB737B318DDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{8D22ECD9-B1F9-46AD-84B5-CB737B318DDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{8D22ECD9-B1F9-46AD-84B5-CB737B318DDE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{ADB9278E-D932-422B-8585-DFA0F0333D3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{ADB9278E-D932-422B-8585-DFA0F0333D3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{ADB9278E-D932-422B-8585-DFA0F0333D3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{ADB9278E-D932-422B-8585-DFA0F0333D3B}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{C6136845-5F8D-4021-9C6B-028CB386647A} = {A70E5B56-8E5C-4EB2-92F0-66FA7E67A2D1}
+		{82ADD4DA-C4A6-49EA-8297-D2477CA6EAF3} = {A70E5B56-8E5C-4EB2-92F0-66FA7E67A2D1}
+		{92947E0E-4C48-4D94-A243-F097081B3694} = {A70E5B56-8E5C-4EB2-92F0-66FA7E67A2D1}
+		{8D22ECD9-B1F9-46AD-84B5-CB737B318DDE} = {A70E5B56-8E5C-4EB2-92F0-66FA7E67A2D1}
+		{ADB9278E-D932-422B-8585-DFA0F0333D3B} = {A70E5B56-8E5C-4EB2-92F0-66FA7E67A2D1}
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {61A0BE4B-D15C-4489-B07B-A028AEC93C1D}
+	EndGlobalSection
+EndGlobal

+ 7 - 0
FuelCloud/src/Fuel.Payment.Core/Class1.cs

@@ -0,0 +1,7 @@
+namespace Fuel.Payment.Core
+{
+    public class Class1
+    {
+
+    }
+}

+ 19 - 0
FuelCloud/src/Fuel.Payment.Core/Fuel.Payment.Core.csproj

@@ -0,0 +1,19 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Folder Include="Repositories\" />
+    <Folder Include="Dtos\" />
+    <Folder Include="Model\" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Include="DFS.Core" Version="8.0.1" />
+  </ItemGroup>
+
+</Project>

+ 12 - 0
FuelCloud/src/Fuel.Payment.Core/Services/IOrderServer.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Fuel.Payment.Core.Services
+{
+    public interface IOrderServer
+    {
+    }
+}

+ 12 - 0
FuelCloud/src/Fuel.Payment.Core/Services/IPaymentServer.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Fuel.Payment.Core.Services
+{
+    public interface IPaymentServer
+    {
+    }
+}

+ 7 - 0
FuelCloud/src/Fuel.Payment.ExtServer/Class1.cs

@@ -0,0 +1,7 @@
+namespace Fuel.Payment.ExtServer
+{
+    public class Class1
+    {
+
+    }
+}

+ 9 - 0
FuelCloud/src/Fuel.Payment.ExtServer/Fuel.Payment.ExtServer.csproj

@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+</Project>

+ 33 - 0
FuelCloud/src/Fuel.Payment.Server/Controllers/WeatherForecastController.cs

@@ -0,0 +1,33 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace Fuel.PaymentServer.Controllers
+{
+    [ApiController]
+    [Route("[controller]")]
+    public class WeatherForecastController : ControllerBase
+    {
+        private static readonly string[] Summaries = new[]
+        {
+            "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
+        };
+
+        private readonly ILogger<WeatherForecastController> _logger;
+
+        public WeatherForecastController(ILogger<WeatherForecastController> logger)
+        {
+            _logger = logger;
+        }
+
+        [HttpGet(Name = "GetWeatherForecast")]
+        public IEnumerable<WeatherForecast> Get()
+        {
+            return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+            {
+                Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
+                TemperatureC = Random.Shared.Next(-20, 55),
+                Summary = Summaries[Random.Shared.Next(Summaries.Length)]
+            })
+            .ToArray();
+        }
+    }
+}

+ 24 - 0
FuelCloud/src/Fuel.Payment.Server/Fuel.PaymentServer.csproj

@@ -0,0 +1,24 @@
+<Project Sdk="Microsoft.NET.Sdk.Web">
+
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <Nullable>enable</Nullable>
+    <ImplicitUsings>enable</ImplicitUsings>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="DFS.Infrastructure.Redis" Version="8.0.0" />
+    <PackageReference Include="JWT" Version="10.1.1" />
+    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.5" />
+    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Folder Include="MicServer\Jwt\Attribute\" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\Fuel.Payment.Core\Fuel.Payment.Core.csproj" />
+  </ItemGroup>
+
+</Project>

+ 6 - 0
FuelCloud/src/Fuel.Payment.Server/Fuel.PaymentServer.http

@@ -0,0 +1,6 @@
+@Fuel.PaymentServer_HostAddress = http://localhost:5006
+
+GET {{Fuel.PaymentServer_HostAddress}}/weatherforecast/
+Accept: application/json
+
+###

+ 29 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Authorize/DfsAuthorizationHandler.cs

@@ -0,0 +1,29 @@
+using CSRedis;
+using DFS.Infrastructure.Redis;
+using Microsoft.AspNetCore.Authorization;
+
+
+namespace DFS.Core.Mvc.Authorize
+{
+    /// <summary>
+    /// 权限认证处理
+    /// </summary>
+    public class DFSAuthorizationHandler : AuthorizationHandler<DfsAuthorizationRequirement>
+    {
+        public IRedisClient _redisClient;
+        public DFSAuthorizationHandler()
+        {
+
+        }
+        protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, DfsAuthorizationRequirement requirement)
+        {
+            var redisCon = CoreRedisHelper.GetRedisHelper("auth");
+            ////注入具体查询的方法
+            //if (useHandle!=null)
+            //{
+            //    useHandle.Invoke();
+            //}
+            return Task.CompletedTask;
+        }
+    }
+}

+ 37 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Authorize/DfsAuthorizationRequirement.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authorization;
+
+namespace DFS.Core.Mvc.Authorize
+{
+    /// <summary>
+    /// 权限认证处理
+    /// </summary>
+    public class DfsAuthorizationRequirement : IAuthorizationRequirement
+    {
+        /// <summary>
+        /// Constructs a new instance of <see cref="DfsAuthorizationRequirement"/>.
+        /// </summary>
+        /// <param name="requiredName">The required name that the current user must have.</param>
+        public DfsAuthorizationRequirement(string requiredName)
+        {
+            RequiredName = requiredName;
+        }
+
+        /// <summary>
+        /// Gets the required name that the current user must have.
+        /// </summary>
+        public string RequiredName { get; }
+
+
+        /// <inheritdoc />
+        public override string ToString()
+        {
+            return $"{nameof(DfsAuthorizationRequirement)}:Requires a user identity with Name equal to {RequiredName}";
+        }
+
+    }
+}

+ 51 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/ClientAuthorize/Model/OpenClient.cs

@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace DFS.Core.Mvc.Jwt.Model
+{
+    /// <summary>
+    /// 开放的授权Client
+    /// </summary>
+    public class OpenClient
+    {
+        /// <summary>
+        /// 客户端id
+        /// </summary>
+        public string AppId { get; set; }
+
+        /// <summary>
+        /// 秘钥
+        /// </summary>
+        public string Sign { get; set; }
+
+        /// <summary>
+        /// 时间戳
+        /// </summary>
+        public string TimeSpan { get; set; }
+
+        public OpenClient(string appId, string sign, string timeSpan)
+        {
+            AppId = appId;
+            Sign = sign;
+            TimeSpan = timeSpan;
+        }
+
+        /// <summary>
+        /// 验证当前时间是否过期
+        /// </summary>
+        /// <returns></returns>
+        public virtual bool AuthTimeSpan()
+        {
+            if (TimeSpan.IsNullOrWhiteSpace())
+            {
+                return false;
+            }
+            if (TimeSpan.ToUTCTime().AddMinutes(5) > DateTime.UtcNow)
+            {
+                return true;
+            }
+            return false;
+        }
+    }
+}

+ 53 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/CodeGenerate/ExceptionModel.cs

@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace DFS.Core.Mvc
+{
+    public class XmlStatuCode
+    {
+        public List<ExceptionModel> Exceptions { get; set; }
+
+        public string Name { get; set; }
+
+        public string BeginCode { get; set; }
+
+        public string EndCode { get; set; }
+
+        public string Comment { get; set; }
+    }
+
+    public class ExceptionModel
+    {
+        /// <summary>
+        /// 异常类名称
+        /// </summary>
+        public string Name { get; set; }
+
+        /// <summary>
+        /// 异常编码
+        /// </summary>
+        public string Value { get; set; }
+
+        /// <summary>
+        /// 注释介绍
+        /// </summary>
+        public string Description { get; set; }
+
+        /// <summary>
+        /// 有参数
+        /// </summary>
+        public string HasParams { get; set; }
+
+        /// <summary>
+        /// 异常消息
+        /// </summary>
+        public string Message { get; set; }
+
+
+        /// <summary>
+        /// 内容
+        /// </summary>
+        public string Comment { get; set; }
+    }
+}

+ 174 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/CodeGenerate/ExceptionTemp.cs

@@ -0,0 +1,174 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace DFS.Core.Mvc.CodeGenerate
+{
+    /// <summary>
+    /// 模版
+    /// </summary>
+    public static class ExceptionTemp
+    {
+        /// <summary>
+        /// 业务异常类
+        /// </summary>
+        /// <param name="serverName"></param>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public static string ExceptionContent(string serverName, ExceptionModel model)
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.AppendLine("    using System;");
+            sb.AppendLine($"   namespace {serverName}.Core.Exceptions");
+            sb.AppendLine("    {");
+
+            BuildDescription(model.Description, sb);
+
+            sb.AppendLine($"        public class {model.Name}Exception : {serverName}BusinessException");
+            sb.AppendLine("         {");
+            if (model.HasParams.ToBooleanOrDefault())
+            {
+                BuildDescription(model.Description, sb);
+
+                sb.AppendLine($@"           public {model.Name}Exception(params string[] parameters)
+                                        :base({serverName}StatusCode.{model.Name},parameters)");
+                sb.AppendLine(@"            { }");
+
+                BuildDescription(model.Description, sb);
+
+                sb.AppendLine($@"           public {model.Name}Exception(Exception excep,params string[] parameters)
+                                         : base({serverName}StatusCode.{model.Name},excep,parameters)");
+
+
+                sb.AppendLine(@"            { }");
+            }
+            else
+            {
+               
+
+                BuildDescription(model.Description, sb);
+
+                sb.AppendLine($@"           public {model.Name}Exception()
+                                        :base({serverName}StatusCode.{model.Name})");
+                sb.AppendLine(@"            { }");
+
+                BuildDescription(model.Description, sb);
+
+                sb.AppendLine($@"           public {model.Name}Exception(Exception excep)
+                                         : base({serverName}StatusCode.{model.Name},excep)");
+
+
+                sb.AppendLine(@"            { }");
+            }
+
+            sb.AppendLine("         }");
+            sb.AppendLine("     }   ");
+            return sb.ToString();
+        }
+
+        /// <summary>
+        /// 业务异常主类
+        /// </summary>
+        /// <param name="serverName"></param>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public static string BusissionExceptionContent(string serverName, ExceptionModel model)
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.AppendLine(@"  using ServiceCore.Abstractions;");
+            sb.AppendLine(@"  using System;");
+            sb.AppendLine(@"  using System.Collections.Generic;");
+            sb.AppendLine(@"  using System.Text; ");
+
+            sb.AppendLine($"  namespace {serverName}.Core.Exceptions   ");
+            sb.AppendLine("   {   ");
+
+            BuildDescription(model.Description,sb);
+            
+            sb.AppendLine($"     public class {serverName}BusinessException : BusinessException");
+            sb.AppendLine("      {");
+
+            BuildDescription(model.Description, sb);
+            sb.AppendLine($@"       public {serverName}BusinessException({serverName}StatusCode status)
+                                    :base((int) status,status.Description())
+                                    ");
+            sb.AppendLine(@"        { }");
+
+            BuildDescription(model.Description, sb);
+
+            sb.AppendLine($@"       public {serverName}BusinessException({serverName}StatusCode status, params string[] parameters)
+                                    :base((int)status, string.Format(status.Description(), parameters))
+            ");
+            sb.AppendLine(@"        { }");
+
+            BuildDescription(model.Description, sb);
+
+            sb.AppendLine($@"       public {serverName}BusinessException({serverName}StatusCode status, Exception innerException)
+                                    :base((int)status,status.Description(),innerException)
+                                     ");
+            sb.AppendLine(@"        { }");
+
+
+            BuildDescription(model.Description, sb);
+
+
+            sb.AppendLine($@"       public {serverName}BusinessException({serverName}StatusCode status,Exception innerException, params string[] parameters)
+                                    :base((int)status, string.Format(status.Description(), parameters),innerException)
+                                    ");
+            sb.AppendLine(@"        { }");
+            sb.AppendLine("      }");
+            sb.AppendLine("   }   ");
+            return sb.ToString();
+
+        }
+
+        public static void BuildDescription(string description,StringBuilder sb)
+        {
+            sb.AppendLine("      ///<summary>");
+            sb.AppendLine($"     /// {description}的异常");
+            sb.AppendLine("      /// </summary>");
+        }
+
+        /// <summary>
+        /// 异常枚举模版
+        /// </summary>
+        /// <param name="statuCodes"></param>
+        /// <param name="serverName"></param>
+        /// <returns></returns>
+        public static string EnumExceptionStatuCode(IEnumerable<XmlStatuCode> statuCodes,string serverName)
+        {
+            var statuCode = statuCodes.SelectMany(p => p.Exceptions);
+
+
+            StringBuilder sb = new StringBuilder();
+            sb.AppendLine("    using System;");
+            sb.AppendLine("    using System.ComponentModel;");
+            
+            sb.AppendLine($"   namespace {serverName}.Core");
+            sb.AppendLine("    {");
+
+            BuildDescription("异常枚举",sb);
+
+            sb.AppendLine($"     public enum {serverName}StatusCode");
+            sb.AppendLine("      {");
+
+            
+
+
+            foreach (var code in statuCode)
+            {
+                BuildDescription(code.Description, sb);
+                sb.AppendLine($"       [Description(\"{ code.Message}\")]");
+                sb.AppendLine($"       {code.Name} = {code.Value},");
+            }
+
+           
+
+            sb.AppendLine("      }");
+            sb.AppendLine("    }");
+
+            return sb.ToString();
+        }
+    }
+}

+ 170 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Filters/ServiceExceptionFilter.cs

@@ -0,0 +1,170 @@
+
+using DFS.Core.Abstractions.Exceptions;
+using DFS.Core.Abstractions.View;
+using DFS.Core.Mvc.Results;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.Logging;
+
+namespace DFS.Core.Mvc
+{
+    /// <summary>
+    /// 异常错误处理过滤器
+    /// </summary>
+    public class ServiceExceptionFilter : IExceptionFilter, IAsyncExceptionFilter
+    {
+        /////// <summary>
+        /////// 主机环境设置 
+        /////// </summary>
+        //private readonly IWebHostEnvironment _hostingEnvironment;
+        /// <summary>
+        /// 日志
+        /// </summary>
+        private readonly ILogger _logger;
+
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        /// <param name="hostingEnvironment">环境变量配置</param>
+        /// <param name="loggerFactory">日志工厂</param>
+        public ServiceExceptionFilter( ILoggerFactory loggerFactory)
+        {
+           
+            _logger = loggerFactory.CreateLogger<ServiceExceptionFilter>();
+        }
+
+        /// <summary>
+        /// 发生异常时执行
+        /// </summary>
+        /// <param name="context">异常上下文</param>
+        public void OnException(ExceptionContext context)
+        {
+            string requestId = context.HttpContext.TraceIdentifier + new Random().Next(1000, 9999);
+            if (context.HttpContext != null && context.HttpContext.Request != null && context.HttpContext.Request.Query != null && context.HttpContext.Request.Query.ContainsKey(Constants.REQUEST_ID_QUERY_KEY))
+            {
+                //Guid.TryParse(context.HttpContext.Request.Query[""][0], out requestId);
+                var value = context.HttpContext.Request.Query[""][0];
+                if (!string.IsNullOrWhiteSpace(value))
+                {
+                    requestId = context.HttpContext.Request.Query[""][0];
+                }
+            }
+            object contentResult = null;
+            if (context.ActionDescriptor is Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor)
+            {
+                Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor controllerActionDescriptor = context.ActionDescriptor as Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor;
+
+                if (controllerActionDescriptor?.MethodInfo.ReturnType == typeof(bool))
+                {
+                    contentResult = default(bool);
+                }
+                if (controllerActionDescriptor?.MethodInfo.ReturnType == typeof(int))
+                {
+                    contentResult = int.MinValue;
+                }
+                if (controllerActionDescriptor?.MethodInfo.ReturnType == typeof(long))
+                {
+                    contentResult = long.MinValue;
+                }
+                if (controllerActionDescriptor?.MethodInfo.ReturnType == typeof(decimal))
+                {
+                    contentResult = decimal.MinValue;
+                }
+            }
+            if (context.Exception is StandardException)
+            {
+                context.Result = BuidResult(context.Exception as StandardException, requestId, contentResult);
+            }
+            else if (context.Exception is BusinessException)
+            {
+                context.Result = BuidResult(context.Exception as BusinessException, requestId, contentResult);
+            }
+            else
+            {
+                //context.HttpContext.RequestServices.get
+                //if (_hostingEnvironment.EnvironmentName == "Development")
+                //{
+                //    return;
+                //}
+
+                //var json = new JsonErrorResponse();
+
+                //json.Message = context.Exception.Message;//错误信息
+                
+                context.Result = BuidResult(new SystemErrorException(context.Exception==null?new Exception() : context.Exception), requestId, contentResult);
+
+            }
+            //异常已处理
+            context.ExceptionHandled = true;
+        }
+
+        /// <summary>
+        /// 异步发生异常时执行
+        /// </summary>
+        /// <param name="context">异常上下文</param>
+        /// <returns></returns>
+        public Task OnExceptionAsync(ExceptionContext context)
+        {
+            if (context == null)
+            {
+                throw new ArgumentNullException(nameof(context));
+            }
+
+            OnException(context);
+            return Task.CompletedTask;
+        }
+
+        /// <summary>
+        ///  构造标准输出对象
+        /// </summary>
+        /// <param name="exception">微服务异常基类</param>
+        /// <param name="requestId"></param>
+        /// <param name="contentResult"></param>
+        /// <returns></returns>
+        private StandardObjectResult BuidResult(MicroServiceException exception, string requestId, object contentResult = null)
+        {
+
+            return new StandardObjectResult(new ServiceProtocol()
+            {
+                StatusCode = exception.StatusCode,
+                Content = contentResult,
+                RequestId = requestId,
+                Notification = exception.InnerException != null ? exception.InnerException.Message : exception.Notification
+            });
+        }
+
+
+        /// <summary>
+        /// 自定义返回格式
+        /// </summary>
+        /// <param name="throwMsg"></param>
+        /// <param name="ex"></param>
+        /// <returns></returns>
+        public string WriteLog(string throwMsg, Exception ex)
+        {
+            return string.Format("\r\n【自定义错误】:{0} \r\n【异常类型】:{1} \r\n【异常信息】:{2} \r\n【堆栈调用】:{3}", new object[] { throwMsg,
+                ex.GetType().Name, ex.Message, ex.StackTrace });
+        }
+
+        public class InternalServerErrorObjectResult : ObjectResult
+        {
+            public InternalServerErrorObjectResult(object value) : base(value)
+            {
+                StatusCode = StatusCodes.Status500InternalServerError;
+            }
+        }
+        //返回错误信息
+        public class JsonErrorResponse
+        {
+            /// <summary>
+            /// 生产环境的消息
+            /// </summary>
+            public string Message { get; set; }
+            /// <summary>
+            /// 开发环境的消息
+            /// </summary>
+            public string DevelopmentMessage { get; set; }
+        }
+    }
+}

+ 120 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Filters/StandardResultFilter.cs

@@ -0,0 +1,120 @@
+
+using DFS.Core.Abstractions;
+using DFS.Core.Abstractions.View;
+using DFS.Core.Mvc.Results;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+
+namespace DFS.Core.Mvc.Filters
+{
+    /// <summary>
+    /// 标准结果集
+    /// </summary>
+    public class StandardResultFilter : IResultFilter, IAsyncResultFilter
+    {
+        /// <summary>
+        /// Result执行后
+        /// </summary>
+        /// <param name="context"></param>
+        public void OnResultExecuted(ResultExecutedContext context)
+        {
+        }
+
+        /// <summary>
+        /// Result执行中
+        /// </summary>
+        /// <param name="context"></param>
+        public void OnResultExecuting(ResultExecutingContext context)
+        {
+            string requestId = context.HttpContext.TraceIdentifier + new Random().Next(1000, 9999);
+            if (context.Result is OkObjectResult)
+            {
+                return;
+            }
+            if (context.ActionDescriptor.EndpointMetadata.Any(p => p.GetType().Name == "NoStandardResultAttribute"))
+            {
+                return;
+            }
+            if (context.Result is BadRequestObjectResult)
+            {
+                context.Result = new StandardObjectResult(new ServiceProtocol()
+                {
+                    StatusCode = (int)MicroServiceStatus.BadRequest,
+                    Content = null,
+                    RequestId = requestId,
+                    Notification = string.Join(",", ((context.Result as BadRequestObjectResult).Value as ValidationProblemDetails).Errors.Select(a => $"字段{a.Key}:{string.Join(',', a.Value)}"))
+                });
+            }
+            else if (context.Result is ObjectResult)
+            {
+                ObjectResult result = context.Result as ObjectResult;
+
+              
+                if (context.HttpContext != null && context.HttpContext.Request != null && context.HttpContext.Request.Query != null && context.HttpContext.Request.Query.ContainsKey("requestId"))
+                {
+                    //Guid.TryParse(context.HttpContext.Request.Query["requestId"][0], out requestId);
+                    requestId = context.HttpContext.Request.Query["requestId"][0];
+                }
+
+                if (context.Result is UnauthorizedObjectResult)
+                {
+                    context.Result = new StandardObjectResult(result, requestId, true);
+                    return;
+                }
+                //如果是空值则返回404异常
+                if (result.Value == null)
+                {
+                    context.Result = new StandardObjectResult(new ServiceProtocol()
+                    {
+                        StatusCode = (int)MicroServiceStatus.NotFound,
+                        Content = null,
+                        RequestId = requestId,
+                        Notification = MicroServiceStatus.NotFound.Description()
+                    });
+                }
+                else
+                {
+                    if (context.ActionDescriptor.EndpointMetadata.Any(p => p.GetType().Name == "RequestResNoPackingAttribute"))
+                    {
+
+                    }
+                    else
+                    {
+                        StandardObjectResult standardObjectResult = new StandardObjectResult(result, requestId);
+                        if (standardObjectResult.Value != null)
+                        {
+                            standardObjectResult.Value.RequestId = requestId;
+                        }
+
+                        context.Result = standardObjectResult;
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// 异步Result执行
+        /// </summary>
+        /// <param name="context"></param>
+        /// <param name="next"></param>
+        /// <returns></returns>
+        public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
+        {
+            if (context == null)
+            {
+                throw new ArgumentNullException(nameof(context));
+            }
+
+            if (next == null)
+            {
+                throw new ArgumentNullException(nameof(next));
+            }
+
+            OnResultExecuting(context);
+            if (!context.Cancel)
+            {
+                OnResultExecuted(await next());
+            }
+        }
+    }
+}

+ 78 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Filters/ValidationActionFilter.cs

@@ -0,0 +1,78 @@
+using DFS.Core.Abstractions.Exceptions;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.AspNetCore.Mvc.ModelBinding;
+
+namespace DFS.Core.Mvc.Filters
+{
+    /// <summary>
+    /// 校验过滤器
+    /// </summary>
+    public class ValidationActionFilter : IActionFilter, IAsyncActionFilter
+    {
+        /// <summary>
+        /// 活动执行后
+        /// </summary>
+        /// <param name="context"></param>
+        public void OnActionExecuted(ActionExecutedContext context)
+        {
+        }
+
+        /// <summary>
+        /// Action执行中是触发
+        /// </summary>
+        /// <param name="context"></param>
+        public void OnActionExecuting(ActionExecutingContext context)
+        {
+            if (!context.ModelState.IsValid)
+            {
+                List<Notification> errors = new List<Notification>();
+                foreach (KeyValuePair<string, ModelStateEntry> item in context.ModelState)
+                {
+                    if (item.Value.ValidationState == ModelValidationState.Invalid || item.Value.Errors.Count > 0)
+                    {
+                        errors.Add(new Notification() { FieldsName = item.Key, ErrorsMessage = item.Value.Errors.Select(a => a.ErrorMessage) });
+                    }
+                }
+                throw new BadRequestException(string.Join(",", errors.Select(a => a.ToString())));
+            }
+        }
+
+        /// <summary>
+        /// 异步Action执行中是触发
+        /// </summary>
+        /// <param name="context"></param>
+        /// <param name="next"></param>
+        /// <returns></returns>
+        public async Task OnActionExecutionAsync(
+            ActionExecutingContext context,
+            ActionExecutionDelegate next)
+        {
+            if (context == null)
+            {
+                throw new ArgumentNullException(nameof(context));
+            }
+
+            if (next == null)
+            {
+                throw new ArgumentNullException(nameof(next));
+            }
+
+            OnActionExecuting(context);
+            if (context.Result == null)
+            {
+                OnActionExecuted(await next());
+            }
+        }
+
+        internal class Notification
+        {
+            public string FieldsName { get; set; }
+            public IEnumerable<string> ErrorsMessage { get; set; }
+
+            public override string ToString()
+            {
+                return $"【[{FieldsName}]:[{string.Join(",", ErrorsMessage)}]】";
+            }
+        }
+    }
+}

+ 71 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/HttpContextExcention.cs

@@ -0,0 +1,71 @@
+using System;
+using Microsoft.AspNetCore.Http;
+using Newtonsoft.Json;
+using System.Linq;
+using DFS.Core.Mvc.Jwt.Model;
+
+namespace DFS.Core.Mvc.Jwt
+{
+    /// <summary>
+    /// 扩展httpcontext 当前授权的用户
+    /// </summary>
+    public static class HttpContextExcention
+    {
+        
+
+        /// <summary>
+        /// 获取当前授权用户信息
+        /// </summary>
+        /// <param name="httpContext"></param>
+        /// <returns></returns>
+        public static TokenModel GetCurrentUser(this IHttpContextAccessor httpContext, IAuhUser user)
+        {
+            var str = httpContext.HttpContext.User.Claims.FirstOrDefault(p => p.Type == JwtConfig.TokenUser)?.Value;
+            if (!string.IsNullOrWhiteSpace(str))
+            {
+                return JsonConvert.DeserializeObject<TokenModel>(str);
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 获取当前授权的客户端信息
+        /// </summary>
+        /// <param name="httpContext"></param>
+        /// <returns></returns>
+        public static OpenClient GetCurrentClient(this IHttpContextAccessor httpContext)
+        {
+            var str = httpContext.HttpContext.User.Claims.FirstOrDefault(p => p.Type == "OpenApp")?.Value;
+            if (!string.IsNullOrWhiteSpace(str))
+            {
+                return JsonConvert.DeserializeObject<OpenClient>(str);
+            }
+            return null;
+        }
+
+
+        /// <summary>
+        /// 扩展客户端加密比较
+        /// </summary>
+        /// <param name="httpContextAccessor"></param>
+        /// <param name="body">请求的参数body</param>
+        /// <param name="key">秘钥</param>
+        /// <returns></returns>
+        public static bool AuthSign(this IHttpContextAccessor httpContextAccessor, string body, string key)
+        {
+            var client = httpContextAccessor.GetCurrentClient();
+            if (client == null)
+            {
+                return false;
+            }
+
+            if ((client?.Sign ?? "").IsNullOrWhiteSpace())
+            {
+                return false;
+            }
+
+            return string.Equals(SignatureHelper.GetSignStr(client.ToMapDictionary(), body, key),
+                client.Sign);
+        }
+    }
+}

+ 15 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/IAuhUser.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DFS.Core.Mvc.Jwt
+{
+    /// <summary>
+    /// 业务redis 存储的redis 对象
+    /// </summary>
+    public  class IAuhUser
+    {
+    }
+}

+ 272 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/Impl/AuthService.cs

@@ -0,0 +1,272 @@
+using DFS.Core.Mvc.Jwt.Model;
+using DFS.Infrastructure.Redis;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.Primitives;
+using Newtonsoft.Json;
+using System.Security.Claims;
+
+namespace DFS.Core.Mvc.Jwt.Impl
+{
+    public class AuthService : IAuth
+    {
+
+        private static UnauthorizedObjectResult _SysUnauthorizedResult = new UnauthorizedObjectResult("未授权的请求")
+        { StatusCode = 401, Value = "401 未授权的请求" };
+
+        private ITokenManager _tokenManager;
+        private readonly string _JwtTokenKey = "yuexiuhui!@#85632sdaxcdfeasdasdasdasd";
+
+        /// <summary>
+        /// 授权redis 库 数据库为3
+        /// </summary>
+        //public static CSRedisClient csRedisClient = CoreRedisHelper.GetRedisHelper("AuthRedis");
+
+        /// <summary>
+        /// 授权
+        /// </summary>
+        private IHttpContextAccessor _httpContextAccessor;
+
+        public AuthService(IHttpContextAccessor contextAccessor, ITokenManager tokenManager)
+        {
+            _httpContextAccessor = contextAccessor;
+            _tokenManager = tokenManager;
+        }
+
+
+        public bool AuthToken(ActionExecutingContext context)
+        {
+            var token = GetToken();
+            if (string.IsNullOrEmpty(token))
+            {
+                context.Result = _SysUnauthorizedResult;
+
+                return false;
+            }
+
+            //验证token 是否过期。
+            try
+            {
+                var adminToken = _tokenManager.DecodeToken<TokenModel>(token, _JwtTokenKey);
+                if (adminToken.ExpireTime < DateTimeOffset.Now || !BuildAuthUser(_httpContextAccessor,adminToken))
+                {
+                    context.Result = _SysUnauthorizedResult;
+                    return false;
+                }
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            return true;
+        }
+
+        ///// <summary>
+        ///// 获取客户端信息
+        ///// </summary>
+        ///// <param name="context"></param>
+        ///// <returns></returns>
+        //public bool AuthClient(ActionExecutingContext context)
+        //{
+        //    if (context.ActionDescriptor.EndpointMetadata.Any(p => p.GetType().Name == "AllowAnonymousAttribute"))
+        //    {
+        //        return true;
+        //    }
+        //    var client = GetClientInfo();
+        //    if (client == null || !client.AuthTimeSpan())
+        //    {
+        //        context.Result = _SysUnauthorizedResult;
+        //        return false;
+        //    }
+
+        //    BuildAuthClient(_httpContextAccessor, client);
+        //    return true;
+        //}
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        private string GetToken()
+        {
+            var token = string.Empty;
+            StringValues authorizationValue="";
+
+            if (_httpContextAccessor.HttpContext.Request.Headers.Any(o => o.Key.ToLower() == "authorization"))
+            {
+                _httpContextAccessor.HttpContext.Request.Headers.TryGetValue("Authorization", out authorizationValue);
+                _httpContextAccessor.HttpContext.Request.Headers.TryGetValue("authorization", out authorizationValue);
+            }
+
+            if (string.IsNullOrWhiteSpace(authorizationValue.ToString()))
+            {
+                _httpContextAccessor.HttpContext.Request.Query.TryGetValue("authorization", out authorizationValue);
+                _httpContextAccessor.HttpContext.Request.Query.TryGetValue("Authorization", out authorizationValue);
+            }
+
+            if (!string.IsNullOrWhiteSpace(authorizationValue.ToString()))
+            {
+                var splitCount = authorizationValue.ToString().Split(' ');
+                if (splitCount != null && splitCount.Count() > 1)
+                {
+                    token = splitCount[1];
+                }
+            }
+
+            return token;
+        }
+
+        /// <summary>
+        /// 获取授权ClientId
+        /// </summary>
+        /// <returns></returns>
+        private OpenClient GetClientInfo()
+        {
+            StringValues appid="";
+
+            if (_httpContextAccessor.HttpContext.Request.Headers.Any(o => o.Key.ToLower() == "authorization"))
+            {
+                _httpContextAccessor.HttpContext.Request.Headers.TryGetValue("AppId", out appid);
+                _httpContextAccessor.HttpContext.Request.Headers.TryGetValue("appid", out appid);
+            }
+
+            if (appid.ToString().IsNullOrWhiteSpace())
+            {
+                _httpContextAccessor.HttpContext.Request.Query.TryGetValue("AppId", out appid);
+                _httpContextAccessor.HttpContext.Request.Query.TryGetValue("appid", out appid);
+            }
+
+            if (appid.ToString().IsNullOrWhiteSpace())
+            {
+                return null;
+            }
+            StringValues timespan="";
+            if (_httpContextAccessor.HttpContext.Request.Headers.Any(o => o.Key.ToLower() == "timespan"))
+            {
+                _httpContextAccessor.HttpContext.Request.Headers.TryGetValue("timespan", out timespan);
+                _httpContextAccessor.HttpContext.Request.Headers.TryGetValue("TimeSpan", out timespan);
+            }
+
+            if (string.IsNullOrWhiteSpace(timespan.ToString()))
+            {
+                _httpContextAccessor.HttpContext.Request.Query.TryGetValue("timespan", out timespan);
+                _httpContextAccessor.HttpContext.Request.Query.TryGetValue("TimeSpan", out timespan);
+            }
+            if (timespan.ToString().IsNullOrWhiteSpace())
+            {
+                return null;
+            }
+
+            StringValues sign="";
+            if (_httpContextAccessor.HttpContext.Request.Headers.Any(o => o.Key.ToLower() == "sign"))
+            {
+                _httpContextAccessor.HttpContext.Request.Headers.TryGetValue("sign", out sign);
+                _httpContextAccessor.HttpContext.Request.Headers.TryGetValue("Sign", out sign);
+            }
+            if (string.IsNullOrWhiteSpace(sign.ToString()))
+            {
+                _httpContextAccessor.HttpContext.Request.Query.TryGetValue("Sign", out sign);
+                _httpContextAccessor.HttpContext.Request.Query.TryGetValue("sign", out sign);
+            }
+            if (timespan.ToString().IsNullOrWhiteSpace())
+            {
+                return null;
+            }
+            return new OpenClient(appid.ToString(), sign.ToString(), timespan.ToString());
+        }
+
+        /// <summary>
+        /// 向http context 生成授权当前用户的信息
+        /// </summary>
+        /// <param name="tokenValue"></param>
+        private bool BuildAuthData(string tokenValue)
+        {
+            if (tokenValue.IsNullOrWhiteSpace())
+            {
+                return false;
+            }
+            var authClient = CoreRedisHelper.GetRedisHelper("AuthJwtRedis");
+            if (authClient == null)
+            {
+                throw new Exception($"授权配置redis不能为空,名称节点:AuthJwtRedis");
+            }
+
+            var redisValue = authClient.Get(tokenValue);
+            if (redisValue.IsNullOrWhiteSpace())
+            {
+                return false;
+            }
+
+            //var aesDecryptStr = redisValue.AesDecryptFormBase64(key);
+            //var sortedDic= JsonConvert.DeserializeObject<SortedDictionary<string, string>>(aesDecryptStr);
+            string decryptString = "";
+            //EncryptUtil.AesDecrypt(redisValue, JwtConfig.RedisKey);
+            //var sortedDic = JsonConvert.DeserializeObject<SortedDictionary<string, string>>(decryptString);
+
+            ////var sortedDicS = DoUitl.GetEnity<SortedDictionary<string, string>>(decryptString);
+            //var userInfo = new UserInfo();
+          
+            //var userClient = sortedDic.GetEntity<UserClient>();
+            //if (userClient == null || userClient.expired_time.ToDateTime() < new DateTime())
+            //{
+            //    return false;
+            //}
+            //userInfo.UserClient = userClient;
+            return BuildAuthUser(_httpContextAccessor, new TokenModel());
+        }
+
+
+        /// <summary>
+        /// 生成授权用户信息
+        /// </summary>
+        /// <param name="httpContext"></param>
+        /// <param name="userInfo"></param>
+        /// <returns></returns>
+        private bool BuildAuthUser(IHttpContextAccessor httpContext, TokenModel userInfo)
+        {
+            ClaimsPrincipal principal = new ClaimsPrincipal(
+                new ClaimsIdentity(
+                    new[] {
+                        new Claim(JwtConfig.TokenUser,JsonConvert.SerializeObject(userInfo), ClaimValueTypes.String,"DFS.com"),
+                        new Claim(JwtConfig.SystemType, userInfo.SystemType,ClaimValueTypes.String,"DFS.com"),
+                        new Claim(JwtConfig.Channel, userInfo.Channel_type,ClaimValueTypes.String,"DFS.com"),
+                    },
+                    "DFS"
+                ));
+            httpContext.HttpContext.User = principal;
+            return true;
+        }
+
+        /// <summary>
+        /// 生成授权客户端
+        /// </summary>
+        /// <param name="httpContext"></param>
+        /// <param name="userInfo"></param>
+        /// <returns></returns>
+        private bool BuildAuthClient(IHttpContextAccessor httpContext, OpenClient app)
+        {
+            ClaimsPrincipal principal = new ClaimsPrincipal(
+                new ClaimsIdentity(
+                    new[] {
+                        new Claim("OpenClient",JsonConvert.SerializeObject(app), ClaimValueTypes.String,"DFS.com"),
+                    },
+                    "DFS.TK"
+                ));
+            httpContext.HttpContext.User = principal;
+            return true;
+        }
+
+        /// <summary>
+        /// 验证客户端授权,从ClientId+密钥方式进行获取
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
+        public bool AuthClient(ActionExecutingContext context)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 25 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/Impl/IAuth.cs

@@ -0,0 +1,25 @@
+using System;
+using Microsoft.AspNetCore.Mvc.Filters;
+
+namespace DFS.Core.Mvc.Jwt.Impl
+{
+    /// <summary>
+    /// 授权扩展
+    /// </summary>
+    public interface IAuth
+    {
+        /// <summary>
+        /// Token 授权
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        bool AuthToken(ActionExecutingContext context);
+
+        ///// <summary>
+        ///// client 授权
+        ///// </summary>
+        ///// <param name="context"></param>
+        ///// <returns></returns>
+        bool AuthClient(ActionExecutingContext context);
+    }
+}

+ 38 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/Impl/ITokenManage.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace DFS.Core.Mvc.Jwt.Impl
+{
+    /// <summary>
+    /// web token 管理对象接口
+    /// </summary>
+    public interface ITokenManager
+    {
+        /// <summary>
+        /// 生成token
+        /// </summary>
+        /// <param name="payload">非敏感信息</param>
+        /// <param name="secret">密钥</param>
+        /// <returns></returns>
+        string BuildToken(object payload, string secret);
+
+        /// <summary>
+        /// 解码token获取json信息
+        /// </summary>
+        /// <param name="token">token</param>
+        /// <param name="secret">密钥</param>
+        /// <param name="verify">是否验证签名后再返回解码信息</param>
+        /// <returns></returns>
+        string DecodeToken(string token, string secret, bool verify = true);
+
+        /// <summary>
+        /// 解码token获取json信息
+        /// </summary>
+        /// <param name="token">token</param>
+        /// <param name="secret">密钥</param>
+        /// <param name="verify">是否验证签名后再返回解码信息</param>
+        /// <returns></returns>
+        T DecodeToken<T>(string token, string secret, bool verify = true);
+    }
+}

+ 72 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/Impl/JWTManager.cs

@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using JWT;
+using JWT.Algorithms;
+using JWT.Serializers;
+
+namespace DFS.Core.Mvc.Jwt.Impl
+{
+    /// <summary>
+    /// 以JWT算法实现的web token 管理类
+    /// </summary>
+    public class JWTManager : ITokenManager
+    {
+        private IJwtEncoder encoder;
+        private IJwtDecoder decoder;
+        /// <summary>
+        /// 生成token
+        /// </summary>
+        /// <param name="payload">非敏感信息</param>
+        /// <param name="secret">密钥</param>
+        /// <returns></returns>
+        public string BuildToken(object payload, string secret)
+        {
+            return encoder.Encode(payload, secret);
+        }
+        /// <summary>
+        /// 解码token获取json信息
+        /// </summary>
+        /// <param name="token">token</param>
+        /// <param name="secret">密钥</param>
+        /// <param name="verify">是否验证签名后再返回解码信息</param>
+        /// <returns></returns>
+        public string DecodeToken(string token, string secret, bool verify = true)
+        {
+            return decoder.Decode(token, secret, verify);
+        }
+        /// <summary>
+        /// 解码token获取json信息
+        /// </summary>
+        /// <param name="token">token</param>
+        /// <param name="secret">密钥</param>
+        /// <param name="verify">是否验证签名后再返回解码信息</param>
+        /// <returns></returns>
+        public T DecodeToken<T>(string token, string secret, bool verify = true)
+        {
+            return decoder.DecodeToObject<T>(token, secret, verify);
+        }
+
+        /// <summary>
+        /// 构造函数初始化
+        /// </summary>
+        public JWTManager()
+        {
+            if (encoder == null)
+            {
+                IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
+                IJsonSerializer serializer = new JsonNetSerializer();
+                IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
+                encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
+            }
+            if (decoder == null)
+            {
+                IJsonSerializer serializer = new JsonNetSerializer();
+                IDateTimeProvider provider = new UtcDateTimeProvider();
+                IJwtValidator validator = new JwtValidator(serializer, provider);
+                IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
+                decoder = new JwtDecoder(serializer, urlEncoder);
+            }
+        }
+    }
+}

+ 47 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/JwtBuildHelp.cs

@@ -0,0 +1,47 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using DFS.Core.Mvc.Jwt.Impl;
+using DFS.Core.Mvc.Jwt.Model;
+using DFS.Infrastructure.Redis;
+using Newtonsoft.Json;
+
+
+namespace DFS.Core.Mvc.Jwt
+{
+    public class JwtBuildHelp
+    {
+        public JwtBuildHelp()
+        {
+
+        }
+
+        /// <summary>
+        /// build jwt 
+        /// </summary>
+        /// <param name="model"></param>
+        /// <param name="auhUser"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public string BuildJwt(TokenModel model, IAuhUser auhUser)
+        {
+            var tokenManage = new JWTManager();
+            var tokenGuid = Guid.NewGuid().ToString("N");
+            model.ExpireTime = DateTime.Now.AddHours(2);
+            model.Token = tokenGuid;
+            var token = tokenManage.BuildToken(model, JwtConfig.JwtTokenKey);
+            if (auhUser != null)
+            {
+                var authClient = CoreRedisHelper.GetRedisHelper(JwtConfig.RedisCon);
+                if (authClient == null)
+                {
+                    throw new Exception($"授权配置redis不能为空,配置节点:{JwtConfig.RedisCon}");
+                }
+                var dicValue = auhUser.ToMapDictionary();
+                authClient.Set(tokenGuid, JsonConvert.SerializeObject(dicValue), 6250);
+            }
+            return token;
+        }
+    }
+}

+ 29 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/JwtConfig.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace DFS.Core.Mvc.Jwt
+{
+    /// <summary>
+    /// jwt 配置信息
+    /// </summary>
+    public static class JwtConfig
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public const string JwtTokenKey = "DFSTK@#NXYL66H4L";
+
+        public const string RedisKey = "64bf6b4fe82740dc864dc681cdd2ffbf";
+
+        public const string RedisCon = "AuthJwtRedis";
+
+        public const string UserCliam = "";
+
+        public const string Channel = "Channel";
+
+        public const string SystemType = "SystemType";
+
+        public const string TokenUser = "TokenUser";
+    }
+}

+ 15 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/JwtServiceCollectionExtension.cs

@@ -0,0 +1,15 @@
+using DFS.Core.Mvc.Jwt.Impl;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace DFS.Core.Mvc.Jwt
+{
+    public static class JwtServiceCollectionExtension
+    {
+        public static IServiceCollection AddJwtAuth(this IServiceCollection services)
+        {
+            services.AddTransient<IAuth, AuthService>();
+            services.AddTransient<ITokenManager, JWTManager>();
+            return services;
+        }
+    }
+}

+ 54 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Jwt/Model/TokenModel.cs

@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace DFS.Core.Mvc.Jwt.Model
+{ 
+    public class TokenModel
+    {
+        /// <summary>
+        ///  redis 里面的key
+        /// </summary>
+        public string Token { get; set; }
+
+        /// <summary>
+        /// 扩展id
+        /// openid or unionId
+        /// </summary>
+        public string BusId { get; set; }
+
+        /// <summary>
+        ///  系统用户id
+        /// </summary>
+        public long UserId { get; set; }
+
+        /// <summary>
+        /// 过期时间
+        /// </summary>
+        public DateTime ExpireTime { get; set; }
+
+
+        /// <summary>
+        /// 用户维度区分
+        /// 000超级管理员直接跳过所有权限
+        /// 100 后台应用用户体系
+        /// 200 C端用户客户体系
+        /// </summary>
+        public string SystemType { get; set; } = "";
+
+        /// <summary>
+        /// 系统来源 区别多应用渠道
+        /// </summary>
+        public string Channel_type { get; set; } = "10001";
+
+        public TokenModel(string token,DateTime expireTime)
+        {
+            Token = token;
+            ExpireTime = expireTime;
+        }
+        public TokenModel()
+        {
+
+        }
+    }
+}

+ 15 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Middlewares/LogMiddleware.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace DFS.Core.Mvc.Middlewares
+{
+    /// <summary>
+    /// 请求的中间件
+    /// 扩展分布式日志待定 
+    /// </summary>
+    public class LogMiddleware
+    {
+
+    }
+}

+ 45 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/Results/StandardObjectResult.cs

@@ -0,0 +1,45 @@
+using DFS.Core.Abstractions;
+using DFS.Core.Abstractions.View;
+using Microsoft.AspNetCore.Mvc;
+
+namespace DFS.Core.Mvc.Results
+{
+    /// <summary>
+    /// 标准对象结果
+    /// </summary>
+    public class StandardObjectResult : ObjectResult
+    {
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        /// <param name="protocol">基础结构</param>
+        public StandardObjectResult(ServiceProtocol protocol)
+            : base(protocol)
+        {
+        }
+
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        /// <param name="obj">对象结果</param>
+        public StandardObjectResult(ObjectResult obj, string requestId)
+            : this(new ServiceProtocol() { Content = obj.Value, StatusCode = (int)MicroServiceStatus.Normal, RequestId = requestId })
+        {
+        }
+
+
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        /// <param name="obj">对象结果</param>
+        public StandardObjectResult(ObjectResult obj, string requestId,bool UnAuthorized)
+            : this(new ServiceProtocol() { Content = obj.Value, StatusCode = (int)MicroServiceStatus.UnAuthorized, RequestId = requestId})
+        {
+        }
+
+        /// <summary>
+        /// 复写基类的值
+        /// </summary>
+        public new ServiceProtocol Value { get; set; }
+    }
+}

+ 57 - 0
FuelCloud/src/Fuel.Payment.Server/MicServer/WebAppliactionExtend.cs

@@ -0,0 +1,57 @@
+using DFS.Core.Mvc;
+using DFS.Core.Mvc.Filters;
+using DFS.Core.Mvc.Jwt;
+using DFS.Core.Utils;
+using DFS.Core.Utily;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Serialization;
+
+namespace Fuel.PaymentServer.MicServer
+{
+    public static class WebAppliactionExtend
+    {
+
+        /// <summary>
+        /// 添加服务注入
+        /// </summary>
+        /// <param name="services"></param>
+        /// <param name="environmentName"></param>
+        /// <returns></returns>
+        public static IServiceCollection AddMicService(this IServiceCollection services, IWebHostEnvironment environmentName)
+        {
+            services.AddSingleton(new Appsettings(environmentName.ContentRootPath, environmentName.EnvironmentName));
+            //services.AddJwtAuth();
+            services.AddHealthChecks();
+            services.AddControllers(options =>
+            {
+                options.Filters.Add(typeof(ValidationActionFilter));
+                options.Filters.Add(typeof(StandardResultFilter));
+                options.Filters.Add(typeof(ServiceExceptionFilter));
+            })
+            .AddNewtonsoftJson(options =>//全局配置Json序列化处理
+            {
+                //忽略循环引用
+                options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
+                //不使用驼峰样式的key
+                options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
+            }).AddJsonOptions(options => options.JsonSerializerOptions.Converters.Add(new DatetimeJsonConverter()));
+
+            if (services.All(u => u.ServiceType != typeof(IHttpContextAccessor)))
+            {
+                services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
+            }
+            return services;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="application"></param>
+        /// <returns></returns>
+        public static WebApplication UseDFSServer(this WebApplication application)
+        {
+            application.UseCors(p => p.AllowCredentials());
+            return application;
+        }
+    }
+}

+ 36 - 0
FuelCloud/src/Fuel.Payment.Server/Program.cs

@@ -0,0 +1,36 @@
+
+
+using DFS.Core.Mvc;
+using Fuel.PaymentServer.MicServer;
+
+var builder = WebApplication.CreateBuilder(args);
+
+// Add services to the container.
+
+//³õʼ»¯DFS Server
+builder.Services.AddMicService(builder.Environment);
+
+// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
+builder.Services.AddEndpointsApiExplorer();
+builder.Services.AddSwaggerGen();
+
+var app = builder.Build();
+
+
+
+// Configure the HTTP request pipeline.
+if (app.Environment.IsDevelopment())
+{
+    app.UseSwagger();
+    app.UseSwaggerUI();
+}
+
+app.UseDFSServer();
+
+app.UseHttpsRedirection();
+
+app.UseAuthorization();
+
+app.MapControllers();
+
+app.Run();

+ 41 - 0
FuelCloud/src/Fuel.Payment.Server/Properties/launchSettings.json

@@ -0,0 +1,41 @@
+{
+  "$schema": "http://json.schemastore.org/launchsettings.json",
+  "iisSettings": {
+    "windowsAuthentication": false,
+    "anonymousAuthentication": true,
+    "iisExpress": {
+      "applicationUrl": "http://localhost:22762",
+      "sslPort": 44319
+    }
+  },
+  "profiles": {
+    "http": {
+      "commandName": "Project",
+      "dotnetRunMessages": true,
+      "launchBrowser": true,
+      "launchUrl": "swagger",
+      "applicationUrl": "http://localhost:5006",
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      }
+    },
+    "https": {
+      "commandName": "Project",
+      "dotnetRunMessages": true,
+      "launchBrowser": true,
+      "launchUrl": "swagger",
+      "applicationUrl": "https://localhost:7022;http://localhost:5006",
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      }
+    },
+    "IIS Express": {
+      "commandName": "IISExpress",
+      "launchBrowser": true,
+      "launchUrl": "swagger",
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      }
+    }
+  }
+}

+ 13 - 0
FuelCloud/src/Fuel.Payment.Server/WeatherForecast.cs

@@ -0,0 +1,13 @@
+namespace Fuel.PaymentServer
+{
+    public class WeatherForecast
+    {
+        public DateOnly Date { get; set; }
+
+        public int TemperatureC { get; set; }
+
+        public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
+
+        public string? Summary { get; set; }
+    }
+}

+ 8 - 0
FuelCloud/src/Fuel.Payment.Server/appsettings.Development.json

@@ -0,0 +1,8 @@
+{
+  "Logging": {
+    "LogLevel": {
+      "Default": "Information",
+      "Microsoft.AspNetCore": "Warning"
+    }
+  }
+}

+ 9 - 0
FuelCloud/src/Fuel.Payment.Server/appsettings.json

@@ -0,0 +1,9 @@
+{
+  "Logging": {
+    "LogLevel": {
+      "Default": "Information",
+      "Microsoft.AspNetCore": "Warning"
+    }
+  },
+  "AllowedHosts": "*"
+}

+ 7 - 0
FuelCloud/src/Fuel.Payment.Service/Class1.cs

@@ -0,0 +1,7 @@
+namespace Fuel.Payment.Service
+{
+    public class Class1
+    {
+
+    }
+}

+ 13 - 0
FuelCloud/src/Fuel.Payment.Service/Fuel.Payment.Service.csproj

@@ -0,0 +1,13 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Folder Include="Impl\" />
+  </ItemGroup>
+
+</Project>