Explorar el Código

添加项目文件。

CrazyIter hace 5 años
padre
commit
67c94648aa
Se han modificado 100 ficheros con 7287 adiciones y 0 borrados
  1. 45 0
      TEAMModelOS.API/Controllers/BaseController.cs
  2. 58 0
      TEAMModelOS.API/Controllers/Core/ClassroomController.cs
  3. 205 0
      TEAMModelOS.API/Controllers/Core/FileController.cs
  4. 34 0
      TEAMModelOS.API/Models/Core/Classroom.cs
  5. 15 0
      TEAMModelOS.API/TEAMModelOS.API.csproj
  6. 22 0
      TEAMModelOS.SDK/Context/Attributes/AllowCors/AllowCorsAttribute.cs
  7. 11 0
      TEAMModelOS.SDK/Context/Attributes/Azure/PartitionKeyAttribute.cs
  8. 12 0
      TEAMModelOS.SDK/Context/Attributes/Azure/TableSpaceAttribute.cs
  9. 31 0
      TEAMModelOS.SDK/Context/Configuration/BaseConfigModel.cs
  10. 10 0
      TEAMModelOS.SDK/Context/Configuration/IBusinessService.cs
  11. 31 0
      TEAMModelOS.SDK/Context/Constant/Constants.cs
  12. 393 0
      TEAMModelOS.SDK/Context/Constant/ContentTypeDict.cs
  13. 24 0
      TEAMModelOS.SDK/Context/Constant/FileType.cs
  14. 44 0
      TEAMModelOS.SDK/Context/Constant/FileTypeMap.cs
  15. 25 0
      TEAMModelOS.SDK/Context/Constant/GetFileType.cs
  16. 59 0
      TEAMModelOS.SDK/Context/Constant/ResponseCode.cs
  17. 54 0
      TEAMModelOS.SDK/Context/Exception/BizException.cs
  18. 86 0
      TEAMModelOS.SDK/Context/Filters/HttpGlobalExceptionFilter.cs
  19. 153 0
      TEAMModelOS.SDK/Context/Filters/HttpGlobalExceptionInvoke.cs
  20. 20 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcRequest/AzureTokenJsonRPCRequest.cs
  21. 16 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcRequest/BaseJosnRPCRequest.cs
  22. 13 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcRequest/JosnRPCRequest.cs
  23. 15 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcRequest/PaginationJosnRPCRequest.cs
  24. 14 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/BaseJosnRPCResponse.cs
  25. 16 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/DataJosnRPCResponse.cs
  26. 16 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/ErrorJosnRPCResponse.cs
  27. 13 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/ErrorModel.cs
  28. 13 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/JosnRPCResponse.cs
  29. 169 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/JsonRPCResponseBuilder.cs
  30. 16 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/JsonRPCResult.cs
  31. 17 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/PageJosnRPCResponse.cs
  32. 15 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/PageJsonRPCResult.cs
  33. 17 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/TokenJosnRPCResponse.cs
  34. 16 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/TokenJsonRPCResult.cs
  35. 13 0
      TEAMModelOS.SDK/Extension/DataResult/PageToken/AzurePagination.cs
  36. 17 0
      TEAMModelOS.SDK/Extension/DataResult/PageToken/AzureTableToken.cs
  37. 31 0
      TEAMModelOS.SDK/Extension/DataResult/PageToken/Pagination.cs
  38. 12 0
      TEAMModelOS.SDK/Extension/DataResult/PageToken/PaginationData.cs
  39. 13 0
      TEAMModelOS.SDK/Extension/DataResult/RequestData/AzureTokenRequest.cs
  40. 12 0
      TEAMModelOS.SDK/Extension/DataResult/RequestData/BaseRequest.cs
  41. 10 0
      TEAMModelOS.SDK/Extension/DataResult/RequestData/PaginationRequest.cs
  42. 16 0
      TEAMModelOS.SDK/Extension/DataResult/ResponseData/BaseResponse.cs
  43. 14 0
      TEAMModelOS.SDK/Extension/DataResult/ResponseData/DataResponse.cs
  44. 15 0
      TEAMModelOS.SDK/Extension/DataResult/ResponseData/PageDatasResponse.cs
  45. 162 0
      TEAMModelOS.SDK/Extension/DataResult/ResponseData/ResponseBuilder.cs
  46. 16 0
      TEAMModelOS.SDK/Extension/DataResult/ResponseData/TimeStampResponse.cs
  47. 14 0
      TEAMModelOS.SDK/Extension/DataResult/ResponseData/TokenPageDatasResponse.cs
  48. 17 0
      TEAMModelOS.SDK/Extension/HttpClient/HttpClientExtension.cs
  49. 177 0
      TEAMModelOS.SDK/Extension/HttpClient/Implements/HttpClientSchool.cs
  50. 175 0
      TEAMModelOS.SDK/Extension/HttpClient/Implements/HttpClientSendCloud.cs
  51. 177 0
      TEAMModelOS.SDK/Extension/HttpClient/Implements/HttpClientUserInfo.cs
  52. 18 0
      TEAMModelOS.SDK/Extension/JsonPath/IJsonPathValueSystem.cs
  53. 105 0
      TEAMModelOS.SDK/Extension/JsonPath/JsonApiValueSystem.cs
  54. 64 0
      TEAMModelOS.SDK/Extension/JsonPath/JsonNetValueSystem.cs
  55. 481 0
      TEAMModelOS.SDK/Extension/JsonPath/JsonPathContext.cs
  56. 54 0
      TEAMModelOS.SDK/Extension/JwtAuth/Filters/JwtAuthorizationFilter.cs
  57. 79 0
      TEAMModelOS.SDK/Extension/JwtAuth/JwtAuthExtension.cs
  58. 108 0
      TEAMModelOS.SDK/Extension/JwtAuth/JwtHelper/JwtHelper.cs
  59. 33 0
      TEAMModelOS.SDK/Extension/JwtAuth/Models/ClaimModel.cs
  60. 12 0
      TEAMModelOS.SDK/Extension/JwtAuth/Models/HttpConstant.cs
  61. 14 0
      TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtBlackRecord.cs
  62. 12 0
      TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtClient.cs
  63. 15 0
      TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtResponse.cs
  64. 30 0
      TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtSetting.cs
  65. 15 0
      TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtTokenOptions.cs
  66. 38 0
      TEAMModelOS.SDK/Extension/Language/Implements/LanguageService.cs
  67. 12 0
      TEAMModelOS.SDK/Extension/Language/Interfaces/ILanguageService.cs
  68. 18 0
      TEAMModelOS.SDK/Extension/Language/LanguageExtension.cs
  69. 10 0
      TEAMModelOS.SDK/Extension/Language/Model/SmsCountryCode.cs
  70. 156 0
      TEAMModelOS.SDK/Extension/MessagePush/Implements/SendCloudService.cs
  71. 42 0
      TEAMModelOS.SDK/Extension/MessagePush/Interfaces/ISendCloudService.cs
  72. 20 0
      TEAMModelOS.SDK/Extension/MessagePush/MessagePushExtension.cs
  73. 30 0
      TEAMModelOS.SDK/Extension/MessagePush/Model/SendCloudResponse.cs
  74. 36 0
      TEAMModelOS.SDK/Extension/MessagePush/Model/SmsConfig.cs
  75. 12 0
      TEAMModelOS.SDK/Extension/MessagePush/Model/SmsSendCloud.cs
  76. 23 0
      TEAMModelOS.SDK/Extension/SnowFlake/DisposableAction.cs
  77. 139 0
      TEAMModelOS.SDK/Extension/SnowFlake/IdWorker.cs
  78. 42 0
      TEAMModelOS.SDK/Extension/SnowFlake/TimeExtensions.cs
  79. 43 0
      TEAMModelOS.SDK/Helper/Common/CollectionHelper/CollectionHelper.cs
  80. 43 0
      TEAMModelOS.SDK/Helper/Common/CollectionHelper/ObjectToDictionaryHelper.cs
  81. 396 0
      TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorConverter.cs
  82. 27 0
      TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorHSL.cs
  83. 72 0
      TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorHSV.cs
  84. 238 0
      TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorHelper.cs
  85. 83 0
      TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorRGB.cs
  86. 147 0
      TEAMModelOS.SDK/Helper/Common/DateTimeHelper/DateTimeHelper.cs
  87. 799 0
      TEAMModelOS.SDK/Helper/Common/FileHelper/FileHelper.cs
  88. 550 0
      TEAMModelOS.SDK/Helper/Common/FileHelper/FileHelperCore.cs
  89. 38 0
      TEAMModelOS.SDK/Helper/Common/JsonHelper/ClassSerializers.cs
  90. 206 0
      TEAMModelOS.SDK/Helper/Common/JsonHelper/JsonSerialization.cs
  91. 35 0
      TEAMModelOS.SDK/Helper/Common/ReflectorExtensions/ReflectorExtensions.cs
  92. 36 0
      TEAMModelOS.SDK/Helper/Common/StringHelper/BufferHelper.cs
  93. 85 0
      TEAMModelOS.SDK/Helper/Common/StringHelper/HtmlHelper.cs
  94. 121 0
      TEAMModelOS.SDK/Helper/Common/StringHelper/StringHelper.cs
  95. 65 0
      TEAMModelOS.SDK/Helper/Common/ValidateHelper/ValidateHelper.cs
  96. 17 0
      TEAMModelOS.SDK/Helper/Common/WMFConverter/Gdi/BrushDIBColorsEnum.cs
  97. 24 0
      TEAMModelOS.SDK/Helper/Common/WMFConverter/Gdi/BrushEnum.cs
  98. 21 0
      TEAMModelOS.SDK/Helper/Common/WMFConverter/Gdi/BrushHSEnum.cs
  99. 34 0
      TEAMModelOS.SDK/Helper/Common/WMFConverter/Gdi/FontCharsetEnum.cs
  100. 0 0
      TEAMModelOS.SDK/Helper/Common/WMFConverter/Gdi/FontClipPrecisEnum.cs

+ 45 - 0
TEAMModelOS.API/Controllers/BaseController.cs

@@ -0,0 +1,45 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using System.Collections.Generic;
+using TEAMModelOS.SDK.Extension.JwtAuth.JwtHelper;
+using TEAMModelOS.SDK.Extension.JwtAuth.Models;
+using TEAMModelOS.SDK.Context.Constant.Common;
+using System.Security.Claims;
+
+namespace TEAMModelOS.API.Controllers
+{
+    public class BaseController : Controller
+    {
+        public List<string> GetLoginUser(string claimType)
+        {
+            var tokenHeader = "";
+            HttpRequest request = HttpContext.Request;
+            if (request.Headers.ContainsKey(Constants.AUTHORIZATION))
+            {
+                tokenHeader = request.Headers[Constants.AUTHORIZATION];
+                //tokenHeader = tokenHeader.ToString().Substring("Bearer ".Length).Trim();
+                tokenHeader = tokenHeader.Replace("Bearer ", "");
+            }
+            if (request.Query.ContainsKey(Constants.ACCESS_TOKEN))
+            {
+                tokenHeader = request.Query[Constants.ACCESS_TOKEN];
+                tokenHeader = tokenHeader.Trim();
+            }
+            if (string.IsNullOrEmpty(tokenHeader))
+            {
+                return null;
+            }
+            ClaimModel claimModel = JwtHelper.SerializeJWT(tokenHeader);
+            claimModel.Claim.TryGetValue(claimType, out var claimValue);
+            List<string> claimValues = new List<string>();
+            foreach (Claim claim in claimModel.Claims)
+            {
+                if (claim.Type.Equals(claimType))
+                {
+                    claimValues.Add(claim.Value);
+                }
+            }
+            return claimValues;
+        }
+    }
+}

+ 58 - 0
TEAMModelOS.API/Controllers/Core/ClassroomController.cs

@@ -0,0 +1,58 @@
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.API.Models.Core;
+using TEAMModelOS.SDK.Context.Exception;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
+using TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces;
+
+namespace TEAMModelOS.API.Controllers.Core
+{
+    [Route("api/[controller]")]
+    [ApiController]
+    public  class ClassroomController:BaseController
+    {
+        public readonly IAzureCosmosDBRepository cosmosrepository;
+        public ClassroomController(IAzureCosmosDBRepository _cosmosrepository) {
+            cosmosrepository = _cosmosrepository;
+        }
+        [HttpPost("SaveOrUpdateAll")]
+        public async Task<BaseJosnRPCResponse> SaveOrUpdateAll(JosnRPCRequest<Classroom> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            
+            if (request.@params.Id != null)
+            {
+                await cosmosrepository.ReplaceObject(request.@params, request.@params.Id, request.@params.SchoolCode);
+
+            }
+            else
+            {
+                request.@params.Id = Guid.NewGuid().ToString();
+                await cosmosrepository.Save<Classroom>(request.@params);
+                
+            }
+            return builder.Data(request.@params).build();
+        }
+
+        [HttpPost("FindClassInfo")]
+        public async Task<BaseJosnRPCResponse> GetSchoolInfo(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            List<Classroom> sc = await cosmosrepository.FindByParams<Classroom>(request.@params);
+            //sc.First
+            return builder.Data(sc).build();
+        }
+        [HttpGet("TestFindClass")]
+        public async Task<BaseJosnRPCResponse> FindClass()
+        {
+            Dictionary<string, object> s = new Dictionary<string, object>() { { "SchoolCode", "11222" } };
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            List<Classroom> sc = await cosmosrepository.FindByParams<Classroom>(s);
+            return builder.Data(sc).build();
+        }
+    }
+}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 205 - 0
TEAMModelOS.API/Controllers/Core/FileController.cs


+ 34 - 0
TEAMModelOS.API/Models/Core/Classroom.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.Json.Serialization;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.API.Models.Core
+{
+   public class Classroom
+    {
+        public Classroom()
+        {
+            point = new Point();
+        }
+        [JsonPropertyName("id")]
+        public string Id { get; set; }
+        [PartitionKey]
+        public string SchoolCode { get; set; }
+        public string ClassroomCode { get; set; }
+        public Point point { get; set; }
+        public string Name { get; set; }
+        public string HeadMaster { get; set; }
+        public string Period { get; set; }
+        public string Grade { get; set; }
+        public string HiTeach { get; set; }
+        public int StuNum { get; set; }
+        public string ClassroomType { get; set; }
+    }
+}
+public class Point
+{
+    public float X { get; set; }
+    public float Y { get; set; }
+}

+ 15 - 0
TEAMModelOS.API/TEAMModelOS.API.csproj

@@ -0,0 +1,15 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>netcoreapp3.0</TargetFramework>
+  </PropertyGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\TEAMModelOS.SDK\TEAMModelOS.SDK.csproj" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Controllers\Syllabus\" />
+    <Folder Include="Controllers\Evaluation\" />
+    <Folder Include="Services\" />
+  </ItemGroup>
+
+</Project>

+ 22 - 0
TEAMModelOS.SDK/Context/Attributes/AllowCors/AllowCorsAttribute.cs

@@ -0,0 +1,22 @@
+using Microsoft.AspNetCore.Mvc.Filters;
+
+namespace TEAMModelOS.SDK.Context.Attributes.AllowCors
+{
+    /// <summary>
+    /// 跨域处理
+    /// </summary>
+    public class AllowCorsAttribute : ActionFilterAttribute
+    {
+        public override void OnActionExecuting(ActionExecutingContext filterContext)
+        {
+            var context = filterContext.HttpContext;
+            context.Response.Headers.Add("Access-Control-Allow-Origin", "*");
+            context.Response.Headers.Add("Access-Control-Allow-Methods", "GET,HEAD,OPTIONS,POST,PUT");
+            context.Response.Headers.Add("Access-Control-Allow-Headers", "Access-Control-Allow-Headers," +
+                                         "Origin,Accept,X-Requested-With,Content-Type," +
+                                         "Access-Control-Request-Method,Access-Control-Request-Headers," +
+                                         "Content-Type,Accept,access_token,token,Authorization");
+            base.OnActionExecuting(filterContext);
+        }
+    }
+}

+ 11 - 0
TEAMModelOS.SDK/Context/Attributes/Azure/PartitionKeyAttribute.cs

@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Context.Attributes.Azure
+{
+    [AttributeUsage(AttributeTargets.Property)]
+    public class PartitionKeyAttribute : Attribute
+    {
+    }
+}

+ 12 - 0
TEAMModelOS.SDK/Context/Attributes/Azure/TableSpaceAttribute.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Context.Attributes.Azure
+{
+    [AttributeUsage(AttributeTargets.Class)]
+    public class TableSpaceAttribute :Attribute
+    {
+        public string Name { get; set; }
+    }
+}

+ 31 - 0
TEAMModelOS.SDK/Context/Configuration/BaseConfigModel.cs

@@ -0,0 +1,31 @@
+using Microsoft.Extensions.Configuration;
+
+namespace TEAMModelOS.SDK.Context.Configuration
+{
+    public class BaseConfigModel
+    {
+        public static IConfiguration Configuration { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+
+        public static string ContentRootPath { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+
+        public static string WebRootPath { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="config"></param>
+        /// <param name="contentRootPath"></param>
+        /// <param name="webRootPath"></param>
+        public static void SetBaseConfig(IConfiguration config, string contentRootPath, string webRootPath)
+        {
+            Configuration = config;
+            ContentRootPath = contentRootPath;
+            WebRootPath = webRootPath;
+        }
+    }
+}

+ 10 - 0
TEAMModelOS.SDK/Context/Configuration/IBusinessService.cs

@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Context.Configuration
+{
+    public interface IBusinessService
+    {
+    }
+}

+ 31 - 0
TEAMModelOS.SDK/Context/Constant/Constants.cs

@@ -0,0 +1,31 @@
+
+namespace TEAMModelOS.SDK.Context.Constant.Common
+{
+    public static class Constants
+    {
+        /// <summary>
+        /// access_token
+        /// </summary>
+		public static readonly string ACCESS_TOKEN = "access_token";
+        /// <summary>
+        /// 引用页
+        /// </summary>
+		public static readonly string REFERER = "referer";
+        /// <summary>
+        /// token 请求头
+        /// </summary>
+		public static readonly string AUTHORIZATION = "Authorization";
+        /// <summary>
+        /// josn格式
+        /// </summary>
+		public static readonly string CONTENT_TYPE_JSON = "application/json";
+        /// <summary>
+        /// 苏格拉底作品类型--团队组
+        /// </summary>
+		//public static readonly string SIGNUPTYPEGRP = "2018TMCNTSGRP";
+        /// <summary>
+        /// 苏格拉底作品类型--个人组
+        /// </summary>
+		//public static readonly string SIGNUPTYPEINT = "2018TMCNTSIND";
+    }
+}

+ 393 - 0
TEAMModelOS.SDK/Context/Constant/ContentTypeDict.cs

@@ -0,0 +1,393 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Context.Constant
+{
+    public static class ContentTypeDict
+    {
+        public static readonly Dictionary<string, string> extdict = new Dictionary<string, string> {
+            {"video/3gpp",".3g2"},
+{"audio/mp4",".aac"},
+{"audio/ac3",".ac3"},
+{"text/x-adasrc",".adb"},
+{"image/x-applix-graphics",".ag"},
+{"audio/amr",".amr"},
+{"audio/x-ape",".ape"},
+{"image/x-sony-arw",".arw"},
+{"text/plain",".asc"},
+{"video/x-ms-asf",".asf"},
+{"text/x-ssa",".ass"},
+{"video/x-msvideo",".avi"},
+{"text/x-bibtex",".bib"},
+{"image/bmp",".bmp"},
+{"text/x-csrc",".c"},
+{"text/x-c++src",".c++"},
+{"image/cgm",".cgm"},
+{"text/x-tex",".cls"},
+{"text/x-cmake",".cmake"},
+{"image/x-canon-cr2",".cr2"},
+{"image/x-canon-crw",".crw"},
+{"text/x-csharp",".cs"},
+{"text/css",".css"},
+{"text/csv",".csv"},
+{"image/x-win-bitmap",".cur"},
+{"text/x-dsrc",".d"},
+{"text/x-dcl",".dcl"},
+{"image/x-kodak-dcr",".dcr"},
+{"image/x-dds",".dds"},
+{"text/x-patch",".diff"},
+{"image/vnd.djvu",".djv"},
+{"image/x-adobe-dng",".dng"},
+{"text/vnd.graphviz",".dot"},
+{"text/x-dsl",".dsl"},
+{"image/vnd.dwg",".dwg"},
+{"image/vnd.dxf",".dxf"},
+{"text/x-eiffel",".e"},
+{"text/x-emacs-lisp",".el"},
+{"image/x-emf",".emf"},
+{"image/x-eps",".eps"},
+{"image/x-bzeps",".eps.bz2"},
+{"image/x-gzeps",".eps.gz"},
+{"text/x-erlang",".erl"},
+{"text/x-setext",".etx"},
+{"image/x-exr",".exr"},
+{"text/x-fortran",".f"},
+{"image/x-xfig",".fig"},
+{"image/fits",".fits"},
+{"video/x-flv",".flv"},
+{"text/x-xslfo",".fo"},
+{"image/fax-g3",".g3"},
+{"text/directory",".gcrd"},
+{"image/gif",".gif"},
+{"text/x-google-video-pointer",".gvp"},
+{"text/x-chdr",".h"},
+{"text/x-c++hdr",".h++"},
+{"text/x-haskell",".hs"},
+{"text/html",".htm"},
+{"image/x-tga",".icb"},
+{"image/x-icns",".icns"},
+{"image/x-icon",".ico"},
+{"text/calendar",".ics"},
+{"text/x-idl",".idl"},
+{"image/ief",".ief"},
+{"image/x-iff",".iff"},
+{"image/x-ilbm",".ilbm"},
+{"text/x-imelody",".ime"},
+{"text/x-iptables",".iptables"},
+{"image/jp2",".j2k"},
+{"text/vnd.sun.j2me.app-descriptor",".jad"},
+{"text/x-java",".java"},
+{"image/x-jng",".jng"},
+{"image/jpeg",".jpeg"},
+{"application/javascript",".js"},
+{"application/json",".json"},
+{"application/jsonp",".jsonp"},
+{"image/x-kodak-k25",".k25"},
+{"image/x-kodak-kdc",".kdc"},
+{"text/x-ldif",".ldif"},
+{"text/x-literate-haskell",".lhs"},
+{"text/x-log",".log"},
+{"text/x-lua",".lua"},
+{"image/x-lwo",".lwo"},
+{"image/x-lws",".lws"},
+{"text/x-lilypond",".ly"},
+{"text/x-matlab",".m"},
+{"video/mpeg",".m2t"},
+{"audio/x-mpegurl",".m3u"},
+{"application/vnd.apple.mpegurl",".m3u8"},
+{"text/x-troff-me",".me"},
+{"video/x-matroska",".mkv"},
+{"text/x-ocaml",".ml"},
+{"text/x-troff-mm",".mm"},
+{"text/mathml",".mml"},
+{"text/x-moc",".moc"},
+{"text/x-mof",".mof"},
+{"audio/mpeg",".mp3"},
+{"video/mp4",".mp4"},
+{"text/x-mrml",".mrl"},
+{"image/x-minolta-mrw",".mrw"},
+{"text/x-troff-ms",".ms"},
+{"image/x-msod",".msod"},
+{"text/x-mup",".mup"},
+{"image/x-nikon-nef",".nef"},
+{"text/x-nfo",".nfo"},
+{"text/x-ocl",".ocl"},
+{"text/x-opml+xml",".opml"},
+{"image/openraster",".ora"},
+{"image/x-olympus-orf",".orf"},
+{"text/x-pascal",".p"},
+{"image/x-portable-bitmap",".pbm"},
+{"image/x-photo-cd",".pcd"},
+{"image/x-pcx",".pcx"},
+{"application/pdf",".pdf"},
+{"image/x-pentax-pef",".pef"},
+{"image/x-portable-graymap",".pgm"},
+{"image/x-pict",".pict"},
+{"image/png",".png"},
+{"image/x-portable-anymap",".pnm"},
+{"image/x-macpaint",".pntg"},
+{"text/x-gettext-translation",".po"},
+{"text/x-gettext-translation-template",".pot"},
+{"text/x-python",".py"},
+{"image/x-quicktime",".qif"},
+{"image/x-fuji-raf",".raf"},
+{"image/x-cmu-raster",".ras"},
+{"image/x-panasonic-raw",".raw"},
+{"text/x-ms-regedit",".reg"},
+{"image/x-rgb",".rgb"},
+{"image/rle",".rle"},
+{"text/troff",".roff"},
+{"image/vnd.rn-realpix",".rp"},
+{"text/vnd.rn-realtext",".rt"},
+{"text/richtext",".rtx"},
+{"text/x-scheme",".scm"},
+{"image/x-sgi",".sgi"},
+{"text/sgml",".sgm"},
+{"image/x-skencil",".sk"},
+{"text/spreadsheet",".slk"},
+{"text/x-rpm-spec",".spec"},
+{"text/x-sql",".sql"},
+{"image/x-sony-sr2",".sr2"},
+{"image/x-sony-srf",".srf"},
+{"text/x-subviewer",".sub"},
+{"image/x-sun-raster",".sun"},
+{"image/svg+xml",".svg"},
+{"image/svg+xml-compressed",".svgz"},
+{"text/x-txt2tags",".t2t"},
+{"text/x-tcl",".tcl"},
+{"text/x-texinfo",".texi"},
+{"image/tiff",".tif"},
+{"audio/x-voc",".voc"},
+{"image/x-wmf",".wmf"},
+{"text/vnd.wap.wml",".wml"},
+{"text/vnd.wap.wmlscript",".wmls"},
+{"video/x-ms-wmv",".wmv"},
+{"application/xhtml+xml",".xhtml"},
+{"application/xml",".xml"}
+        };
+
+        public static readonly  Dictionary<string, string> dict = new Dictionary<string, string> {
+            {".3g2", "video/3gpp"},
+            {".3ga", "video/3gpp"},
+            {".3gp", "video/3gpp"},
+            {".aac", "audio/mp4"},
+            {".ac3", "audio/ac3"},
+            {".adb", "text/x-adasrc"},
+            {".ads", "text/x-adasrc"},
+            {".ag", "image/x-applix-graphics"},
+            {".amr", "audio/amr"},
+            {".ape", "audio/x-ape"},
+            {".arw", "image/x-sony-arw"},
+            {".asc", "text/plain"},
+            {".asf", "video/x-ms-asf"},
+            {".ass", "text/x-ssa"},
+            {".avi", "video/x-msvideo"},
+            {".bib", "text/x-bibtex"},
+            {".bmp", "image/bmp"},
+            {".c", "text/x-csrc"},
+            {".c++", "text/x-c++src"},
+            {".cc", "text/x-c++src"},
+            {".cgm", "image/cgm"},
+            {".cls", "text/x-tex"},
+            {".cmake", "text/x-cmake"},
+            {".cpp", "text/x-c++src"},
+            {".cr2", "image/x-canon-cr2"},
+            {".crw", "image/x-canon-crw"},
+            {".cs", "text/x-csharp"},
+            {".css", "text/css"},
+            {".cssl", "text/css"},
+            {".csv", "text/csv"},
+            {".cur", "image/x-win-bitmap"},
+            {".cxx", "text/x-c++src"},
+            {".d", "text/x-dsrc"},
+            {".dcl", "text/x-dcl"},
+            {".dcr", "image/x-kodak-dcr"},
+            {".dds", "image/x-dds"},
+            {".diff", "text/x-patch"},
+            {".djv", "image/vnd.djvu"},
+            {".djvu", "image/vnd.djvu"},
+            {".dng", "image/x-adobe-dng"},
+            {".dot", "text/vnd.graphviz"},
+            {".dsl", "text/x-dsl"},
+            {".dtx", "text/x-tex"},
+            {".dwg", "image/vnd.dwg"},
+            {".dxf", "image/vnd.dxf"},
+            {".e", "text/x-eiffel"},
+            {".eif", "text/x-eiffel"},
+            {".el", "text/x-emacs-lisp"},
+            {".emf", "image/x-emf"},
+            {".eps", "image/x-eps"},
+            {".eps.bz2", "image/x-bzeps"},
+            {".eps.gz", "image/x-gzeps"},
+            {".epsf", "image/x-eps"},
+            {".epsf.bz2", "image/x-bzeps"},
+            {".epsf.gz", "image/x-gzeps"},
+            {".epsi", "image/x-eps"},
+            {".epsi.bz2", "image/x-bzeps"},
+            {".epsi.gz", "image/x-gzeps"},
+            {".erl", "text/x-erlang"},
+            {".etx", "text/x-setext"},
+            {".exr", "image/x-exr"},
+            {".f", "text/x-fortran"},
+            {".f90", "text/x-fortran"},
+            {".f95", "text/x-fortran"},
+            {".fig", "image/x-xfig"},
+            {".fits", "image/fits"},
+            {".flv", "video/x-flv"},
+            {".fo", "text/x-xslfo"},
+            {".for", "text/x-fortran"},
+            {".g3", "image/fax-g3"},
+            {".gcrd", "text/directory"},
+            {".gif", "image/gif"},
+            {".gv", "text/vnd.graphviz"},
+            {".gvp", "text/x-google-video-pointer"},
+            {".h", "text/x-chdr"},
+            {".h++", "text/x-c++hdr"},
+            {".hh", "text/x-c++hdr"},
+            {".hp", "text/x-c++hdr"},
+            {".hpp", "text/x-c++hdr"},
+            {".hs", "text/x-haskell"},
+            {".htm", "text/html"},
+            {".html", "text/html"},
+            {".hxx", "text/x-c++hdr"},
+            {".icb", "image/x-tga"},
+            {".icns", "image/x-icns"},
+            {".ico", "image/x-icon"},
+            {".ics", "text/calendar"},
+            {".idl", "text/x-idl"},
+            {".ief", "image/ief"},
+            {".iff", "image/x-iff"},
+            {".ilbm", "image/x-ilbm"},
+            {".ime", "text/x-imelody"},
+            {".imy", "text/x-imelody"},
+            {".ins", "text/x-tex"},
+            {".iptables", "text/x-iptables"},
+            {".j2k", "image/jp2"},
+            {".jad", "text/vnd.sun.j2me.app-descriptor"},
+            {".java", "text/x-java"},
+            {".jng", "image/x-jng"},
+            {".jp2", "image/jp2"},
+            {".jpc", "image/jp2"},
+            {".jpe", "image/jpeg"},
+            {".jpeg", "image/jpeg"},
+            {".jpf", "image/jp2"},
+            {".jpg", "image/jpeg"},
+            {".jpx", "image/jp2"},
+            {".js", "application/javascript"},
+            {".json", "application/json"},
+            {".jsonp", "application/jsonp"},
+            {".k25", "image/x-kodak-k25"},
+            {".kdc", "image/x-kodak-kdc"},
+            {".latex", "text/x-tex"},
+            {".ldif", "text/x-ldif"},
+            {".lhs", "text/x-literate-haskell"},
+            {".log", "text/x-log"},
+            {".ltx", "text/x-tex"},
+            {".lua", "text/x-lua"},
+            {".lwo", "image/x-lwo"},
+            {".lwob", "image/x-lwo"},
+            {".lws", "image/x-lws"},
+            {".ly", "text/x-lilypond"},
+            {".m", "text/x-matlab"},
+            {".m2t", "video/mpeg"},
+            {".m3u", "audio/x-mpegurl"},
+            {".m3u8", "application/vnd.apple.mpegurl"},
+            {".me", "text/x-troff-me"},
+            {".mkv", "video/x-matroska"},
+            {".ml", "text/x-ocaml"},
+            {".mli", "text/x-ocaml"},
+            {".mm", "text/x-troff-mm"},
+            {".mml", "text/mathml"},
+            {".moc", "text/x-moc"},
+            {".mof", "text/x-mof"},
+            {".mp2", "video/mpeg"},
+            {".mp3", "audio/mpeg"},
+            {".mp4", "video/mp4"},
+            {".mpe", "video/mpeg"},
+            {".mpeg", "video/mpeg"},
+            {".mpg", "video/mpeg"},
+            {".mrl", "text/x-mrml"},
+            {".mrml", "text/x-mrml"},
+            {".mrw", "image/x-minolta-mrw"},
+            {".ms", "text/x-troff-ms"},
+            {".msod", "image/x-msod"},
+            {".mup", "text/x-mup"},
+            {".nef", "image/x-nikon-nef"},
+            {".nfo", "text/x-nfo"},
+            {".not", "text/x-mup"},
+            {".ocl", "text/x-ocl"},
+            {".opml", "text/x-opml+xml"},
+            {".ora", "image/openraster"},
+            {".orf", "image/x-olympus-orf"},
+            {".p", "text/x-pascal"},
+            {".pas", "text/x-pascal"},
+            {".patch", "text/x-patch"},
+            {".pbm", "image/x-portable-bitmap"},
+            {".pcd", "image/x-photo-cd"},
+            {".pcx", "image/x-pcx"},
+            {".pdf", "application/pdf"},
+            {".pef", "image/x-pentax-pef"},
+            {".pgm", "image/x-portable-graymap"},
+            {".pict", "image/x-pict"},
+            {".pict1", "image/x-pict"},
+            {".pict2", "image/x-pict"},
+            {".png", "image/png"},
+            {".pnm", "image/x-portable-anymap"},
+            {".pntg", "image/x-macpaint"},
+            {".po", "text/x-gettext-translation"},
+            {".pot", "text/x-gettext-translation-template"},
+            {".py", "text/x-python"},
+            {".qif", "image/x-quicktime"},
+            {".qtif", "image/x-quicktime"},
+            {".raf", "image/x-fuji-raf"},
+            {".ras", "image/x-cmu-raster"},
+            {".raw", "image/x-panasonic-raw"},
+            {".reg", "text/x-ms-regedit"},
+            {".rgb", "image/x-rgb"},
+            {".rle", "image/rle"},
+            {".roff", "text/troff"},
+            {".rp", "image/vnd.rn-realpix"},
+            {".rt", "text/vnd.rn-realtext"},
+            {".rtx", "text/richtext"},
+            {".scm", "text/x-scheme"},
+            {".sgi", "image/x-sgi"},
+            {".sgm", "text/sgml"},
+            {".sgml", "text/sgml"},
+            {".sk", "image/x-skencil"},
+            {".sk1", "image/x-skencil"},
+            {".slk", "text/spreadsheet"},
+            {".spec", "text/x-rpm-spec"},
+            {".sql", "text/x-sql"},
+            {".sr2", "image/x-sony-sr2"},
+            {".srf", "image/x-sony-srf"},
+            {".ssa", "text/x-ssa"},
+            {".sty", "text/x-tex"},
+            {".sub", "text/x-subviewer"},
+            {".sun", "image/x-sun-raster"},
+            {".svg", "image/svg+xml"},
+            {".svgz", "image/svg+xml-compressed"},
+            {".sylk", "text/spreadsheet"},
+            {".t2t", "text/x-txt2tags"},
+            {".tcl", "text/x-tcl"},
+            {".tex", "text/x-tex"},
+            {".texi", "text/x-texinfo"},
+            {".texinfo", "text/x-texinfo"},
+            {".tga", "image/x-tga"},
+            {".tif", "image/tiff"},
+            {".tiff", "image/tiff"},
+            {".tk", "text/x-tcl"},
+            {".tpic", "image/x-tga"},
+            {".tr", "text/troff"},
+            {".txt", "text/plain"},
+            {".vob", "video/mpeg"},
+            {".voc", "audio/x-voc"},
+            {".wmf", "image/x-wmf"},
+            {".wml", "text/vnd.wap.wml"},
+            {".wmls", "text/vnd.wap.wmlscript"},
+            {".wmv", "video/x-ms-wmv"},
+            {".xhtml", "application/xhtml+xml"},
+            {".xml", "application/xml"}
+        };
+    }
+}

+ 24 - 0
TEAMModelOS.SDK/Context/Constant/FileType.cs

@@ -0,0 +1,24 @@
+namespace TEAMModelOS.SDK.Context.Constant.Common
+{
+	public class FileType
+	{
+		public string Id { get; set;}
+		public string Extention { get; set; }
+		public string Type { get; set; }
+
+		public FileType(string id, string extention, string type)
+		{
+			Id = id;
+			Extention = extention;
+			Type = type;
+		}
+		public static string GetExtention(string fileName) {
+			if (string.IsNullOrEmpty(fileName)) {
+				return "";
+			} else {
+				return fileName.Substring(fileName.LastIndexOf(".") + 1);
+			}
+			
+		}
+	}
+}

+ 44 - 0
TEAMModelOS.SDK/Context/Constant/FileTypeMap.cs

@@ -0,0 +1,44 @@
+using System.Collections.Generic;
+
+
+namespace TEAMModelOS.SDK.Context.Constant.Common
+{
+	public class FileTypeMap
+	{
+		private Dictionary<string, FileType> FileTpyeMap { get; set; }
+
+		public FileTypeMap FileTypes(FileType fileType) {
+			if (this.FileTpyeMap == null)
+			{
+				FileTpyeMap = new Dictionary<string, FileType>();
+				//fileTpyeMap.Add(fileType.Type, fileType);
+			}
+			if(!FileTpyeMap.ContainsKey(fileType.Extention)) {
+				FileTpyeMap.Add(fileType.Extention, fileType);
+			}
+			return this;
+		}
+		public Dictionary<string, FileType> GetFileTypes() {
+			FileTypes(new FileType("1", "jpg", "img")).
+			FileTypes(new FileType("2", "png", "img")).
+			FileTypes(new FileType("3", "bmp", "img")).
+			FileTypes(new FileType("4", "jpeg", "img")).
+			FileTypes(new FileType("5", "gif", "img")).
+			FileTypes(new FileType("6", "mp4", "video")).
+			FileTypes(new FileType("7", "avi", "video")).
+			FileTypes(new FileType("8", "mpeg", "video")).
+			FileTypes(new FileType("9", "mov", "video")).
+			FileTypes(new FileType("10", "wmv", "video")).
+			FileTypes(new FileType("11", "doc", "file")).
+			FileTypes(new FileType("12", "docx", "file")).
+			FileTypes(new FileType("13", "ppt", "file")).
+			FileTypes(new FileType("14", "pptx", "file")).
+			FileTypes(new FileType("15", "xls", "file")).
+			FileTypes(new FileType("16", "xlsx", "file")).
+			FileTypes(new FileType("17", "zip", "file")).
+			FileTypes(new FileType("18", "rar", "file")).
+			FileTypes(new FileType("19", "pdf", "file"));
+			return FileTpyeMap;
+		}
+	}
+}

+ 25 - 0
TEAMModelOS.SDK/Context/Constant/GetFileType.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Context.Constant.Common
+{
+	public class GetFileType
+	{
+		//private 
+
+		public GetFileType() { 
+		
+		}
+
+		public string GetExtension(string fileName) {
+			return fileName.Substring(fileName.LastIndexOf(".") + 1, (fileName.Length - fileName.LastIndexOf(".") - 1)); //扩展名
+		}
+
+		public string GetType(string fileName) {
+			string extension = GetExtension(fileName);
+
+			return null;
+		}
+	}
+}

+ 59 - 0
TEAMModelOS.SDK/Context/Constant/ResponseCode.cs

@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Context.Constant.Common
+{
+
+    /// <summary>
+    /// 响应编码
+    /// </summary>
+    public static class ResponseCode
+    {
+        /// <summary>
+        /// 代表HTTP正常请求
+        /// </summary>
+        public readonly static int HTTP_SUCCESS = 200;
+        /// <summary>
+        /// 一般常用代表成功
+        /// </summary>
+        public readonly static int SUCCESS = 0;
+        /// <summary>
+        /// 一般常用代表失败
+        /// </summary>
+        public readonly static int FAILED = 1;
+        /// <summary>
+        /// 数据为空或null
+        /// </summary>
+        public readonly static int DATA_EMPTY_NULL = 2;
+        /// <summary>
+        /// 参数异常
+        /// </summary>
+        public readonly static int PARAMS_ERROR = 3;
+        /// <summary>
+        /// 服务端异常
+        /// </summary>
+        public readonly static int SERVER_ERROR = 500;
+        /// <summary>
+        /// 未知异常
+        /// </summary>
+        public readonly static int UNDEFINED = 9;
+        /// <summary>
+        /// 资源未找到
+        /// </summary>
+        public readonly static int NOT_FOUND = 404;
+        /// <summary>
+        /// 未授权
+        /// </summary>
+        public readonly static int UNAUTH = 401;
+        /// <summary>
+        /// 网关路由异常
+        /// </summary>
+        public readonly static int GATEWAY_ERROR = 504;
+        /// <summary>
+        /// 响应超时
+        /// </summary>
+        public readonly static int TIMEOUT_ERROR = 503;
+        
+    }
+}

+ 54 - 0
TEAMModelOS.SDK/Context/Exception/BizException.cs

@@ -0,0 +1,54 @@
+using System;
+
+namespace TEAMModelOS.SDK.Context.Exception
+{
+    public class BizException : System.Exception
+    {
+        public string message { get; set; } = "error";
+        public int code { get; set; } = 1;
+        public string devMessage { get; set; }
+        public BizException(int code, String message, string stackTrace) : base(message)
+        {
+            if (string.IsNullOrEmpty(stackTrace))
+            {
+                this.devMessage = this.StackTrace;
+            }
+            else
+            {
+                this.devMessage = stackTrace;
+            }
+            this.message = message;
+            this.code = code;
+        }
+        public BizException(int code, String message) : base(message)
+        {
+            this.devMessage = this.StackTrace;
+            this.message = message;
+            this.code = code;
+        }
+        //
+        // 摘要:
+        //     Initializes a new instance of the System.Exception class.
+        public BizException() : base()
+        {
+            this.devMessage = this.StackTrace;
+            this.message = "error";
+            this.code = 1;
+        }
+
+        //
+        // 摘要:
+        //     Initializes a new instance of the System.Exception class with a specified error
+        //     message.
+        //
+        // 参数:
+        //   message:
+        //     The message that describes the error.
+        public BizException(string message) : base(message)
+        {
+            this.message = message;
+            this.devMessage = this.StackTrace;
+            this.code = 1;
+        }
+    }
+}

+ 86 - 0
TEAMModelOS.SDK/Context/Filters/HttpGlobalExceptionFilter.cs

@@ -0,0 +1,86 @@
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.Context.Exception;
+using TEAMModelOS.SDK.Helper.Common.JsonHelper;
+using static TEAMModelOS.SDK.Context.Filter.HttpGlobalExceptionInvoke;
+
+namespace TEAMModelOS.SDK.Context.Filters
+{
+    /// <summary>
+    /// 全局异常处理
+    /// </summary>
+    public class HttpGlobalExceptionFilter : IExceptionFilter
+    {
+        readonly ILoggerFactory _loggerFactory;
+        readonly IWebHostEnvironment _env;
+        public HttpGlobalExceptionFilter(ILoggerFactory loggerFactory, IWebHostEnvironment env)
+        {
+            _loggerFactory = loggerFactory;
+            _env = env;
+        }
+        /// <summary>
+        /// 异常拦截
+        /// </summary>
+        /// <param name="context"></param>
+        public async void OnException(ExceptionContext context)
+        {
+            int code = context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
+            if (context.Exception is BizException)
+            {
+                context.HttpContext.Response.StatusCode = 200;
+            }
+            var errorResponse = new ErrorResponse<string>(1, context.Exception.Message);
+            // errorResponse.devMessage = context.Exception.StackTrace;
+            context.Result = new ApplicationErrorResult(errorResponse, code);
+            context.ExceptionHandled = true;
+            if (context.HttpContext.Response.StatusCode != 200)//未捕捉过并且状态码不为200
+            {
+                string msg = "";
+                switch (context.HttpContext.Response.StatusCode)
+                {
+                    case 401:
+                        msg = "Unauthorized";
+                        break;
+                    case 404:
+                        msg = "Service Not Found";
+                        break;
+                    case 502:
+                        msg = "Request Erro";
+                        break;
+                    case 500:
+                        msg = context.Exception.Message;
+                        break;
+                    case 403:
+                        msg = context.Exception.Message;
+                        break;
+                    default:
+                        msg = "Unknown Error";
+                        break;
+                }
+                await HandleExceptionAsync(context.HttpContext, context.HttpContext.Response.StatusCode, msg, context.Exception == null ? "" : context.Exception.StackTrace);
+            }
+        }
+
+        private static async Task HandleExceptionAsync(HttpContext context, int statusCode, string msg, string devmsg)
+        {
+            var data = new ErrorResponse<string>(statusCode, msg, devmsg);
+            context.Response.ContentType = "application/json;charset=utf-8";
+            await context.Response.WriteAsync(JsonSerialization.ToJson(data));
+        }
+    }
+    public class ApplicationErrorResult : ObjectResult
+    {
+        public ApplicationErrorResult(object value, int code) : base(value)
+        {
+            StatusCode = code;
+        }
+    }
+}

+ 153 - 0
TEAMModelOS.SDK/Context/Filters/HttpGlobalExceptionInvoke.cs

@@ -0,0 +1,153 @@
+
+using Microsoft.AspNetCore.Http;
+using System;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.Context.Constant.Common;
+using TEAMModelOS.SDK.Context.Exception;
+using TEAMModelOS.SDK.Helper.Common.JsonHelper;
+
+namespace TEAMModelOS.SDK.Context.Filter
+{
+    public class HttpGlobalExceptionInvoke
+    {
+        private readonly RequestDelegate _next;
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="next"></param>
+        public HttpGlobalExceptionInvoke(RequestDelegate next)
+        {
+            _next = next;
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        public async Task Invoke(HttpContext context)
+        {
+
+            System.Exception exs = null;
+            bool isCatched = false;
+            try
+            {
+                await _next(context);
+            }
+            catch (System.Exception ex) //发生异常
+            {
+                exs = ex;
+                //自定义业务异常
+                if (ex is BizException)
+                {
+                    context.Response.StatusCode = ((BizException)ex).code;
+                }
+                //未知异常
+                else
+                {
+                    context.Response.StatusCode = 500;
+                    //LogHelper.SetLog(LogLevel.Error, ex);
+                }
+                await HandleExceptionAsync(context, context.Response.StatusCode, ex.Message, ex.StackTrace);
+                isCatched = true;
+            }
+            finally
+            {
+                if (!isCatched && context.Response.StatusCode != 200)//未捕捉过并且状态码不为200
+                {
+                    string msg = "";
+                    switch (context.Response.StatusCode)
+                    {
+                        case 401:
+                            msg = "Unauthorized";
+                            break;
+                        case 404:
+                            msg = "Service Not Found";
+                            break;
+                        case 502:
+                            msg = "Request Erro";
+                            break;
+                        case 500:
+                            msg = exs.Message;
+                            break;
+                        case 403:
+                            msg = exs.Message;
+                            break;
+                        default:
+                            msg = "Unknown Error";
+                            break;
+                    }
+                    await HandleExceptionAsync(context, context.Response.StatusCode, msg, exs == null ? "" : exs.StackTrace);
+                }
+            }
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="context"></param>
+        /// 
+        /// 
+        /// <param name="statusCode"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        private static async Task HandleExceptionAsync(HttpContext context, int statusCode, string msg, string devmsg)
+        {
+            var data = new ErrorResponse<string>(statusCode, msg, devmsg);
+            context.Response.ContentType = Constants.CONTENT_TYPE_JSON;
+            await context.Response.WriteAsync(JsonSerialization.ToJson(data));
+        }
+        /// <summary>
+        /// 异常信息封装
+        /// </summary>
+        /// 
+        
+        public class ErrorResponse<T>
+        {
+            public ErrorResponse()
+            {
+                error = new ErrorModel<T>();
+            }
+            public ErrorResponse(string message)
+            {
+                error = new ErrorModel<T>
+                {
+                    message = message,
+                    devmsg = message
+                };
+            }
+            public ErrorResponse(int code, string message)
+            {
+                error = new ErrorModel<T>
+                {
+                    message = message,
+                    devmsg = message,
+                    code = code
+                };
+
+            }
+            public ErrorResponse(int code, string message, string devMessage)
+            {
+                error = new ErrorModel<T>
+                {
+                    message = message,
+                    devmsg = message,
+                    code = code
+                };
+                error.devmsg = devMessage;
+            }
+
+            public string jsonrpc { get; set; } = "2.0";
+            public double id { get; set; } = 1;
+            private object result { get; set; } = null;
+            public ErrorModel<T> error { get; set; } = null;
+        }
+    }
+    
+    public class ErrorModel<E>
+    {
+        public long responseTime = DateTime.Now.Ticks;
+        public float code { get; set; } = 1;
+        public string message { get; set; }
+        public string devmsg { get; set; }
+        public E data { get; set; }
+    }
+}

+ 20 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcRequest/AzureTokenJsonRPCRequest.cs

@@ -0,0 +1,20 @@
+using TEAMModelOS.SDK.Extension.DataResult.RequestData;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    public class AzureTokenJsonRPCRequest<T> : BaseJosnRPCRequest
+    {
+
+        public AzureTokenJsonRPCRequest (){
+            @params = new AzureTokenRequest<T>();
+        }
+        public AzureTokenRequest<T> @params { get; set; }
+    }
+}

+ 16 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcRequest/BaseJosnRPCRequest.cs

@@ -0,0 +1,16 @@
+
+using System;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest
+{
+    
+    public abstract class BaseJosnRPCRequest
+    {
+        public long requestTime { get; set; } = DateTime.Now.ToUniversalTime().Ticks - 621355968000000000;
+        public string jsonrpc { get; set; } = "2.0";
+        public string method { get; set; }
+        public int id { get; set; } = 1;
+        public int timeOffset { get; set; }
+        public string lang { get; set; } = "zh-CN";
+    }
+}

+ 13 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcRequest/JosnRPCRequest.cs

@@ -0,0 +1,13 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest
+{
+    
+    public class JosnRPCRequest<T>:BaseJosnRPCRequest
+    {
+        public T @params { get; set; }
+    }
+}

+ 15 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcRequest/PaginationJosnRPCRequest.cs

@@ -0,0 +1,15 @@
+
+
+using TEAMModelOS.SDK.Extension.DataResult.RequestData;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest
+{
+    public  class PaginationJosnRPCRequest<T> : BaseJosnRPCRequest
+    {
+        public PaginationJosnRPCRequest()
+        {
+            @params = new PaginationRequest<T>();
+        }
+        public PaginationRequest<T> @params { get; set; }
+    }
+}

+ 14 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/BaseJosnRPCResponse.cs

@@ -0,0 +1,14 @@
+
+using Microsoft.VisualBasic;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse
+{
+    
+    public class BaseJosnRPCResponse 
+    {
+        public string jsonrpc { get; set; } = "2.0";
+        public double id { get; set; } = 1;
+        private object result { get; set; }
+        public object error { get; set; } = null;
+    }
+}

+ 16 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/DataJosnRPCResponse.cs

@@ -0,0 +1,16 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse
+{
+    
+    public class DataJosnRPCResponse<T> : BaseJosnRPCResponse
+    {
+		public DataJosnRPCResponse() { 
+		  result=  new JsonRPCResult<T>();
+		}
+		public   JsonRPCResult<T> result { get; set; } 
+    }
+}

+ 16 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/ErrorJosnRPCResponse.cs

@@ -0,0 +1,16 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse
+{
+    
+    public class ErrorJosnRPCResponse<E> : BaseJosnRPCResponse
+    {
+        public ErrorJosnRPCResponse() {
+            error = new ErrorModel<E>();
+        }
+        public new ErrorModel<E> error { get; set; }
+    }
+}

+ 13 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/ErrorModel.cs

@@ -0,0 +1,13 @@
+
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse
+{
+    
+    public class ErrorModel<E>
+    {
+        public int code { get; set; }
+        public string message { get; set; }
+        public string devmsg { get; set; }
+        public E data { get; set; }
+    }
+}

+ 13 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/JosnRPCResponse.cs

@@ -0,0 +1,13 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse
+{
+    
+    public class JosnRPCResponse<T>:BaseJosnRPCResponse
+    {
+        public  T result { get; set; }
+    }
+}

+ 169 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/JsonRPCResponseBuilder.cs

@@ -0,0 +1,169 @@
+using TEAMModelOS.SDK.Extension.DataResult.PageToken;
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse
+{
+    
+    public  class JsonRPCResponseBuilder
+    {
+        private string message="Success";
+        private string devmsg = "Error";
+        private int code = 0;
+        private object data;
+        private long total;
+        private int currPage;
+        private int pageSize;
+        private int totalPage;
+        private Dictionary<string, object> extend;
+        private Pagination page;
+        private AzureTableToken token;
+        private object error=null;
+        
+        public JsonRPCResponseBuilder()
+        {
+        }
+        public JsonRPCResponseBuilder Success()
+        {
+            error = null;
+            return this;
+        }
+
+        public JsonRPCResponseBuilder Success(String message)
+        {
+            this.message = message;
+            return this;
+        }
+        public static JsonRPCResponseBuilder custom()
+        {
+            return new JsonRPCResponseBuilder();
+        }
+
+        public JsonRPCResponseBuilder Data(object data)
+        {
+            this.data = data;
+            return this;
+        }
+		public JsonRPCResponseBuilder Error(object error, string message)
+		{
+			this.code = 1;
+			this.message = message;
+			this.error = error;
+			return this;
+		}
+		public JsonRPCResponseBuilder Error(object error, int code,string message)
+		{
+			this.code = code;
+			this.message = message;
+			this.error = error;
+			return this;
+		}
+		public JsonRPCResponseBuilder Error(object error,int code)
+		{
+			this.code = code;
+			this.message = "Error";
+			this.error = error;
+			return this;
+		}
+		public JsonRPCResponseBuilder Error(object error)
+        {
+			this.code = 1;
+			this.message = "Error";
+            this.error = error;
+            return this;
+        }
+        public JsonRPCResponseBuilder Extend(Dictionary<String, object> extend)
+        {
+            this.extend = extend;
+            return this;
+        }
+        public JsonRPCResponseBuilder Token(AzureTableToken token)
+        {
+            this.token = token;
+            return this;
+        }
+        public JsonRPCResponseBuilder Page(Pagination page)
+        {
+            this.pageSize = page.pageSize;
+            this.currPage = page.currPage;
+            this.total = page.total;
+            this.page = page;
+            this.totalPage = (int)Math.Ceiling((double)this.total / (double)this.pageSize);
+            return this;
+        }
+        public JsonRPCResponseBuilder totalCount(int totalCount)
+        {
+            this.total = totalCount;
+            return this;
+        }
+
+        public JsonRPCResponseBuilder CurrPage(int currPage)
+        {
+            this.currPage = currPage;
+            return this;
+        }
+
+        public JsonRPCResponseBuilder PageSize(int pageSize)
+        {
+            this.pageSize = pageSize;
+            return this;
+        }
+
+        public JsonRPCResponseBuilder TotalPage(int totalPage)
+        {
+            this.totalPage = totalPage;
+            return this;
+        }
+        public BaseJosnRPCResponse build()
+        {
+            object baseResponse= null;
+
+            if (error != null) {
+                ErrorJosnRPCResponse<object> errorJosnRPCResponse = new ErrorJosnRPCResponse<object>();
+                errorJosnRPCResponse.error.code = code;
+                errorJosnRPCResponse.error.message = message;
+                errorJosnRPCResponse.error.data = error;
+                errorJosnRPCResponse.error.devmsg = devmsg;
+                baseResponse = errorJosnRPCResponse;
+                return (BaseJosnRPCResponse)baseResponse;
+            }
+            if (this.total > 0 && this.pageSize > 0)
+            {
+                this.totalPage = (int)Math.Ceiling((double)this.total / (double)this.pageSize);
+            }
+            if (null != this.data && this.token != null)
+            {
+                TokenJosnRPCResponse<object> tokenJosnRPCResponse = new TokenJosnRPCResponse<object>();
+                tokenJosnRPCResponse.result.data = this.data;
+                tokenJosnRPCResponse.result.extend = this.extend;
+                tokenJosnRPCResponse.result.azureToken = this.token;
+                tokenJosnRPCResponse.result.message = message;
+                baseResponse = tokenJosnRPCResponse;
+            }
+            else if (null != this.data && this.total > 0 && this.currPage > 0 && this.pageSize > 0 && this.totalPage > 0)
+            {
+                PageJosnRPCResponse<object> pageDatasResponse = new PageJosnRPCResponse<object>();
+                pageDatasResponse.result.data = this.data;
+                pageDatasResponse.result.page = new Pagination(this.total, this.currPage, this.pageSize, this.totalPage);
+                pageDatasResponse.result.extend = this.extend;
+                pageDatasResponse.result.message = message;
+                baseResponse = pageDatasResponse;
+            }
+            else if (this.data != null)
+            {
+                DataJosnRPCResponse<object> datasResponse = new DataJosnRPCResponse<object>();
+                datasResponse.result.data = this.data;
+                datasResponse.result.extend = this.extend;
+                datasResponse.result.message = message;
+                baseResponse = datasResponse;
+            }
+            else
+            {
+                baseResponse = new BaseJosnRPCResponse();
+            }
+            return (BaseJosnRPCResponse)baseResponse;
+        }
+    }
+}

+ 16 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/JsonRPCResult.cs

@@ -0,0 +1,16 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse
+{
+    
+    public class JsonRPCResult<T>
+    {
+        public Dictionary<string, object> extend { get; set; } = null;
+        public long responseTime { get; set; } = DateTime.Now.ToUniversalTime().Ticks - 621355968000000000;
+        public T data { get; set; }
+        public string message { get; set; } = "";
+    }
+}

+ 17 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/PageJosnRPCResponse.cs

@@ -0,0 +1,17 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse
+{
+    
+    public class PageJosnRPCResponse<T> : BaseJosnRPCResponse
+    {
+		public PageJosnRPCResponse()
+		{
+			result = new PageJsonRPCResult<T>();
+		}
+		public   PageJsonRPCResult<T> result { get; set; }
+    }
+}

+ 15 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/PageJsonRPCResult.cs

@@ -0,0 +1,15 @@
+using TEAMModelOS.SDK.Extension.DataResult.PageToken;
+
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse
+{
+    
+    public class PageJsonRPCResult<T> : JsonRPCResult<T>
+    {
+        public Pagination page { get; set; }
+
+        public PageJsonRPCResult()
+        {
+        }
+    }
+}

+ 17 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/TokenJosnRPCResponse.cs

@@ -0,0 +1,17 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse
+{
+    
+    public class TokenJosnRPCResponse<T>: BaseJosnRPCResponse
+    {
+		public TokenJosnRPCResponse()
+		{
+			result = new TokenJsonRPCResult<T>();
+		}
+		public  TokenJsonRPCResult<T> result { get; set; }
+    }
+}

+ 16 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcResponse/TokenJsonRPCResult.cs

@@ -0,0 +1,16 @@
+using TEAMModelOS.SDK.Extension.DataResult.PageToken;
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse
+{
+    
+    public class TokenJsonRPCResult<T> : JsonRPCResult<T>
+    {
+       
+        public AzureTableToken azureToken { get; set; }
+        public TokenJsonRPCResult() { }
+    }
+}

+ 13 - 0
TEAMModelOS.SDK/Extension/DataResult/PageToken/AzurePagination.cs

@@ -0,0 +1,13 @@
+
+using System.Collections.Generic;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.PageToken
+{
+    
+    public class AzurePagination<T>
+    {
+        public AzurePagination(){}
+        public List<T> data { get; set; }
+        public AzureTableToken token { get; set; }
+    }
+}

+ 17 - 0
TEAMModelOS.SDK/Extension/DataResult/PageToken/AzureTableToken.cs

@@ -0,0 +1,17 @@
+
+using System.ComponentModel.DataAnnotations;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.PageToken
+{
+    
+    public class AzureTableToken
+    {
+        //[Required]
+        public string NextPartitionKey { get; set; }
+        //[Required]
+        public string NextRowKey { get; set; }
+        public string NextTableName { get; set; }
+        //[Required]
+        public int? TargetLocation { get; set; }
+    }
+}

+ 31 - 0
TEAMModelOS.SDK/Extension/DataResult/PageToken/Pagination.cs

@@ -0,0 +1,31 @@
+
+using System;
+using System.Collections.Generic;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.PageToken
+{
+    
+    public class Pagination
+    {
+        public long total { get; set; }
+        public int currPage { get; set; }
+        public int pageSize { get; set; } 
+        public int totalPage { get; set; }
+      
+        public Pagination() { }
+        public Pagination(long total, int currPage, int pageSize)
+        {
+            this.total = total;
+            this.currPage = currPage;
+            this.pageSize = pageSize;
+            this.totalPage = (int)Math.Ceiling((double)this.total / (double)this.pageSize);
+        }
+        public Pagination(long total, int currPage, int pageSize, int totalPage)
+        {
+            this.total = total;
+            this.currPage = currPage;
+            this.pageSize = pageSize;
+            this.totalPage = totalPage;
+        }
+    }
+}

+ 12 - 0
TEAMModelOS.SDK/Extension/DataResult/PageToken/PaginationData.cs

@@ -0,0 +1,12 @@
+using System.Collections.Generic;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.PageToken
+{
+    public class PaginationData<T>:Pagination
+    {
+        public PaginationData(int currPage, int pageSize, int total) : base(currPage, pageSize, total)
+        {
+        }
+        public List<T> data { get; set; }
+    }
+}

+ 13 - 0
TEAMModelOS.SDK/Extension/DataResult/RequestData/AzureTokenRequest.cs

@@ -0,0 +1,13 @@
+using TEAMModelOS.SDK.Extension.DataResult.PageToken;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.RequestData
+{
+   public class AzureTokenRequest<T> :BaseRequest
+   {
+        public T data { get; set; }
+        public AzureTableToken azureToken { get; set; }
+   }
+}

+ 12 - 0
TEAMModelOS.SDK/Extension/DataResult/RequestData/BaseRequest.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.RequestData
+{
+    public class BaseRequest
+    {
+        public long requestTime { get; set; } = DateTime.Now.ToUniversalTime().Ticks - 621355968000000000;
+        public string method { get; set; }
+        public string repeatToken { get; set; }
+    }
+}

+ 10 - 0
TEAMModelOS.SDK/Extension/DataResult/RequestData/PaginationRequest.cs

@@ -0,0 +1,10 @@
+using TEAMModelOS.SDK.Extension.DataResult.PageToken;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.RequestData
+{
+    public class PaginationRequest<T> : BaseRequest
+    {
+        public T data { get; set; }
+        public Pagination  page{ get; set; }
+    }
+}

+ 16 - 0
TEAMModelOS.SDK/Extension/DataResult/ResponseData/BaseResponse.cs

@@ -0,0 +1,16 @@
+
+using System.Collections.Generic;
+
+namespace TEAMModelOS.SDK.Extension.DataResult.ResponseData
+{
+    
+    public class BaseResponse : TimeStampResponse
+    {
+        public Dictionary<string, object> extend { get; set; }
+        public string message { get; set; } = "success";
+        public int code { get; set; }
+        public BaseResponse()
+        {
+        }
+    }
+}

+ 14 - 0
TEAMModelOS.SDK/Extension/DataResult/ResponseData/DataResponse.cs

@@ -0,0 +1,14 @@
+
+
+namespace TEAMModelOS.SDK.Extension.DataResult.ResponseData
+{
+    
+    public class DataResponse<T> : BaseResponse
+    {
+        public T data { get; set; }
+
+        public DataResponse()
+        {
+        }
+    }
+}

+ 15 - 0
TEAMModelOS.SDK/Extension/DataResult/ResponseData/PageDatasResponse.cs

@@ -0,0 +1,15 @@
+using TEAMModelOS.SDK.Extension.DataResult.PageToken;
+
+
+namespace TEAMModelOS.SDK.Extension.DataResult.ResponseData
+{
+    
+    public class PageDatasResponse<T> : DataResponse<T>
+    {
+        public Pagination page { get; set; }
+
+        public PageDatasResponse()
+        {
+        }
+    }
+}

+ 162 - 0
TEAMModelOS.SDK/Extension/DataResult/ResponseData/ResponseBuilder.cs

@@ -0,0 +1,162 @@
+using TEAMModelOS.SDK.Extension.DataResult.PageToken;
+
+using System;
+using System.Collections.Generic;
+
+
+namespace TEAMModelOS.SDK.Extension.DataResult.ResponseData
+{
+    
+    public class ResponseBuilder
+    {
+        private string message = "success";
+        private object data;
+        private int code = 0;
+       // private IList<object> datas;
+        private long total;
+        private int currPage;
+        private int pageSize;
+        private int totalPage;
+        private Dictionary<string, object> extend;
+        private Pagination page;
+        private AzureTableToken  token;
+        public ResponseBuilder()
+        {
+        }
+
+        public static ResponseBuilder custom()
+        {
+            return new ResponseBuilder();
+        }
+
+        public BaseResponse build()
+        {
+            if (this.total > 0 && this.pageSize > 0 )
+            {
+                this.totalPage = (int)Math.Ceiling((double)this.total / (double)this.pageSize);
+            }
+            object baseResponse;
+           
+             if (null != this.data && this.token!=null)
+            {
+                TokenPageDatasResponse<object> pageDatasResponse = new TokenPageDatasResponse<object>();
+                pageDatasResponse.code= this.code;
+                pageDatasResponse.data= this.data;
+                pageDatasResponse.message= this.message;
+                pageDatasResponse.extend=this.extend;
+                pageDatasResponse.azureToken = this.token;
+                baseResponse = pageDatasResponse;
+            }
+            else if (null != this.data && this.total > 0 && this.currPage > 0 && this.pageSize > 0 && this.totalPage > 0)
+            {
+                PageDatasResponse<object> pageDatasResponse = new PageDatasResponse<object>();
+                pageDatasResponse.code = this.code;
+                pageDatasResponse.data = this.data;
+                pageDatasResponse.message = this.message;
+                pageDatasResponse.page = new Pagination(this.total, this.currPage, this.pageSize, this.totalPage);
+                pageDatasResponse.extend = this.extend;
+                baseResponse = pageDatasResponse;
+            }
+            else if (this.data != null)
+            {
+                DataResponse<object> datasResponse = new DataResponse<object>();
+                datasResponse.code=this.code;
+                datasResponse.data=this.data;
+                datasResponse.message=this.message;
+                datasResponse.extend=this.extend;
+                baseResponse = datasResponse;
+            }
+            else
+            {
+                baseResponse = new BaseResponse();
+                ((BaseResponse)baseResponse).message=this.message;
+                ((BaseResponse)baseResponse).code=this.code;
+                ((BaseResponse)baseResponse).extend=this.extend;
+            }
+            return (BaseResponse)baseResponse;
+        }
+
+        
+
+        public ResponseBuilder Extend(Dictionary<String, object> extend)
+        {
+            this.extend = extend;
+            return this;
+        }
+        public ResponseBuilder Token(AzureTableToken token)
+        {
+            this.token = token;
+            return this;
+        }
+        public ResponseBuilder Data(object data)
+        {
+            this.data = data;
+            return this;
+        }
+       
+        public ResponseBuilder Page(Pagination page)
+        {
+            this.pageSize = page.pageSize;
+            this.currPage = page.currPage;
+            this.total = page.total;
+            this.page = page;
+            this.totalPage = (int)Math.Ceiling((double)this.total / (double)this.pageSize);
+            return this;
+        }
+        public ResponseBuilder totalCount(int totalCount)
+        {
+            this.total = totalCount;
+            return this;
+        }
+
+        public ResponseBuilder CurrPage(int currPage)
+        {
+            this.currPage = currPage;
+            return this;
+        }
+
+        public ResponseBuilder PageSize(int pageSize)
+        {
+            this.pageSize = pageSize;
+            return this;
+        }
+
+        public ResponseBuilder TotalPage(int totalPage)
+        {
+            this.totalPage = totalPage;
+            return this;
+        }
+
+        public ResponseBuilder success()
+        {
+            return this;
+        }
+
+        public ResponseBuilder success(String message)
+        {
+            this.message = message;
+            return this;
+        }
+
+        public ResponseBuilder success(String message, int code)
+        {
+            this.message = message;
+            this.code = code;
+            return this;
+        }
+
+        public ResponseBuilder failed(String message, int code)
+        {
+            this.code = code;
+            this.message = message;
+            return this;
+        }
+
+        public ResponseBuilder failed(String message)
+        {
+            this.code = 1;
+            this.message = message;
+            return this;
+        }
+    }
+}

+ 16 - 0
TEAMModelOS.SDK/Extension/DataResult/ResponseData/TimeStampResponse.cs

@@ -0,0 +1,16 @@
+
+using System;
+
+
+namespace TEAMModelOS.SDK.Extension.DataResult.ResponseData
+{
+    
+    public class TimeStampResponse
+    {
+        public long responseTime { get; set; } = DateTime.Now.ToUniversalTime().Ticks - 621355968000000000;
+        public TimeStampResponse()
+        {
+
+        }
+    }
+}

+ 14 - 0
TEAMModelOS.SDK/Extension/DataResult/ResponseData/TokenPageDatasResponse.cs

@@ -0,0 +1,14 @@
+using TEAMModelOS.SDK.Extension.DataResult.PageToken;
+
+
+
+namespace TEAMModelOS.SDK.Extension.DataResult.ResponseData
+{
+    
+    public class TokenPageDatasResponse<T> : DataResponse<T>
+    {
+        public AzureTableToken azureToken { get; set; }
+
+        public TokenPageDatasResponse() { }
+    }
+}

+ 17 - 0
TEAMModelOS.SDK/Extension/HttpClient/HttpClientExtension.cs

@@ -0,0 +1,17 @@
+using Microsoft.Extensions.DependencyInjection;
+using TEAMModelOS.SDK.Extension.HttpClient.Implements;
+
+namespace TEAMModelOS.SDK.Extension.HttpClient
+{
+   public static class HttpClientExtension
+    {
+        public static void AddHttp(this IServiceCollection services)
+        {
+            //services.AddHttpClient();
+            //services.AddSingleton<HttpClientService>();
+            services.AddHttpClient<HttpClientSendCloud>();
+            services.AddHttpClient<HttpClientUserInfo>();
+            services.AddHttpClient<HttpClientSchool>();
+        }
+    }
+}

+ 177 - 0
TEAMModelOS.SDK/Extension/HttpClient/Implements/HttpClientSchool.cs

@@ -0,0 +1,177 @@
+using System;
+using System.Collections.Generic;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.Context.Configuration;
+using TEAMModelOS.SDK.Context.Constant.Common;
+using HttpClientSpace = System.Net.Http;
+
+namespace TEAMModelOS.SDK.Extension.HttpClient.Implements
+{
+    /// <summary>
+    /// 需要调整的  https://blog.yowko.com/httpclientfactory-dotnet-core-dotnet-framework/
+    /// </summary>
+    public class HttpClientSchool
+    {
+        HttpClientSpace.HttpClient client { get; }
+        public HttpClientSchool(HttpClientSpace.HttpClient _client)
+        {
+            // _client.BaseAddress =new Uri(BaseConfigModel.Configuration["HaBookAuth:AccountUrl"]);
+            _client.Timeout = new TimeSpan(0, 0, 1000);
+            _client.DefaultRequestHeaders.Add(Constants.AUTHORIZATION, BaseConfigModel.Configuration["HaBookAuth:SchoolCodeKey"]);
+            client = _client;
+        }
+
+        /// <summary>
+        /// 同步GET请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="headers"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <returns></returns>
+        public string HttpGet(string url)
+        {
+
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            //if (timeout > 0)
+            //{
+            //    client.Timeout = new TimeSpan(0, 0, timeout);
+            //}
+            byte[] resultBytes = client.GetByteArrayAsync(url).Result;
+            return Encoding.UTF8.GetString(resultBytes);
+        }
+
+        /// <summary>
+        /// 异步GET请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="headers"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <returns></returns>
+        public async Task<string> HttpGetAsync(string url)
+        {
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            //if (timeout > 0)
+            //{
+            //    client.Timeout = new TimeSpan(0, 0, timeout);
+            //}
+            byte[] resultBytes = await client.GetByteArrayAsync(url);
+            return Encoding.Default.GetString(resultBytes);
+        }
+
+
+        /// <summary>
+        /// 同步POST请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="postData"></param>
+        /// <param name="headers"></param>
+        /// <param name="contentType"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <param name="encoding">默认UTF8</param>
+        /// <returns></returns>
+        public string HttpPost(string url, string postData,  string contentType = null, Encoding encoding = null)
+        {
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            //if (timeout > 0)
+            //{
+            //    client.Timeout = new TimeSpan(0, 0, timeout);
+            //}
+            HttpContent content = new StringContent(postData ?? "", encoding ?? Encoding.UTF8);
+
+            if (contentType != null)
+            {
+                content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
+            }
+            HttpResponseMessage responseMessage = client.PostAsync(url, content).Result;
+            byte[] resultBytes = responseMessage.Content.ReadAsByteArrayAsync().Result;
+            return Encoding.UTF8.GetString(resultBytes);
+        }
+
+        /// <summary>
+        /// 异步POST请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="postData"></param>
+        /// <param name="headers"></param>
+        /// <param name="contentType"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <param name="encoding">默认UTF8</param>
+        /// <returns></returns>
+        public async Task<string> HttpPostAsync(string url, string postData, string contentType = null, Encoding encoding = null)
+        {
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            //if (timeout > 0)
+            //{
+            //    client.Timeout = new TimeSpan(0, 0, timeout);
+            //}
+            HttpContent content = new StringContent(postData ?? "", encoding ?? Encoding.UTF8);
+
+            if (contentType != null)
+            {
+                content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
+            }
+            HttpResponseMessage responseMessage = await client.PostAsync(url, content);
+            byte[] resultBytes = await responseMessage.Content.ReadAsByteArrayAsync();
+            return Encoding.UTF8.GetString(resultBytes);
+        }
+
+        /// <summary>
+        /// 异步POST请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="postData"></param>
+        /// <param name="headers"></param>
+        /// <param name="contentType"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <param name="encoding">默认UTF8</param>
+        /// <returns></returns>
+        public async Task<string> HttpPostAsync(string url, List<KeyValuePair<string, string>> postData,  string contentType = null, Encoding encoding = null)
+        {
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            //if (timeout > 0)
+            //{
+            //    client.Timeout = new TimeSpan(0, 0, timeout);
+            //}
+            HttpContent content = new FormUrlEncodedContent(postData);
+            if (contentType != null)
+            {
+                content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
+            }
+            HttpResponseMessage responseMessage = await client.PostAsync(url, content);
+            byte[] resultBytes = await responseMessage.Content.ReadAsByteArrayAsync();
+            return Encoding.UTF8.GetString(resultBytes);
+        }
+    }
+}

+ 175 - 0
TEAMModelOS.SDK/Extension/HttpClient/Implements/HttpClientSendCloud.cs

@@ -0,0 +1,175 @@
+using System;
+using System.Collections.Generic;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.Context.Configuration;
+using TEAMModelOS.SDK.Context.Constant.Common;
+using HttpClientSpace = System.Net.Http;
+
+namespace TEAMModelOS.SDK.Extension.HttpClient.Implements
+{
+    /// <summary>
+    /// 需要调整的  https://blog.yowko.com/httpclientfactory-dotnet-core-dotnet-framework/
+    /// </summary>
+    public class HttpClientSendCloud
+    {
+        HttpClientSpace.HttpClient client { get; }
+        public HttpClientSendCloud(HttpClientSpace.HttpClient _client)
+        {
+           // _client.DefaultRequestHeaders.Add(Constants.AUTHORIZATION, BaseConfigModel.Configuration["SmsSendCloud:UserInfoKey"]);
+            client = _client;
+        }
+
+        /// <summary>
+        /// 同步GET请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="headers"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <returns></returns>
+        public string HttpGet(string url, Dictionary<string, string> headers = null, int timeout = 0)
+        {
+
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            if (timeout > 0)
+            {
+                client.Timeout = new TimeSpan(0, 0, timeout);
+            }
+            byte[] resultBytes = client.GetByteArrayAsync(url).Result;
+            return Encoding.UTF8.GetString(resultBytes);
+        }
+
+        /// <summary>
+        /// 异步GET请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="headers"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <returns></returns>
+        public async Task<string> HttpGetAsync(string url, Dictionary<string, string> headers = null, int timeout = 0)
+        {
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            if (timeout > 0)
+            {
+                client.Timeout = new TimeSpan(0, 0, timeout);
+            }
+            byte[] resultBytes = await client.GetByteArrayAsync(url);
+            return Encoding.Default.GetString(resultBytes);
+        }
+
+
+        /// <summary>
+        /// 同步POST请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="postData"></param>
+        /// <param name="headers"></param>
+        /// <param name="contentType"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <param name="encoding">默认UTF8</param>
+        /// <returns></returns>
+        public string HttpPost(string url, string postData, Dictionary<string, string> headers = null, string contentType = null, int timeout = 0, Encoding encoding = null)
+        {
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            if (timeout > 0)
+            {
+                client.Timeout = new TimeSpan(0, 0, timeout);
+            }
+            HttpContent content = new StringContent(postData ?? "", encoding ?? Encoding.UTF8);
+
+            if (contentType != null)
+            {
+                content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
+            }
+            HttpResponseMessage responseMessage = client.PostAsync(url, content).Result;
+            byte[] resultBytes = responseMessage.Content.ReadAsByteArrayAsync().Result;
+            return Encoding.UTF8.GetString(resultBytes);
+        }
+
+        /// <summary>
+        /// 异步POST请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="postData"></param>
+        /// <param name="headers"></param>
+        /// <param name="contentType"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <param name="encoding">默认UTF8</param>
+        /// <returns></returns>
+        public async Task<string> HttpPostAsync(string url, string postData, Dictionary<string, string> headers = null, string contentType = null, int timeout = 0, Encoding encoding = null)
+        {
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            if (timeout > 0)
+            {
+                client.Timeout = new TimeSpan(0, 0, timeout);
+            }
+            HttpContent content = new StringContent(postData ?? "", encoding ?? Encoding.UTF8);
+
+            if (contentType != null)
+            {
+                content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
+            }
+            HttpResponseMessage responseMessage = await client.PostAsync(url, content);
+            byte[] resultBytes = await responseMessage.Content.ReadAsByteArrayAsync();
+            return Encoding.UTF8.GetString(resultBytes);
+        }
+
+        /// <summary>
+        /// 异步POST请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="postData"></param>
+        /// <param name="headers"></param>
+        /// <param name="contentType"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <param name="encoding">默认UTF8</param>
+        /// <returns></returns>
+        public async Task<string> HttpPostAsync(string url, List<KeyValuePair<string, string>> postData, Dictionary<string, string> headers = null, string contentType = null, int timeout = 0, Encoding encoding = null)
+        {
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            if (timeout > 0)
+            {
+                client.Timeout = new TimeSpan(0, 0, timeout);
+            }
+            HttpContent content = new FormUrlEncodedContent(postData);
+            if (contentType != null)
+            {
+                content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
+            }
+            HttpResponseMessage responseMessage = await client.PostAsync(url, content);
+            byte[] resultBytes = await responseMessage.Content.ReadAsByteArrayAsync();
+            return Encoding.UTF8.GetString(resultBytes);
+        }
+    }
+}

+ 177 - 0
TEAMModelOS.SDK/Extension/HttpClient/Implements/HttpClientUserInfo.cs

@@ -0,0 +1,177 @@
+using System;
+using System.Collections.Generic;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.Context.Configuration;
+using TEAMModelOS.SDK.Context.Constant.Common;
+using HttpClientSpace = System.Net.Http;
+
+namespace TEAMModelOS.SDK.Extension.HttpClient.Implements
+{
+    /// <summary>
+    /// 需要调整的  https://blog.yowko.com/httpclientfactory-dotnet-core-dotnet-framework/
+    /// </summary>
+    public class HttpClientUserInfo
+    {
+        HttpClientSpace.HttpClient client { get; }
+        public HttpClientUserInfo(HttpClientSpace.HttpClient _client)
+        {
+            // _client.BaseAddress =new Uri(BaseConfigModel.Configuration["HaBookAuth:AccountUrl"]);
+            _client.Timeout = new TimeSpan(0, 0, 1000);
+            _client.DefaultRequestHeaders.Add(Constants.AUTHORIZATION, BaseConfigModel.Configuration["HaBookAuth:UserInfoKey"]);
+            client = _client;
+        }
+
+        /// <summary>
+        /// 同步GET请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="headers"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <returns></returns>
+        public string HttpGet(string url)
+        {
+
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            //if (timeout > 0)
+            //{
+            //    client.Timeout = new TimeSpan(0, 0, timeout);
+            //}
+            byte[] resultBytes = client.GetByteArrayAsync(url).Result;
+            return Encoding.UTF8.GetString(resultBytes);
+        }
+
+        /// <summary>
+        /// 异步GET请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="headers"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <returns></returns>
+        public async Task<string> HttpGetAsync(string url)
+        {
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            //if (timeout > 0)
+            //{
+            //    client.Timeout = new TimeSpan(0, 0, timeout);
+            //}
+            byte[] resultBytes = await client.GetByteArrayAsync(url);
+            return Encoding.Default.GetString(resultBytes);
+        }
+
+
+        /// <summary>
+        /// 同步POST请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="postData"></param>
+        /// <param name="headers"></param>
+        /// <param name="contentType"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <param name="encoding">默认UTF8</param>
+        /// <returns></returns>
+        public string HttpPost(string url, string postData,  string contentType = null, Encoding encoding = null)
+        {
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            //if (timeout > 0)
+            //{
+            //    client.Timeout = new TimeSpan(0, 0, timeout);
+            //}
+            HttpContent content = new StringContent(postData ?? "", encoding ?? Encoding.UTF8);
+
+            if (contentType != null)
+            {
+                content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
+            }
+            HttpResponseMessage responseMessage = client.PostAsync(url, content).Result;
+            byte[] resultBytes = responseMessage.Content.ReadAsByteArrayAsync().Result;
+            return Encoding.UTF8.GetString(resultBytes);
+        }
+
+        /// <summary>
+        /// 异步POST请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="postData"></param>
+        /// <param name="headers"></param>
+        /// <param name="contentType"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <param name="encoding">默认UTF8</param>
+        /// <returns></returns>
+        public async Task<string> HttpPostAsync(string url, string postData, string contentType = null, Encoding encoding = null)
+        {
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            //if (timeout > 0)
+            //{
+            //    client.Timeout = new TimeSpan(0, 0, timeout);
+            //}
+            HttpContent content = new StringContent(postData ?? "", encoding ?? Encoding.UTF8);
+
+            if (contentType != null)
+            {
+                content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
+            }
+            HttpResponseMessage responseMessage = await client.PostAsync(url, content);
+            byte[] resultBytes = await responseMessage.Content.ReadAsByteArrayAsync();
+            return Encoding.UTF8.GetString(resultBytes);
+        }
+
+        /// <summary>
+        /// 异步POST请求
+        /// </summary>
+        /// <param name="url"></param>
+        /// <param name="postData"></param>
+        /// <param name="headers"></param>
+        /// <param name="contentType"></param>
+        /// <param name="timeout">请求响应超时时间,单位/s(默认100秒)</param>
+        /// <param name="encoding">默认UTF8</param>
+        /// <returns></returns>
+        public async Task<string> HttpPostAsync(string url, List<KeyValuePair<string, string>> postData,  string contentType = null, Encoding encoding = null)
+        {
+            //if (headers != null)
+            //{
+            //    foreach (KeyValuePair<string, string> header in headers)
+            //    {
+            //        client.DefaultRequestHeaders.Add(header.Key, header.Value);
+            //    }
+            //}
+            //if (timeout > 0)
+            //{
+            //    client.Timeout = new TimeSpan(0, 0, timeout);
+            //}
+            HttpContent content = new FormUrlEncodedContent(postData);
+            if (contentType != null)
+            {
+                content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
+            }
+            HttpResponseMessage responseMessage = await client.PostAsync(url, content);
+            byte[] resultBytes = await responseMessage.Content.ReadAsByteArrayAsync();
+            return Encoding.UTF8.GetString(resultBytes);
+        }
+    }
+}

+ 18 - 0
TEAMModelOS.SDK/Extension/JsonPath/IJsonPathValueSystem.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace WebTest.JsonPath
+{
+    public interface IJsonPathValueSystem
+    {
+        bool HasMember(object value, string member);
+        object GetMemberValue(object value, string member);
+        IEnumerable GetMembers(object value);
+        bool IsObject(object value);
+        bool IsArray(object value);
+        bool IsPrimitive(object value);
+    }
+}

+ 105 - 0
TEAMModelOS.SDK/Extension/JsonPath/JsonApiValueSystem.cs

@@ -0,0 +1,105 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text.Json;
+using System.Threading.Tasks;
+
+namespace WebTest.JsonPath
+{
+    public class JsonApiValueSystem : IJsonPathValueSystem
+    {
+        public bool HasMember(object value, string member)
+        {
+            // JsonElement document = (JsonElement)value;
+            if (value is JsonElement document)
+            {
+                if (document.ValueKind is JsonValueKind.Object)
+                {
+                    return document.TryGetProperty(member, out JsonElement json);
+
+                }
+
+                if (document.ValueKind is JsonValueKind.Array)
+                {
+                    var index = ParseInt(member, -1);
+                    return index >= 0 && index < document.EnumerateArray().ToArray().Length;
+                }
+            }
+
+            return false;
+        }
+
+        public object GetMemberValue(object value, string member)
+        {
+
+            // JsonElement document = (JsonElement)value;
+            if (value is JsonElement document)
+            {
+                if (document.ValueKind is JsonValueKind.Object)
+                {
+                    return document.GetProperty(member);
+                }
+                if (document.ValueKind is JsonValueKind.Array)
+                {
+                    var index = ParseInt(member, -1);
+                    return document.EnumerateArray().ToArray()[index];
+                }
+            }
+            return null;
+        }
+
+        public IEnumerable GetMembers(object value)
+        {
+            if (value is JsonElement document)
+            {
+                return document.EnumerateObject().Select(property => property.Name);
+            }
+            return null;
+        }
+
+        public bool IsObject(object value)
+        {
+            if (value is JsonElement document)
+            {
+                if (document.ValueKind is JsonValueKind.Array)
+                {
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
+            }
+            return false;
+        }
+
+        public bool IsArray(object value)
+        {
+            if (value is JsonElement document)
+                if (document.ValueKind is JsonValueKind.Array)
+                {
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
+            return false;
+        }
+
+        public bool IsPrimitive(object value)
+        {
+            if (value is JsonElement document)
+            {
+                if (value == null)
+                {
+                    throw new ArgumentNullException("value");
+                }
+                return !(document.ValueKind is JsonValueKind.Object) && !(document.ValueKind is JsonValueKind.Array);
+            }
+            return false;
+        }
+        int ParseInt(string s, int defaultValue) => int.TryParse(s, out int result) ? result : defaultValue;
+    }
+}

+ 64 - 0
TEAMModelOS.SDK/Extension/JsonPath/JsonNetValueSystem.cs

@@ -0,0 +1,64 @@
+using System;
+using System.Collections;
+using System.Linq;
+using Newtonsoft.Json.Linq;
+
+namespace WebTest.JsonPath
+{
+    public class JsonNetValueSystem : IJsonPathValueSystem
+    {
+        public bool HasMember(object value, string member)
+        {
+            if (value is JObject)
+            {
+                return (value as JObject).Properties().Any(property => property.Name == member);
+            }
+
+            if (value is JArray)
+            {
+                var index = ParseInt(member, -1);
+                return index >= 0 && index < (value as JArray).Count;
+            }
+            return false;
+        }
+
+        public object GetMemberValue(object value, string member)
+        {
+            if (value is JObject)
+            {
+                var memberValue = (value as JObject)[member];
+                return memberValue;
+            }
+            if (value is JArray)
+            {
+                var index = ParseInt(member, -1);
+                return (value as JArray)[index];
+            }
+            return null;
+        }
+
+        public IEnumerable GetMembers(object value)
+        {
+            var jobject = value as JObject;
+            return jobject?.Properties().Select(property => property.Name);
+        }
+
+        public bool IsObject(object value) => value is JObject;
+
+        public bool IsArray(object value) => value is JArray;
+
+        public bool IsPrimitive(object value)
+        {
+            if (value == null)
+            {
+                throw new ArgumentNullException("value");
+            }
+
+            return !(value is JObject) && !(value is JArray);
+        }
+
+        int ParseInt(string s, int defaultValue) => int.TryParse(s, out int result) ? result : defaultValue;
+        
+         
+    }
+}

+ 481 - 0
TEAMModelOS.SDK/Extension/JsonPath/JsonPathContext.cs

@@ -0,0 +1,481 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Text.Json;
+using System.Text.RegularExpressions;
+using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
+
+namespace WebTest.JsonPath
+{
+    /// <summary>
+    /// 语法文档  https://www.cnblogs.com/aoyihuashao/p/8665873.html
+    /// </summary>
+    /// <param name="script"></param>
+    /// <param name="value"></param>
+    /// <param name="context"></param>
+    /// <returns></returns>
+    public delegate object JsonPathScriptEvaluator(string script, object value, string context);
+    public delegate void JsonPathResultAccumulator(object value, string[] indicies);
+
+
+    [Serializable]
+    public sealed class JsonPathNode
+    {
+        private readonly object value;
+        private readonly string path;
+
+        public JsonPathNode(object value, string path)
+        {
+            if (path == null)
+                throw new ArgumentNullException("path");
+
+            if (path.Length == 0)
+                throw new ArgumentException("path");
+
+            this.value = value;
+            this.path = path;
+        }
+
+        public object Value
+        {
+            get { return value; }
+        }
+
+        public string Path
+        {
+            get { return path; }
+        }
+
+        public override string ToString()
+        {
+            return Path + " = " + Value;
+        }
+
+        public static object[] ValuesFrom(ICollection nodes)
+        {
+            object[] values = new object[nodes != null ? nodes.Count : 0];
+
+            if (values.Length > 0)
+            {
+                Debug.Assert(nodes != null);
+
+                int i = 0;
+                foreach (JsonPathNode node in nodes)
+                    values[i++] = node.Value;
+            }
+
+            return values;
+        }
+
+        public static string[] PathsFrom(ICollection nodes)
+        {
+            string[] paths = new string[nodes != null ? nodes.Count : 0];
+
+            if (paths.Length > 0)
+            {
+                Debug.Assert(nodes != null);
+
+                int i = 0;
+                foreach (JsonPathNode node in nodes)
+                    paths[i++] = node.Path;
+            }
+
+            return paths;
+        }
+    }
+
+    public sealed class JsonPathContext
+    {
+        public static readonly JsonPathContext Default = new JsonPathContext();
+
+        private JsonPathScriptEvaluator eval;
+        private IJsonPathValueSystem system;
+
+        public JsonPathScriptEvaluator ScriptEvaluator
+        {
+            get { return eval; }
+            set { eval = value; }
+        }
+
+        public IJsonPathValueSystem ValueSystem
+        {
+            get { return system; }
+            set { system = value; }
+        }
+
+        public void SelectTo(object obj, string expr, JsonPathResultAccumulator output)
+        {
+            if (obj == null)
+                throw new ArgumentNullException("obj");
+
+            if (output == null)
+                throw new ArgumentNullException("output");
+
+            Interpreter i = new Interpreter(output, ValueSystem, ScriptEvaluator);
+
+            expr = Normalize(expr);
+
+            if (expr.Length >= 1 && expr[0] == '$') // ^\$:?
+                expr = expr.Substring(expr.Length >= 2 && expr[1] == ';' ? 2 : 1);
+
+            i.Trace(expr, obj, "$");
+        }
+
+        public JsonPathNode[] SelectNodes(object obj, string expr)
+        {
+            ArrayList list = new ArrayList();
+            SelectNodesTo(obj, expr, list);
+            return (JsonPathNode[])list.ToArray(typeof(JsonPathNode));
+        }
+
+        public IList SelectNodesTo(object obj, string expr, IList output)
+        {
+            ListAccumulator accumulator = new ListAccumulator(output != null ? output : new ArrayList());
+            SelectTo(obj, expr, new JsonPathResultAccumulator(accumulator.Put));
+            return output;
+        }
+
+        private static Regex RegExp(string pattern)
+        {
+            return new Regex(pattern, RegexOptions.ECMAScript);
+        }
+
+        private static string Normalize(string expr)
+        {
+            NormalizationSwap swap = new NormalizationSwap();
+            expr = RegExp(@"[\['](\??\(.*?\))[\]']").Replace(expr, new MatchEvaluator(swap.Capture));
+            expr = RegExp(@"'?\.'?|\['?").Replace(expr, ";");
+            expr = RegExp(@";;;|;;").Replace(expr, ";..;");
+            expr = RegExp(@";$|'?\]|'$").Replace(expr, string.Empty);
+            expr = RegExp(@"#([0-9]+)").Replace(expr, new MatchEvaluator(swap.Yield));
+            return expr;
+        }
+
+        private sealed class NormalizationSwap
+        {
+            private readonly ArrayList subx = new ArrayList(4);
+
+            public string Capture(Match match)
+            {
+                Debug.Assert(match != null);
+
+                int index = subx.Add(match.Groups[1].Value);
+                return "[#" + index.ToString(CultureInfo.InvariantCulture) + "]";
+            }
+
+            public string Yield(Match match)
+            {
+                Debug.Assert(match != null);
+
+                int index = int.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture);
+                return (string)subx[index];
+            }
+        }
+
+        public static string AsBracketNotation(string[] indicies)
+        {
+            if (indicies == null)
+                throw new ArgumentNullException("indicies");
+
+            StringBuilder sb = new StringBuilder();
+
+            foreach (string index in indicies)
+            {
+                if (sb.Length == 0)
+                {
+                    sb.Append('$');
+                }
+                else
+                {
+                    sb.Append('[');
+                    if (RegExp(@"^[0-9*]+$").IsMatch(index))
+                        sb.Append(index);
+                    else
+                        sb.Append('\'').Append(index).Append('\'');
+                    sb.Append(']');
+                }
+            }
+
+            return sb.ToString();
+        }
+
+        private static int ParseInt(string s)
+        {
+            return ParseInt(s, 0);
+        }
+
+        private static int ParseInt(string str, int defaultValue)
+        {
+            if (str == null || str.Length == 0)
+                return defaultValue;
+
+            try
+            {
+                return int.Parse(str, NumberStyles.None, CultureInfo.InvariantCulture);
+            }
+            catch (FormatException)
+            {
+                return defaultValue;
+            }
+        }
+
+        private sealed class Interpreter
+        {
+            private readonly JsonPathResultAccumulator output;
+            private readonly JsonPathScriptEvaluator eval;
+            private readonly IJsonPathValueSystem system;
+
+            private static readonly IJsonPathValueSystem defaultValueSystem = new BasicValueSystem();
+
+            private static readonly char[] colon = new char[] { ':' };
+            private static readonly char[] semicolon = new char[] { ';' };
+
+            private delegate void WalkCallback(object member, string loc, string expr, object value, string path);
+
+            public Interpreter(JsonPathResultAccumulator output, IJsonPathValueSystem valueSystem, JsonPathScriptEvaluator eval)
+            {
+                Debug.Assert(output != null);
+
+                this.output = output;
+                this.eval = eval != null ? eval : new JsonPathScriptEvaluator(NullEval);
+                this.system = valueSystem != null ? valueSystem : defaultValueSystem;
+            }
+
+            public void Trace(string expr, object value, string path)
+            {
+                if (expr == null || expr.Length == 0)
+                {
+                    Store(path, value);
+                    return;
+                }
+
+                int i = expr.IndexOf(';');
+                string atom = i >= 0 ? expr.Substring(0, i) : expr;
+                string tail = i >= 0 ? expr.Substring(i + 1) : string.Empty;
+                bool mb = system.HasMember(value, atom);
+                Console.WriteLine("mb:" + mb);
+                if (value != null && mb)
+                {
+                    Trace(tail, Index(value, atom), path + ";" + atom);
+                }
+                else if (atom.Equals("*"))
+                {
+                    Walk(atom, tail, value, path, new WalkCallback(WalkWild));
+                }
+                else if (atom.Equals(".."))
+                {
+                    Trace(tail, value, path);
+                    Walk(atom, tail, value, path, new WalkCallback(WalkTree));
+                }
+                else if (atom.Length > 2 && atom[0] == '(' && atom[atom.Length - 1] == ')') // [(exp)]
+                {
+                    Trace(eval(atom, value, path.Substring(path.LastIndexOf(';') + 1)) + ";" + tail, value, path);
+                }
+                else if (atom.Length > 3 && atom[0] == '?' && atom[1] == '(' && atom[atom.Length - 1] == ')') // [?(exp)]
+                {
+                    Walk(atom, tail, value, path, new WalkCallback(WalkFiltered));
+                }
+                else if (RegExp(@"^(-?[0-9]*):(-?[0-9]*):?([0-9]*)$").IsMatch(atom)) // [start:end:step] Phyton slice syntax
+                {
+                    Slice(atom, tail, value, path);
+                }
+                else if (atom.IndexOf(',') >= 0) // [name1,name2,...]
+                {
+                    foreach (string part in RegExp(@"'?,'?").Split(atom))
+                        Trace(part + ";" + tail, value, path);
+                }
+            }
+
+            private void Store(string path, object value)
+            {
+                if (path != null)
+                    output(value, path.Split(semicolon));
+            }
+
+            private void Walk(string loc, string expr, object value, string path, WalkCallback callback)
+            {
+                if (system.IsPrimitive(value)) {
+                  
+                    return;
+                }
+                if (system.IsArray(value))
+                {
+                   
+
+                    if (value is JsonElement element)
+                    {
+                        IEnumerator enumerator = element.EnumerateArray().GetEnumerator();
+                        int i = 0;
+                        while (enumerator.MoveNext()) {
+                            callback(i, loc, expr, value, path);
+                            i += 1;
+                        }
+                    }
+                    else {
+                        IList list = (IList)value;
+                        for (int i = 0; i < list.Count; i++)
+                            callback(i, loc, expr, value, path);
+                    }
+
+                }
+                else if (system.IsObject(value))
+                {
+                   
+                    IEnumerable mbs = system.GetMembers(value);
+                    
+                    foreach (string key in mbs)
+                        callback(key, loc, expr, value, path);
+                }
+            }
+
+            private void WalkWild(object member, string loc, string expr, object value, string path)
+            {
+                Trace(member + ";" + expr, value, path);
+            }
+
+            private void WalkTree(object member, string loc, string expr, object value, string path)
+            {
+                object result = Index(value, member.ToString());
+                if (result != null && !system.IsPrimitive(result))
+                    Trace("..;" + expr, result, path + ";" + member);
+            }
+
+            private void WalkFiltered(object member, string loc, string expr, object value, string path)
+            {
+                object result = eval(RegExp(@"^\?\((.*?)\)$").Replace(loc, "$1"),
+                    Index(value, member.ToString()), member.ToString());
+
+                if (Convert.ToBoolean(result, CultureInfo.InvariantCulture))
+                    Trace(member + ";" + expr, value, path);
+            }
+
+            private void Slice(string loc, string expr, object value, string path)
+            {
+                IList list = value as IList;
+
+                if (list == null)
+                    return;
+
+                int length = list.Count;
+                string[] parts = loc.Split(colon);
+                int start = ParseInt(parts[0]);
+                int end = ParseInt(parts[1], list.Count);
+                int step = parts.Length > 2 ? ParseInt(parts[2], 1) : 1;
+                start = (start < 0) ? Math.Max(0, start + length) : Math.Min(length, start);
+                end = (end < 0) ? Math.Max(0, end + length) : Math.Min(length, end);
+                for (int i = start; i < end; i += step)
+                    Trace(i + ";" + expr, value, path);
+            }
+
+            private object Index(object obj, string member)
+            {
+
+                object mbv = system.GetMemberValue(obj, member);
+               
+                return mbv;
+            }
+
+            private static object NullEval(string expr, object value, string context)
+            {
+                //
+                // @ symbol in expr must be interpreted specially to resolve
+                // to value. In JavaScript, the implementation would look 
+                // like:
+                //
+                // return obj && value && eval(expr.replace(/@/g, "value"));
+                //
+
+                return null;
+            }
+        }
+
+        private sealed class BasicValueSystem : IJsonPathValueSystem
+        {
+            public bool HasMember(object value, string member)
+            {
+                if (IsPrimitive(value))
+                    return false;
+
+                IDictionary dict = value as IDictionary;
+                if (dict != null)
+                    return dict.Contains(member);
+
+                IList list = value as IList;
+                if (list != null)
+                {
+                    int index = ParseInt(member, -1);
+                    return index >= 0 && index < list.Count;
+                }
+                object obj = value as object;
+                if (obj != null)
+                {
+                    IDictionary<string,object>  dis = obj.ToDictionary();
+                    
+                    return dis.ContainsKey(member);
+                }
+                return false;
+            }
+
+            public object GetMemberValue(object value, string member)
+            {
+                if (IsPrimitive(value))
+                    throw new ArgumentException("value");
+
+                IDictionary dict = value as IDictionary;
+                if (dict != null)
+                    return dict[member];
+
+                IList list = (IList)value;
+                int index = ParseInt(member, -1);
+                if (index >= 0 && index < list.Count)
+                    return list[index];
+
+                return null;
+            }
+
+            public IEnumerable GetMembers(object value)
+            {
+                return ((IDictionary)value).Keys;
+            }
+
+            public bool IsObject(object value)
+            {
+                return value is IDictionary;
+            }
+
+            public bool IsArray(object value)
+            {
+                return value is IList;
+            }
+
+            public bool IsPrimitive(object value)
+            {
+                if (value == null)
+                    throw new ArgumentNullException("value");
+
+                return Type.GetTypeCode(value.GetType()) != TypeCode.Object;
+            }
+        }
+
+        private sealed class ListAccumulator
+        {
+            private readonly IList list;
+
+            public ListAccumulator(IList list)
+            {
+                Debug.Assert(list != null);
+
+                this.list = list;
+            }
+
+            public void Put(object value, string[] indicies)
+            {
+                list.Add(new JsonPathNode(value, JsonPathContext.AsBracketNotation(indicies)));
+            }
+        }
+    }
+}

+ 54 - 0
TEAMModelOS.SDK/Extension/JwtAuth/Filters/JwtAuthorizationFilter.cs

@@ -0,0 +1,54 @@
+using TEAMModelOS.SDK.Extension.JwtAuth.Models;
+using Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Security.Claims;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace TEAMModelOS.SDK.Extension.JwtAuth.Filters
+{
+    public class JwtAuthorizationFilter
+    {
+        private readonly RequestDelegate _next;
+        public JwtAuthorizationFilter(RequestDelegate next)
+        {
+            _next = next;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="httpContext"></param>
+        /// <returns></returns>
+        public Task Invoke(HttpContext httpContext)
+        {
+            //检测是否包含'Authorization'请求头,如果不包含则直接放行
+            if (!httpContext.Request.Headers.ContainsKey(HttpConstant.Authorization) &&!httpContext.Request.Query.ContainsKey(HttpConstant.access_token))
+            {
+                return _next(httpContext);
+            }
+            var tokenHeader = "";
+            if (httpContext.Request.Headers.ContainsKey(HttpConstant.Authorization))
+            {
+                tokenHeader = httpContext.Request.Headers[HttpConstant.Authorization];
+                tokenHeader = tokenHeader.Replace("Bearer ", "");
+            }
+            if (httpContext.Request.Query.ContainsKey(HttpConstant.access_token))
+            {
+                tokenHeader = httpContext.Request.Query[HttpConstant.access_token];
+                //tokenHeader = tokenHeader.Trim();
+            }
+            ClaimModel claimModel = JwtHelper.JwtHelper.SerializeJWT(tokenHeader);
+
+            //将tokenModel存入缓存中
+            //授权
+            //已经弃用该方式获取User信息,采用官方认证,必须在上边ConfigureService 中,配置JWT的认证服务 (.AddAuthentication 和 .AddJwtBearer 二者缺一不可)
+            //var identity = new ClaimsIdentity(claimModel.Claims);
+            //var principal = new ClaimsPrincipal(identity);
+            //httpContext.User = principal;
+
+            return _next(httpContext);
+        }
+    }
+}

+ 79 - 0
TEAMModelOS.SDK/Extension/JwtAuth/JwtAuthExtension.cs

@@ -0,0 +1,79 @@
+using TEAMModelOS.SDK.Extension.JwtAuth.Models;
+using IdentityModel;
+using Microsoft.AspNetCore.Authentication.JwtBearer;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.IdentityModel.Tokens;
+using System;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.Context.Configuration;
+using TEAMModelOS.SDK.Helper.Security.RSACrypt;
+
+namespace TEAMModelOS.SDK.Extension.JwtAuth
+{
+    public static class JwtAuthExtension
+    {
+        public static void JwtAuth(this IServiceCollection services , IConfigurationSection configuration)
+        {
+            services.Configure<JwtSetting>(configuration);
+            // var creds = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(configuration["SecurityKey"]), SecurityAlgorithms.RsaSha256Signature);
+            //var creds = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(configuration["SecurityKey"]));
+            string path = BaseConfigModel.ContentRootPath;
+            RsaSecurityKey creds = new RsaSecurityKey(RsaHelper.LoadCertificateFile(path + "/JwtRsaFile/private.pem"));
+            //RsaSecurityKey creds = new SigningCredentials(new SymmetricSecurityKey(Encoding.UTF8.GetBytes(configuration["SecurityKey"])), SecurityAlgorithms.RsaSha256Signature);
+            // 令牌验证参数
+            var tokenValidationParameters = new TokenValidationParameters
+            {
+                NameClaimType = JwtClaimTypes.Name,
+                RoleClaimType = JwtClaimTypes.Role,
+                ValidateIssuerSigningKey = true,
+                IssuerSigningKey = creds,
+                ValidateIssuer = true,
+                ValidIssuer = configuration["Issuer"],//发行人
+                ValidateAudience = true,
+                ValidAudience = configuration["Audience"],//订阅人
+                                                           // 是否验证Token有效期,使用当前时间与Token的Claims中的NotBefore和Expires对比
+                ValidateLifetime = true,
+                //允许的服务器时间偏移量
+                ClockSkew = TimeSpan.Zero,
+                //是否要求Token的Claims中必须包含Expires
+                RequireExpirationTime = true,
+            };
+            services.AddAuthentication(x => {
+                x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
+                x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
+            }).AddJwtBearer(o =>
+            {
+                o.TokenValidationParameters = tokenValidationParameters;
+                o.Events = new JwtBearerEvents
+                {
+                    OnAuthenticationFailed = context =>
+                    {
+                        // 如果过期,则把<是否过期>添加到,返回头信息中
+                        if (context.Exception.GetType() == typeof(SecurityTokenExpiredException))
+                        {
+                            context.Response.Headers.Add("Token-Expired", "true");
+                        }
+                        return Task.CompletedTask;
+                    },
+                    //Url中添加access_token=[token],直接在浏览器中访问
+                    OnMessageReceived = context => {
+                        context.Token = context.Request.Query["access_token"];
+                        return Task.CompletedTask;
+                    },
+                    //URL未授权调用
+                    OnChallenge = context => {
+                        return Task.CompletedTask;
+                    },
+                    //在Token验证通过后调用
+                    OnTokenValidated = context => {
+                        //编写业务
+                        return Task.CompletedTask;
+                    },
+
+                };
+            });
+        }
+    }
+}

+ 108 - 0
TEAMModelOS.SDK/Extension/JwtAuth/JwtHelper/JwtHelper.cs

@@ -0,0 +1,108 @@
+using TEAMModelOS.SDK.Extension.JwtAuth.Models;
+using IdentityModel;
+using Microsoft.IdentityModel.Tokens;
+using System;
+using System.Collections.Generic;
+using System.IdentityModel.Tokens.Jwt;
+using System.Linq;
+using System.Security.Claims;
+using System.Text;
+using TEAMModelOS.SDK.Helper.Common.DateTimeHelper;
+using TEAMModelOS.SDK.Context.Configuration;
+using System.Security.Cryptography;
+using TEAMModelOS.SDK.Helper.Security.RSACrypt;
+
+namespace TEAMModelOS.SDK.Extension.JwtAuth.JwtHelper
+{
+    public class JwtHelper
+    {
+        /// <summary>
+        /// 颁发JWT Token
+        /// </summary>
+        /// <param name="claimModel"></param>
+        /// <param name="tokenModel"></param>
+        /// <returns></returns>
+        public static JwtResponse IssueJWT(ClaimModel claimModel, JwtSetting setting)
+        {
+           // JwtClient jwtClient = null;
+
+            JwtClient jwtClient= setting.JwtClient.Where(x => x.Name.Equals(claimModel.Scope)).First();
+            //foreach (JwtClient client in setting.JwtClient) {
+            //    if (claimModel.Scope.Equals(client.Name)) {
+            //        jwtClient = client;
+            //        break; 
+            //    }
+            //}
+            List<Claim> claims = new List<Claim>();
+            var dateTime = DateTimeHelper.ConvertToTimeStamp10(DateTime.Now);
+            claims.AddRange(claimModel.Claims);
+            claims.Add(new Claim(JwtClaimTypes.IssuedAt, dateTime + "", ClaimValueTypes.Integer64));
+            claims.Add(new Claim(JwtClaimTypes.NotBefore, dateTime + "", ClaimValueTypes.Integer64));
+            claims.Add(new Claim(JwtClaimTypes.Expiration, dateTime + jwtClient.Exp + "", ClaimValueTypes.Integer64));
+            claims.Add(new Claim(JwtClaimTypes.Audience, setting.Audience));
+            claims.Add(new Claim(JwtClaimTypes.Issuer, setting.Issuer));
+            claims.Add(new Claim(JwtClaimTypes.Scope, claimModel.Scope));
+            claims.Add(new Claim(JwtClaimTypes.JwtId, Guid.NewGuid().ToString()));
+            //claims.AddRange(claimModel.Roles.Select(s=>new Claim(JwtClaimTypes.Role, s)));
+            //claims.AddRange(claimModel.Claims.Select(s => new Claim(ClaimTypes.Role, s)));
+            string path = BaseConfigModel.ContentRootPath;
+            RSACryptoServiceProvider provider = RsaHelper.LoadCertificateFile(path + "/JwtRsaFile/private.pem");
+            RsaSecurityKey rsaSecurity = new RsaSecurityKey(provider);
+            var creds =new SigningCredentials(rsaSecurity, SecurityAlgorithms.RsaSha256);
+
+            var jwt = new JwtSecurityToken(
+                claims:claims,
+                signingCredentials:creds
+                );
+            var jwtHandler = new JwtSecurityTokenHandler();
+            return new JwtResponse {
+                Access_token = jwtHandler.WriteToken(jwt),
+                Scope = claimModel.Scope
+            };
+        }
+        /// <summary>
+        /// 解析jwt
+        /// </summary>
+        /// <param name="jwtStr"></param>
+        /// <returns></returns>
+        public static ClaimModel SerializeJWT(string jwtStr)
+        {
+
+            ///https://www.cnblogs.com/JacZhu/p/6837676.html#Update2.0  刷新     用户的 Token 在过期时间之内根本无法手动设置失效,随之而来的还有重放攻击等等问题
+
+
+            var jwtHandler = new JwtSecurityTokenHandler();
+            if (string.IsNullOrEmpty(jwtStr)) {
+                return null;
+            }
+            JwtSecurityToken jwtToken = jwtHandler.ReadJwtToken(jwtStr);
+            object role = new object(); ;
+            jwtToken.Payload.TryGetValue(ClaimTypes.Role, out role);
+          
+            //var tm = new TokenModelJWT
+            //{
+            //    Uid = (jwtToken.Id).ObjToInt(),
+            //    Role = role != null ? role.ObjToString() : "",
+            //};
+
+
+
+           // var jwtHandler = new JwtSecurityTokenHandler();
+           // JwtSecurityToken jwtToken = jwtHandler.ReadJwtToken(jwtStr);
+            ClaimModel claimModel = new ClaimModel();
+            //object role = new object();
+           // claimModel.Claim = jwtToken.Claims.ToDictionary(claim => claim.Type, claim => claim.Value);
+            Dictionary<string, object> claimDict = new Dictionary<string, object>();
+            foreach (Claim claim in jwtToken.Claims)
+            {
+                claimDict.TryAdd(claim.Type, claim.Value);
+            }
+            claimDict[ClaimTypes.Role] = role;
+            claimModel.Claim = claimDict;
+            claimModel.Claims = jwtToken.Claims.ToList();
+            jwtToken.Payload.TryGetValue(JwtClaimTypes.Role, out role);
+            if(role!=null)claimModel.Roles=role.ToString().Split(",").ToList();
+            return claimModel;
+        }
+    }
+}

+ 33 - 0
TEAMModelOS.SDK/Extension/JwtAuth/Models/ClaimModel.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Security.Claims;
+
+namespace TEAMModelOS.SDK.Extension.JwtAuth.Models
+{
+    public class ClaimModel
+    {
+        public ClaimModel() {
+            Claims = new List<Claim>();
+            Claim = new Dictionary<string, object>();
+            Roles = new List<string>();
+        }
+
+
+        /// <summary>
+        /// 用户身份信息
+        /// </summary>
+        public List<Claim> Claims { get; set; }
+        /// <summary>
+        /// 用户身份信息
+        /// </summary>
+        public Dictionary<string ,object> Claim { get; set; }
+        /// <summary>
+        /// 用户角色信息
+        /// </summary>
+        public List<string> Roles { get; set; }
+        /// <summary>
+        /// 令牌类型
+        /// </summary>
+        public string Scope { get; set; }
+    }
+}

+ 12 - 0
TEAMModelOS.SDK/Extension/JwtAuth/Models/HttpConstant.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.JwtAuth.Models
+{
+    public class HttpConstant
+    {
+        public static readonly string Authorization = "Authorization";
+        public static readonly string access_token = "access_token";
+    }
+}

+ 14 - 0
TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtBlackRecord.cs

@@ -0,0 +1,14 @@
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.SDK.Extension.JwtAuth.Models
+{
+    [TableSpaceAttribute(Name = "Common")]
+    public class JwtBlackRecord :TableEntity
+    {
+        public string Jti { get; set; } 
+    }
+}

+ 12 - 0
TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtClient.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.JwtAuth.Models
+{
+    public class JwtClient
+    {
+        public string Name { get; set; }
+        public double Exp { get; set; }
+    }
+}

+ 15 - 0
TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtResponse.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Constant.Common;
+
+namespace TEAMModelOS.SDK.Extension.JwtAuth.Models
+{
+    public class JwtResponse
+    {
+        public string Access_token { get; set; }
+        public string Token_type { get; set; } = "Bearer";
+        public string Token_key { get; set; } =Constants.AUTHORIZATION;
+        public string Scope { get; set; }
+    }
+}

+ 30 - 0
TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtSetting.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.JwtAuth.Models
+{
+    public class JwtSetting
+    {
+        /// <summary>
+        /// 项目名称
+        /// </summary>
+       // public string Project { get; set; }
+        /// <summary>
+        /// JwtClient
+        /// </summary>
+        public List<JwtClient> JwtClient { get; set; }
+        /// <summary>
+        /// WT的接收对象
+        /// </summary>
+        public string Audience { get; set; }
+        /// <summary>
+        /// JWT的签发主体
+        /// </summary>
+        public string Issuer { get; set; }
+        /// <summary>
+        /// JWT Secret Key
+        /// </summary>
+        //public string SecurityKey { get; set; }
+    }
+}

+ 15 - 0
TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtTokenOptions.cs

@@ -0,0 +1,15 @@
+using Microsoft.IdentityModel.Tokens;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.JwtAuth.Models
+{
+     public  class JwtTokenOptions
+    {
+        public string Audience { get; set; }
+        public RsaSecurityKey Key { get; set; }
+        public SigningCredentials Credentials { get; set; }
+        public string Issuer { get; set; }
+    }
+}

+ 38 - 0
TEAMModelOS.SDK/Extension/Language/Implements/LanguageService.cs

@@ -0,0 +1,38 @@
+using TEAMModelOS.SDK.Extension.Language.Interfaces;
+using TEAMModelOS.SDK.Extension.Language.Model;
+using Microsoft.Extensions.Options;
+using System.Collections.Generic;
+
+namespace TEAMModelOS.SDK.Extension.Language.Implements
+{
+    public class LanguageService : ILanguageService
+    {
+        private Dictionary<string, SmsCountryCode> smsMap { get; set; }
+        public List<SmsCountryCode> countryCodes;
+
+        public LanguageService(IOptions<List<SmsCountryCode>> _option)
+        {
+            countryCodes = _option.Value;
+           
+        }
+        private LanguageService SmsLanguage()
+        {
+            foreach (SmsCountryCode sms in countryCodes) {
+                if (this.smsMap == null)
+                {
+                    smsMap = new Dictionary<string, SmsCountryCode>();
+                }
+                if (!smsMap.ContainsKey(sms.CountryCode))
+                {
+                    smsMap.Add(sms.CountryCode, sms);
+                }
+            }
+            return this;
+        }
+        public Dictionary<string, SmsCountryCode> GetSmsLanguage()
+        {
+            SmsLanguage();
+            return smsMap;
+        }
+    }
+}

+ 12 - 0
TEAMModelOS.SDK/Extension/Language/Interfaces/ILanguageService.cs

@@ -0,0 +1,12 @@
+using TEAMModelOS.SDK.Extension.Language.Model;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.Language.Interfaces
+{
+    public interface ILanguageService
+    {
+        Dictionary<string, SmsCountryCode> GetSmsLanguage();
+    }
+}

+ 18 - 0
TEAMModelOS.SDK/Extension/Language/LanguageExtension.cs

@@ -0,0 +1,18 @@
+using TEAMModelOS.SDK.Extension.Language.Implements;
+using TEAMModelOS.SDK.Extension.Language.Interfaces;
+using TEAMModelOS.SDK.Extension.Language.Model;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using System.Collections.Generic;
+
+namespace TEAMModelOS.SDK.Extension.Language
+{
+    public static class RedisExtension
+    {
+        public static void AddLanguage(this IServiceCollection services, IConfigurationSection LangConfiguration)
+        {
+            services.Configure<List<SmsCountryCode>>(LangConfiguration);
+            services.AddSingleton<ILanguageService, LanguageService>();
+        }
+    }
+}

+ 10 - 0
TEAMModelOS.SDK/Extension/Language/Model/SmsCountryCode.cs

@@ -0,0 +1,10 @@
+namespace TEAMModelOS.SDK.Extension.Language.Model
+{
+    public  class SmsCountryCode
+    {
+        public string Name { get; set; }
+        public string CountryCode { get; set; }
+        public string Language { get; set; }
+        public string SmsLang { get; set; }
+    }
+}

+ 156 - 0
TEAMModelOS.SDK/Extension/MessagePush/Implements/SendCloudService.cs

@@ -0,0 +1,156 @@
+
+using TEAMModelOS.SDK.Extension.MessagePush.Interfaces;
+using TEAMModelOS.SDK.Extension.MessagePush.Model;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.Extension.Language.Interfaces;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
+using Microsoft.Extensions.Options;
+using TEAMModelOS.SDK.Extension.Language.Model;
+using TEAMModelOS.SDK.Helper.Common.JsonHelper;
+using TEAMModelOS.SDK.Helper.Security.Md5Hash;
+using TEAMModelOS.SDK.Helper.Network.HttpHelper;
+using TEAMModelOS.SDK.Extension.HttpClient.Implements;
+
+namespace TEAMModelOS.SDK.Extension.MessagePush.Implements
+{
+    public class SendCloudService : ISendCloudService
+    {
+        public SmsSendCloud smsSendCloud;
+        public ILanguageService _languageService;
+        public IAzureTableDBRepository _azureTableDBRepository;
+        public HttpClientSendCloud _httpClientService;
+        public SendCloudService(IOptions<SmsSendCloud> _option, ILanguageService languageService , IAzureTableDBRepository azureTableDBRepository , HttpClientSendCloud httpClientService )
+        {
+            _azureTableDBRepository = azureTableDBRepository;
+            _languageService = languageService;
+            smsSendCloud = _option.Value;
+            _httpClientService = httpClientService;
+        }
+
+
+        public List<Dictionary<string, string>> Languages { get; set; } = new List<Dictionary<string, string>>
+        {
+            new Dictionary<string, string> { { "name", "简体中文" }, { "code","CHS"  } },
+            new Dictionary<string, string> { { "name", "繁体中文" }, { "code","CHT" } },
+            new Dictionary<string, string> { { "name", "英语" }, { "code","EN"  } } };
+        public List<Dictionary<string, string>> BizCodes { get; set; } = new List<Dictionary<string, string>>
+        {
+            //new Dictionary<string, string> { { "name", "验证码业务" }, { "code", "Captcha" } },
+            new Dictionary<string, string> { { "name", "报名通知业务" }, { "code", "SignUp" } }
+        };
+        public async Task<List<SmsConfig>> SaveOrUpdateSmsConfig(List<SmsConfig> configs) {
+            return await _azureTableDBRepository.SaveOrUpdateAll<SmsConfig>(configs); 
+        }
+        public async Task<List<SmsConfig>> InitSmsConfig(string BizNum)
+        {
+            List<SmsConfig> smsConfigs = new List<SmsConfig>() ;
+            List<SmsConfig> SaveSmsConfigs = new List<SmsConfig>();
+            foreach (Dictionary<string, string> BizCode in BizCodes) {
+                foreach (Dictionary<string, string> Language in Languages) {
+                    Dictionary<string, object> dict = new Dictionary<string, object>
+                    {
+                        { "BizNum", BizNum },{ "BizCode", BizCode["code"] }, { "Language", Language["code"] } ,
+                    };
+                    SmsConfig smsConfig = await _azureTableDBRepository.FindOneByDict<SmsConfig>(dict);
+
+                    if (smsConfig != null && smsConfig.RowKey != null)
+                    {
+                        smsConfigs.Add(smsConfig);
+                    }
+                    else {
+                        DateTimeOffset now = DateTimeOffset.Now;
+                        SmsConfig SaveSmsConfig = new SmsConfig {
+                            RowKey = BizNum + "-" + BizCode["code"] + "-" + Language["code"],
+                            PartitionKey = BizNum,
+                            Language = Language["code"],
+                            LanguageName = Language["name"],
+                            BizCode = BizCode["code"],
+                            BizName = BizCode["name"],
+                            BizNum = BizNum,
+                            Template = null,
+                            Timestamp= now
+                        };
+                        SaveSmsConfigs.Add(SaveSmsConfig);
+                        smsConfigs.Add(SaveSmsConfig);
+                    }
+                }
+            }
+            if (SaveSmsConfigs.Count > 0) {
+               await _azureTableDBRepository.SaveOrUpdateAll<SmsConfig>(SaveSmsConfigs);
+            }
+            return smsConfigs; 
+        }
+        /// <summary>
+        /// https://sendcloud.kf5.com/posts/view/1074678/
+        /// </summary>
+        /// <param name="BizCode"></param>
+        /// <param name="CountryCode"></param>
+        /// <param name="phone"></param>
+        /// <param name="vars"></param>
+        /// <returns></returns>
+        public async Task<SendCloudResponse> SendSmsByBizCode(string  BizNum  , string BizCode, int CountryCode, string phone, Dictionary<string, string> vars = null)
+        {
+            SmsCountryCode code = null;
+            bool flag = _languageService.GetSmsLanguage().TryGetValue(CountryCode + "", out code);
+            string SmsLang = "EN";
+            int templateId = 0;
+            if (flag)
+            {
+                SmsLang = code.SmsLang;
+            }
+            Dictionary<string, object> dict = new Dictionary<string, object>
+            {
+                { "BizNum", BizNum },{ "BizCode", BizCode }, { "Language", SmsLang } ,
+            };
+            SmsConfig smsConfig   =  await _azureTableDBRepository.FindOneByDict<SmsConfig>(dict);
+
+            if (smsConfig != null && smsConfig.RowKey != null )
+            {
+                //默认调用英文,不管是否包含,发送时会去处理相关信息
+                int.TryParse(smsConfig.Template ,out templateId);
+            }
+            //else {
+            //    throw new BizException("");
+            //   //  templateId = smsSendCloud.SmsCode[code.SmsLang];
+            //}
+            int msgType = 0;
+            if (CountryCode != 86)
+            {
+                msgType = 2;
+                return await SendSms(templateId, "00" + CountryCode + phone, vars, msgType);
+            }
+            else
+            {
+                return await SendSms(templateId, phone, vars, msgType);
+            }
+            
+        }
+        public async Task<SendCloudResponse> SendSms(int templateId, string phone, Dictionary<string, string> vars = null, int msgType = 0)
+        {
+            List<KeyValuePair<string, string>> paramList = new List<KeyValuePair<string, string>>
+            {
+                new KeyValuePair<string, string>("msgType", msgType+""),//0表示短信, 1表示彩信,2表示国际短信, 默认值为0
+                new KeyValuePair<string, string>("phone", phone),
+                new KeyValuePair<string, string>("smsUser", smsSendCloud.SmsUser),
+                new KeyValuePair<string, string>("templateId", templateId+""),
+            };
+            if (vars != null)
+            {
+                paramList.Add(new KeyValuePair<string, string>("vars", JsonSerialization.ToJson(vars)));
+            }
+            var param_str = "";
+            foreach (var param in paramList)
+            {
+                param_str += param.Key.ToString() + "=" + param.Value.ToString() + "&";
+            }
+            string sign_str = smsSendCloud.SmsKey + "&" + param_str + smsSendCloud.SmsKey;
+            string sign = Md5Hash.Encrypt(sign_str);
+            paramList.Add(new KeyValuePair<string, string>("signature", sign));
+            string result = await _httpClientService.HttpPostAsync(smsSendCloud.SmsUrl, paramList);
+            return JsonSerialization.FromJson<SendCloudResponse>(result);
+
+        }
+    }
+}

+ 42 - 0
TEAMModelOS.SDK/Extension/MessagePush/Interfaces/ISendCloudService.cs

@@ -0,0 +1,42 @@
+using TEAMModelOS.SDK.Extension.MessagePush.Model;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace TEAMModelOS.SDK.Extension.MessagePush.Interfaces
+{
+    public interface ISendCloudService
+    {
+        /// <summary>
+        /// 发送普通文字短信
+        /// </summary>
+        /// <param name="templateId">模板ID</param>
+        /// <param name="msgType">消息类型0表示短信, 1表示彩信,2表示国际短信, 默认值为0 </param>
+        /// <param name="phone">信人手机号,多个手机号用逗号,分隔,每次调用最大支持2000,更多地址建议使用联系人列表功能</param>
+        /// <param name="vars">替换变量的json串 ,含有特殊字符 请 urlencode ,{"name": "lucy"} or {"%money%": "100"}</param>
+        /// <returns></returns>
+         Task<SendCloudResponse> SendSms(int templateId, string phone, Dictionary<string, string> vars =null , int msgType = 0);
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="BizCode">业务Code</param>
+        /// <param name="CountryCode">国家或地区编码</param>
+        /// <param name="phone">手机号</param>
+        /// <param name="vars">替换变量的json串 ,含有特殊字符 请 urlencode ,{"name": "lucy"} or {"%money%": "100"}</param>
+        /// <returns></returns>
+        Task<SendCloudResponse> SendSmsByBizCode(string BizNum  , string BizCode, int CountryCode, string phone, Dictionary<string, string> vars = null);
+        /// <summary>
+        /// 根据业务流水号初始化短信配置
+        /// </summary>
+        /// <param name="BizNum"></param>
+        /// <returns></returns>
+        Task<List<SmsConfig>> InitSmsConfig(string BizNum);
+        /// <summary>
+        /// 更新或保存
+        /// </summary>
+        /// <param name="configs"></param>
+        /// <returns></returns>
+        Task<List<SmsConfig>> SaveOrUpdateSmsConfig(List<SmsConfig> configs);
+    }
+}

+ 20 - 0
TEAMModelOS.SDK/Extension/MessagePush/MessagePushExtension.cs

@@ -0,0 +1,20 @@
+using TEAMModelOS.SDK.Extension.MessagePush.Implements;
+using TEAMModelOS.SDK.Extension.MessagePush.Interfaces;
+using TEAMModelOS.SDK.Extension.MessagePush.Model;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.MessagePush
+{
+    public static class MessagePushExtension
+    {
+        public static void SendCloud(this IServiceCollection services, IConfigurationSection configuration)
+        {
+            services.Configure<SmsSendCloud>(configuration);
+            services.AddSingleton<ISendCloudService, SendCloudService>();
+        }
+    }
+}

+ 30 - 0
TEAMModelOS.SDK/Extension/MessagePush/Model/SendCloudResponse.cs

@@ -0,0 +1,30 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.MessagePush.Model
+{
+    
+    public  class SendCloudResponse
+    {
+        public string message { get; set; }
+        public Info info { get; set; }
+        public bool result { get; set; }
+        public int  statusCode { get; set; }
+    }
+    
+    public class Info
+    {
+        public int successCount { get; set; }
+        public string[] smsIds { get; set; }
+        public int failedCount { get; set; }
+        public Item[] items { get; set; }
+    }
+    
+    public class Item
+    {
+        public string phone { get; set; }
+        public string message { get; set; }
+    }
+}

+ 36 - 0
TEAMModelOS.SDK/Extension/MessagePush/Model/SmsConfig.cs

@@ -0,0 +1,36 @@
+
+using Microsoft.WindowsAzure.Storage.Table;
+
+namespace TEAMModelOS.SDK.Extension.MessagePush.Model
+{
+    /// <summary>
+    /// 短信配置
+    /// </summary>
+    public class SmsConfig : TableEntity
+    {
+        /// <summary>
+        /// 语言
+        /// </summary>
+        public string Language { get; set; }
+        /// <summary>
+        /// 语言名称
+        /// </summary>
+        public string LanguageName { get; set; }
+        /// <summary>
+        /// 业务code
+        /// </summary>
+        public string BizCode { get; set; }
+        /// <summary>
+        /// 业务名称
+        /// </summary>
+        public string BizName { get; set; }
+        /// <summary>
+        /// 模板ID
+        /// </summary>
+        public string Template { get; set; }
+        /// <summary>
+        /// 业务流水号
+        /// </summary>
+        public string BizNum { get; set; }
+    }
+}

+ 12 - 0
TEAMModelOS.SDK/Extension/MessagePush/Model/SmsSendCloud.cs

@@ -0,0 +1,12 @@
+using System.Collections.Generic;
+
+namespace TEAMModelOS.SDK.Extension.MessagePush.Model
+{
+    public class SmsSendCloud
+    {
+        public string SmsUrl { get; set; }
+        public string SmsUser { get; set; }
+        public string SmsKey { get; set; }
+       
+    }
+}

+ 23 - 0
TEAMModelOS.SDK/Extension/SnowFlake/DisposableAction.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.SnowFlake
+{
+    public class DisposableAction : IDisposable
+    {
+        readonly Action _action;
+
+        public DisposableAction(Action action)
+        {
+            if (action == null)
+                throw new ArgumentNullException("action");
+            _action = action;
+        }
+
+        public void Dispose()
+        {
+            _action();
+        }
+    }
+}

+ 139 - 0
TEAMModelOS.SDK/Extension/SnowFlake/IdWorker.cs

@@ -0,0 +1,139 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.SnowFlake
+{
+    public class IdWorker
+    {
+        //基准时间
+        public const long Twepoch = 1288834974657L;
+        //机器标识位数
+        const int WorkerIdBits = 5;
+        //数据标志位数
+        const int DatacenterIdBits = 5;
+        //序列号识位数
+        const int SequenceBits = 12;
+        //机器ID最大值
+        const long MaxWorkerId = -1L ^ (-1L << WorkerIdBits);
+        //数据标志ID最大值
+        const long MaxDatacenterId = -1L ^ (-1L << DatacenterIdBits);
+        //序列号ID最大值
+        private const long SequenceMask = -1L ^ (-1L << SequenceBits);
+        //机器ID偏左移12位
+        private const int WorkerIdShift = SequenceBits;
+        //数据ID偏左移17位
+        private const int DatacenterIdShift = SequenceBits + WorkerIdBits;
+        //时间毫秒左移22位
+        public const int TimestampLeftShift = SequenceBits + WorkerIdBits + DatacenterIdBits;
+
+        private long _sequence = 0L;
+        private long _lastTimestamp = -1L;
+
+        private long WorkerId { get;  set; }
+        private long DatacenterId { get;  set; }
+        public long Sequence
+        {
+            get { return _sequence; }
+            internal set { _sequence = value; }
+        }
+        private IdWorker() { }
+        private IdWorker(long workerId, long datacenterId, long sequence = 0L)
+        {
+            // 如果超出范围就抛出异常
+            if (workerId > MaxWorkerId || workerId < 0)
+            {
+                throw new ArgumentException(string.Format("worker Id 必须大于0,且不能大于MaxWorkerId: {0}", MaxWorkerId));
+            }
+
+            if (datacenterId > MaxDatacenterId || datacenterId < 0)
+            {
+                throw new ArgumentException(string.Format("region Id 必须大于0,且不能大于MaxWorkerId: {0}", MaxDatacenterId));
+            }
+
+            //先检验再赋值
+            WorkerId = workerId;
+            DatacenterId = datacenterId;
+            _sequence = sequence;
+        }
+
+        readonly object _lock = new Object();
+        public virtual long NextId()
+        {
+            lock (_lock)
+            {
+                var timestamp = TimeGen();
+                if (timestamp < _lastTimestamp)
+                {
+                    throw new Exception(string.Format("时间戳必须大于上一次生成ID的时间戳.  拒绝为{0}毫秒生成id", _lastTimestamp - timestamp));
+                }
+
+                //如果上次生成时间和当前时间相同,在同一毫秒内
+                if (_lastTimestamp == timestamp)
+                {
+                    //sequence自增,和sequenceMask相与一下,去掉高位
+                    _sequence = (_sequence + 1) & SequenceMask;
+                    //判断是否溢出,也就是每毫秒内超过1024,当为1024时,与sequenceMask相与,sequence就等于0
+                    if (_sequence == 0)
+                    {
+                        //等待到下一毫秒
+                        timestamp = TilNextMillis(_lastTimestamp);
+                    }
+                }
+                else
+                {
+                    //如果和上次生成时间不同,重置sequence,就是下一毫秒开始,sequence计数重新从0开始累加,
+                    //为了保证尾数随机性更大一些,最后一位可以设置一个随机数
+                    _sequence = 0;//new Random().Next(10);
+                }
+
+                _lastTimestamp = timestamp;
+                return ((timestamp - Twepoch) << TimestampLeftShift) | (DatacenterId << DatacenterIdShift) | (WorkerId << WorkerIdShift) | _sequence;
+            }
+        }
+
+        // 防止产生的时间比之前的时间还要小(由于NTP回拨等问题),保持增量的趋势.
+        protected virtual long TilNextMillis(long lastTimestamp)
+        {
+            var timestamp = TimeGen();
+            while (timestamp <= lastTimestamp)
+            {
+                timestamp = TimeGen();
+            }
+            return timestamp;
+        }
+
+        // 获取当前的时间戳
+        protected virtual long TimeGen()
+        {
+            return TimeExtensions.CurrentTimeMillis();
+        }
+
+        public static IdWorker getInstance()
+        {
+            return SingletonInstance.singleton;
+        }
+
+        public static class SingletonInstance
+        {
+           public static IdWorker singleton = new IdWorker(0, 1);
+        }
+        public  static List<long> getIdsByCount(int count)
+        {
+            if (count > 0)
+            {
+                List<long> ids = new List<long>();
+                IdWorker idWorker = IdWorker.getInstance();
+                for (int i = 0; i < count; i++)
+                {
+                    ids.Add(idWorker.NextId());
+                }
+                return ids;
+            }
+            else
+            {
+                return null;
+            }
+        }
+    }
+}

+ 42 - 0
TEAMModelOS.SDK/Extension/SnowFlake/TimeExtensions.cs

@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.SnowFlake
+{
+    public static class TimeExtensions
+    {
+        public static Func<long> currentTimeFunc = InternalCurrentTimeMillis;
+
+        public static long CurrentTimeMillis()
+        {
+            return currentTimeFunc();
+        }
+
+        public static IDisposable StubCurrentTime(Func<long> func)
+        {
+            currentTimeFunc = func;
+            return new DisposableAction(() =>
+            {
+                currentTimeFunc = InternalCurrentTimeMillis;
+            });
+        }
+
+        public static IDisposable StubCurrentTime(long millis)
+        {
+            currentTimeFunc = () => millis;
+            return new DisposableAction(() =>
+            {
+                currentTimeFunc = InternalCurrentTimeMillis;
+            });
+        }
+
+        private static readonly DateTime Jan1st1970 = new DateTime
+           (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+
+        private static long InternalCurrentTimeMillis()
+        {
+            return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
+        }
+    }
+}

+ 43 - 0
TEAMModelOS.SDK/Helper/Common/CollectionHelper/CollectionHelper.cs

@@ -0,0 +1,43 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+using System.Text;
+
+namespace TEAMModelOS.SDK.Helper.Common.CollectionHelper
+{
+    public static class CollectionHelper
+    {
+        /// <summary>
+        /// 判断集合是否为空
+        /// </summary>
+        /// <param name="collection"></param>
+        /// <returns></returns>
+        public static bool IsEmpty(this ICollection collection)
+        {
+            if (collection != null && collection.Count > 0)
+            {
+                return false;
+            }
+            else {
+                return true;
+            }
+        }
+        /// <summary>
+        /// 判断集合是否不为空
+        /// </summary>
+        /// <param name="collection"></param>
+        /// <returns></returns>
+        public static bool IsNotEmpty(this ICollection collection)
+        {
+            if (collection != null && collection.Count > 0)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+    }
+}

+ 43 - 0
TEAMModelOS.SDK/Helper/Common/CollectionHelper/ObjectToDictionaryHelper.cs

@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Helper.Common.CollectionHelper
+{
+    public static class ObjectToDictionaryHelper
+    {
+        public static IDictionary<string, object> ToDictionary(this object source)
+        {
+            return source.ToDictionary<object>();
+        }
+
+        public static IDictionary<string, T> ToDictionary<T>(this object source)
+        {
+            if (source == null)
+                ThrowExceptionWhenSourceArgumentIsNull();
+
+            var dictionary = new Dictionary<string, T>();
+            foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(source))
+                AddPropertyToDictionary<T>(property, source, dictionary);
+            return dictionary;
+        }
+
+        private static void AddPropertyToDictionary<T>(PropertyDescriptor property, object source, Dictionary<string, T> dictionary)
+        {
+            object value = property.GetValue(source);
+            if (IsOfType<T>(value))
+                dictionary.Add(property.Name, (T)value);
+        }
+
+        private static bool IsOfType<T>(object value)
+        {
+            return value is T;
+        }
+
+        private static void ThrowExceptionWhenSourceArgumentIsNull()
+        {
+            throw new ArgumentNullException("source", "Unable to convert object to a dictionary. The source object is null.");
+        }
+    }
+}

+ 396 - 0
TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorConverter.cs

@@ -0,0 +1,396 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+
+namespace TEAMModelOS.SDK.Helper.Common.ColorHelper
+{
+    public class ColorConverter
+    {
+        public string SetLuminanceMod(string s, double luminance)
+        {
+
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetLuminanceMod(c, luminance);
+        }
+        public string SetLuminanceOff(string s, double luminance)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetLuminanceOff(c, luminance);
+        }
+        public string SetTint(string s, double tint)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetTint(c, tint);
+        }
+        public string SetShade(string s, double shade)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetShade(c, shade);
+        }
+        public string SetSaturationMod(string s, double saturation)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetSaturationMod(c, saturation);
+        }
+        public string SetSaturationOff(string s, double saturation)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetSaturationOff(c, saturation);
+        }
+        public string SetBrightness(string s, double luminance)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetBrightness(c, luminance);
+        }
+        public string SetHueMod(string s, double hueMod)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetHueMod(c, hueMod);
+        }
+        public string SetHueOff(string s, double hueOff)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetHueOff(c, hueOff);
+        }
+        private double RGB_to_linearRGB(double val)
+        {
+
+            if (val < 0.0)
+                return 0.0;
+            if (val <= 0.04045)
+                return val / 12.92;
+            if (val <= 1.0)
+                return (double)Math.Pow(((val + 0.055) / 1.055), 2.4);
+
+            return 1.0;
+        }
+        private double linearRGB_to_RGB(double val)
+        {
+
+            if (val < 0.0)
+                return 0.0;
+            if (val <= 0.0031308)
+                return val * 12.92;
+            if (val < 1.0)
+                return (1.055 * Math.Pow(val, (1.0 / 2.4))) - 0.055;
+
+            return 1.0;
+            /*
+            Public Function linearRGB_to_sRGB(ByVal value As Double) As Double
+                If value < 0.0# Then Return 0.0#
+                If value <= 0.0031308# Then Return value * 12.92
+                If value < 1.0# Then Return 1.055 * (value ^ (1.0# / 2.4)) - 0.055
+                Return 1.0#
+            End Function
+            */
+
+        }
+        public string SetShade(Color c, double shade)
+        {
+            //Console.WriteLine("Shade: " + shade);
+
+            double convShade = (shade / 1000) * 0.01;
+
+            double r = (double)c.R / 255;
+            double g = (double)c.G / 255;
+            double b = (double)c.B / 255;
+
+            double rLin = RGB_to_linearRGB(r);
+            double gLin = RGB_to_linearRGB(g);
+            double bLin = RGB_to_linearRGB(b);
+
+            //Console.WriteLine("Linear R: " + rLin + "\nLinear G: " + gLin + "\nLinear B: " + bLin);
+
+            //SHADE 
+            if ((rLin * convShade) < 0)
+                rLin = 0;
+            if ((rLin * convShade) > 1)
+                rLin = 0;
+            else
+                rLin *= convShade;
+
+            if ((gLin * convShade) < 0)
+                gLin = 0;
+            if ((gLin * convShade) > 1)
+                gLin = 0;
+            else
+                gLin *= convShade;
+
+            if ((bLin * convShade) < 0)
+                bLin = 0;
+            if ((bLin * convShade) > 1)
+                bLin = 0;
+            else
+                bLin *= convShade;
+
+            //SHADEEND
+
+            r = linearRGB_to_RGB(rLin);
+            g = linearRGB_to_RGB(gLin);
+            b = linearRGB_to_RGB(bLin);
+
+            Color outColor = Color.FromArgb((int)Math.Round(r * 255), (int)Math.Round(g * 255), (int)Math.Round(b * 255));
+
+            return outColor.R.ToString("X2") + outColor.G.ToString("X2") + outColor.B.ToString("X2");
+
+        }
+        public string SetTint(Color c, double tint)
+        {
+
+            double tintConv = (tint / 1000) * 0.01;
+
+            double r = (double)c.R / 255;
+            double g = (double)c.G / 255;
+            double b = (double)c.B / 255;
+
+            double rLin = RGB_to_linearRGB(r);
+            double gLin = RGB_to_linearRGB(g);
+            double bLin = RGB_to_linearRGB(b);
+
+            /**TINT**/
+
+            if (tintConv > 0)
+                rLin = (rLin * tintConv) + (1 - tintConv);
+            else
+                rLin = rLin * (1 + tintConv);
+
+            if (tintConv > 0)
+                gLin = (gLin * tintConv) + (1 - tintConv);
+            else
+                gLin = gLin * (1 + tintConv);
+
+            if (tintConv > 0)
+                bLin = (bLin * tintConv) + (1 - tintConv);
+            else
+                bLin = bLin * (1 + tintConv);
+
+            r = linearRGB_to_RGB(rLin);
+            g = linearRGB_to_RGB(gLin);
+            b = linearRGB_to_RGB(bLin);
+
+            Color outColor = Color.FromArgb((int)Math.Round(r * 255), (int)Math.Round(g * 255), (int)Math.Round(b * 255));
+
+            return outColor.R.ToString("X2") + outColor.G.ToString("X2") + outColor.B.ToString("X2");
+        }
+        public string SetSaturationMod(Color c, double saturation)
+        {
+            double satMod = (saturation / 1000) * 0.01;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+            hsl.S *= satMod;
+            c = HSL_to_RGB(hsl);
+
+            return c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
+        }
+        public string SetSaturationOff(Color c, double saturation)
+        {
+            double satOff = (saturation / 1000) * 0.01;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+            hsl.S += satOff;
+            c = HSL_to_RGB(hsl);
+
+            return c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
+        }
+        public string SetBrightness(Color c, double brightness)
+        {
+
+            double convBrightness = brightness / 100000;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+
+            hsl.L *= convBrightness;
+            c = HSL_to_RGB(hsl);
+
+            return c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
+        }
+        public string SetLuminanceMod(Color c, double luminance)
+        {
+            double lumMod = (luminance / 1000) * 0.01;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+            hsl.L *= lumMod;
+            Color outColor = HSL_to_RGB(hsl);
+
+            return outColor.R.ToString("X2") + outColor.G.ToString("X2") + outColor.B.ToString("X2");
+        }
+        public string SetLuminanceOff(Color c, double luminance)
+        {
+            double lumModOff = (luminance / 1000) * 0.01;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+            hsl.L += lumModOff;
+            Color outColor = HSL_to_RGB(hsl);
+
+            return outColor.R.ToString("X2") + outColor.G.ToString("X2") + outColor.B.ToString("X2");
+        }
+        public string SetHueMod(Color c, double hue)
+        {
+
+            double hueMod = (hue / 1000) * 0.01;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+            hsl.H *= hueMod;
+            Color outColor = HSL_to_RGB(hsl);
+
+            return outColor.R.ToString("X2") + outColor.G.ToString("X2") + outColor.B.ToString("X2");
+
+        }
+        public string SetHueOff(Color c, double hue)
+        {
+
+            double hueMod = (hue / 1000) * 0.01;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+            hsl.H += hueMod;
+            Color outColor = HSL_to_RGB(hsl);
+            return outColor.R.ToString("X2") + outColor.G.ToString("X2") + outColor.B.ToString("X2");
+
+        }
+
+        private ColorHSL RGB_to_HSL(Color c)
+        {
+            ColorHSL hsl = new ColorHSL();
+
+            hsl.H = c.GetHue() / 360.0;
+            hsl.L = c.GetBrightness();
+            hsl.S = c.GetSaturation();
+
+            return hsl;
+        }
+        private ColorHSL CreateHSL(int r, int g, int b)
+        {
+            ColorHSL hsl = new ColorHSL();
+ 
+            double R = (double)r / 255;
+            double G = (double)g / 255;
+            double B = (double)b / 255;
+            double max = 0, min = 0;
+            double H = 0, S = 0, L = 0;
+            bool rBool = false, gBool = false, bBool = false;
+
+            //find max
+            if ((R > G) && (R > B))
+            {
+                max = R;
+                rBool = true;
+            }
+            else if ((G > R) && (G > B))
+            {
+                max = G;
+                gBool = true;
+            }
+            else if ((B > G) && (B > R))
+            {
+                max = B;
+                bBool = true;
+            }
+
+            if ((R < G) && (R < B))
+                min = R;
+            else if ((G < R) && (G < B))
+                min = G;
+            else if ((B < G) && (B < R))
+                min = B;
+
+            //set Luminance
+            hsl.L = (min + max) / 2;
+
+            if (min == max)
+            {
+                hsl.S = 0;
+                hsl.H = 0;
+            }
+
+            //set saturation
+            if (hsl.L < 0.5)
+                hsl.S = (max - min) / (max + min);
+            else if (hsl.L > 0.5)
+                hsl.S = (max - min) / (2.0 - max - min);
+
+            if (rBool)
+            {
+                H = ((G - B) / (max - min)) * 60.0;
+                Console.WriteLine("red");
+            }
+            if (gBool)
+            {
+                H = ((2.0 + ((B - R) / (max - min))) * 60.0);
+                Console.WriteLine("green");
+            }
+            if (bBool)
+            {
+                H = (4.0 + (R - G) / (max - min)) * 60.0;
+                Console.WriteLine("blue");
+            }
+
+            if (H < 0)
+                H += 360;
+
+            H = Math.Round(H);
+            H = H / 360;
+
+            hsl.H = H;
+
+            return hsl;
+        }
+        private Color HSL_to_RGB(ColorHSL hslColor)
+        {
+
+            double r = 0, g = 0, b = 0;
+            double temp1, temp2;
+
+
+            if (hslColor.L == 0)
+                r = g = b = 0;
+            else
+            {
+                if (hslColor.S == 0)
+                {
+                    r = g = b = hslColor.L;
+                }
+                else
+                {
+                    temp2 = ((hslColor.L <= 0.5) ? hslColor.L * (1.0 + hslColor.S) : hslColor.L + hslColor.S - (hslColor.L * hslColor.S));
+                    temp1 = 2.0 * hslColor.L - temp2;
+
+                    double[] t3 = new double[] { hslColor.H + 1.0 / 3.0, hslColor.H, hslColor.H - 1.0 / 3.0 };
+                    double[] clr = new double[] { 0, 0, 0 };
+                    for (int i = 0; i < 3; i++)
+                    {
+                        if (t3[i] < 0)
+                            t3[i] += 1.0;
+                        if (t3[i] > 1)
+                            t3[i] -= 1.0;
+
+                        if (6.0 * t3[i] < 1.0)
+                            clr[i] = temp1 + (temp2 - temp1) * t3[i] * 6.0;
+                        else if (2.0 * t3[i] < 1.0)
+                            clr[i] = temp2;
+                        else if (3.0 * t3[i] < 2.0)
+                            clr[i] = (temp1 + (temp2 - temp1) * ((2.0 / 3.0) - t3[i]) * 6.0);
+                        else
+                            clr[i] = temp1;
+                    }
+                    r = clr[0];
+                    g = clr[1];
+                    b = clr[2];
+                }
+            }
+
+            return Color.FromArgb((int)(255 * r), (int)(255 * g), (int)(255 * b));
+
+        }
+
+    }
+}

+ 27 - 0
TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorHSL.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Helper.Common.ColorHelper
+{
+    /// <summary>
+    /// 类      名:ColorHSL
+    /// 功      能:H 色相 \ S 饱和度(纯度) \ L 亮度 颜色模型 
+    /// </summary>
+    public class ColorHSL
+    {
+        /// <summary>
+        /// 色相
+        /// </summary>
+        public double H { get; set; }
+        /// <summary>
+        /// 饱和度(纯度)
+        /// </summary>
+        public double S { get; set; }
+
+        /// <summary>
+        /// 饱和度
+        /// </summary>
+        public double L { get; set; }
+    }
+}

+ 72 - 0
TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorHSV.cs

@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Helper.Common.ColorHelper
+{
+    /// <summary>
+    /// 类      名:ColorHSV
+    /// 功      能:H 色相 \ S 饱和度(纯度) \ V 明度 颜色模型 
+    /// </summary>
+    public class ColorHSV
+    {
+        /// <summary>
+        /// 构造方法
+        /// </summary>
+        /// <param name="h"></param>
+        /// <param name="s"></param>
+        /// <param name="v"></param>
+        public ColorHSV(int h, int s, int v)
+        {
+            this._h = h;
+            this._s = s;
+            this._v = v;
+        }
+
+        private int _h;
+        private int _s;
+        private int _v;
+
+        /// <summary>
+        /// 色相
+        /// </summary>
+        public int H
+        {
+            get { return this._h; }
+            set
+            {
+                this._h = value;
+                this._h = this._h > 360 ? 360 : this._h;
+                this._h = this._h < 0 ? 0 : this._h;
+            }
+        }
+
+        /// <summary>
+        /// 饱和度(纯度)
+        /// </summary>
+        public int S
+        {
+            get { return this._s; }
+            set
+            {
+                this._s = value;
+                this._s = this._s > 255 ? 255 : this._s;
+                this._s = this._s < 0 ? 0 : this._s;
+            }
+        }
+
+        /// <summary>
+        /// 明度
+        /// </summary>
+        public int V
+        {
+            get { return this._v; }
+            set
+            {
+                this._v = value;
+                this._v = this._v > 255 ? 255 : this._v;
+                this._v = this._v < 0 ? 0 : this._v;
+            }
+        }
+    }
+}

+ 238 - 0
TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorHelper.cs

@@ -0,0 +1,238 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Helper.Common.ColorHelper
+{
+    /// <summary>
+    /// 类      名:ColorHelper
+    /// 功      能:提供从RGB到HSV/HSL色彩空间的相互转换
+    /// </summary>
+    public static class ColorHelper
+    {
+        /// <summary>
+        /// RGB转换HSV
+        /// </summary>
+        /// <param name="rgb"></param>
+        /// <returns></returns>
+        public static ColorHSV RgbToHsv(ColorRGB rgb)
+        {
+            double min, max, tmp, H, S, V;
+            double R = rgb.R * 1.0f / 255, G = rgb.G * 1.0f / 255, B = rgb.B * 1.0f / 255;
+            tmp = Math.Min(R, G);
+            min = Math.Min(tmp, B);
+            tmp = Math.Max(R, G);
+            max = Math.Max(tmp, B);
+            // H
+            H = 0;
+            if (max == min)
+            {
+                H = 0;
+            }
+            else if (max == R && G > B)
+            {
+                H = 60 * (G - B) * 1.0f / (max - min) + 0;
+            }
+            else if (max == R && G < B)
+            {
+                H = 60 * (G - B) * 1.0f / (max - min) + 360;
+            }
+            else if (max == G)
+            {
+                H = H = 60 * (B - R) * 1.0f / (max - min) + 120;
+            }
+            else if (max == B)
+            {
+                H = H = 60 * (R - G) * 1.0f / (max - min) + 240;
+            }
+            // S
+            if (max == 0)
+            {
+                S = 0;
+            }
+            else
+            {
+                S = (max - min) * 1.0f / max;
+            }
+            // V
+            V = max;
+            return new ColorHSV((int)H, (int)(S * 255), (int)(V * 255));
+        }
+
+        /// <summary>
+        /// HSV转换RGB
+        /// </summary>
+        /// <param name="hsv"></param>
+        /// <returns></returns>
+        public static ColorRGB HsvToRgb(ColorHSV hsv)
+        {
+            if (hsv.H == 360) hsv.H = 359; // 360为全黑,原因不明
+            double R = 0f, G = 0f, B = 0f;
+            if (hsv.S == 0)
+            {
+                return new ColorRGB(hsv.V, hsv.V, hsv.V);
+            }
+            double S = hsv.S * 1.0f / 255, V = hsv.V * 1.0f / 255;
+            int H1 = (int)(hsv.H * 1.0f / 60), H = hsv.H;
+            double F = H * 1.0f / 60 - H1;
+            double P = V * (1.0f - S);
+            double Q = V * (1.0f - F * S);
+            double T = V * (1.0f - (1.0f - F) * S);
+            switch (H1)
+            {
+                case 0: R = V; G = T; B = P; break;
+                case 1: R = Q; G = V; B = P; break;
+                case 2: R = P; G = V; B = T; break;
+                case 3: R = P; G = Q; B = V; break;
+                case 4: R = T; G = P; B = V; break;
+                case 5: R = V; G = P; B = Q; break;
+            }
+            R = R * 255;
+            G = G * 255;
+            B = B * 255;
+            while (R > 255) R -= 255;
+            while (R < 0) R += 255;
+            while (G > 255) G -= 255;
+            while (G < 0) G += 255;
+            while (B > 255) B -= 255;
+            while (B < 0) B += 255;
+            return new ColorRGB((int)R, (int)G, (int)B);
+        }
+
+        /// <summary>
+        /// RGB转换HSL
+        /// </summary>
+        /// <param name="rgb"></param>
+        /// <returns></returns>
+        public static ColorHSL RgbToHsl(ColorRGB rgb)
+        {
+            double min, max, tmp, H = 0, S = 0, L = 0;
+            double R = rgb.R * 1.0f / 255, G = rgb.G * 1.0f / 255, B = rgb.B * 1.0f / 255;
+            tmp = Math.Min(R, G);
+            min = Math.Min(tmp, B);
+            tmp = Math.Max(R, G);
+            max = Math.Max(tmp, B);
+            L = (max + min) / 2.0d;
+            if (min == max)
+            {
+                H = S = 0;
+            }
+            else
+            {
+                double d = max - min;
+                S = L > 0.5 ? d / (2 - max - min) : d / (max + min);
+                if (max == R)
+                {
+                    H = (G - B) / d + (G < B ? 6 : 0);
+                }
+                else if (max == G)
+                {
+                    H = (G - R) / d + 2;
+                }
+                else if (max == B)
+                {
+                    H = (R - G) / d + 4;
+                }
+            }
+            H = H / 6.0F;
+            return new ColorHSL() { H = H, S = S, L = L };
+        }
+
+        public static double hue2rgb(double p, double q, double t)
+        {
+            if (t < 0) t += 1;
+
+            if (t > 1) t -= 1;
+
+            if (t < 1.0 / 6.0d) return p + (q - p) * 6 * t;
+
+            if (t < 1.0 / 2.0d) return q;
+
+            if (t < 2.0 / 3.0d) return p + (q - p) * (2.0d / 3.0d - t) * 6.0d;
+
+            return p;
+        }
+
+        /// <summary>
+        /// HSL转换RGB
+        /// </summary>
+        /// <param name="hsl"></param>
+        /// <returns></returns>
+        public static ColorRGB HslToRgb(ColorHSL hsl)
+        {
+            var l = hsl.L;
+            var s = hsl.S;
+            var h = hsl.H;
+            double R = 0, G = 0, B = 0;
+            if (hsl.S == 0)
+            {
+                R = G = B = hsl.L;
+            }
+            else
+            {
+                var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
+                var p = 2 * l - q;
+                R = hue2rgb(p, q, h + 1.0d / 3.0d);
+                G = hue2rgb(p, q, h);
+                B = hue2rgb(p, q, h - 1.0d / 3.0d);
+            }
+            R = R * 255; G = G * 255; B = B * 255;
+            return new ColorRGB(int.Parse(Math.Round(R, 0) + ""), int.Parse(Math.Round(G, 0) + ""), int.Parse(Math.Round(B, 0) + ""));
+        }
+        private static double HueToRGB(double p, double q, double h)
+        {
+            if (h < 0) h += 1;
+            if (h > 1) h -= 1;
+            if (6 * h < 1)
+            {
+                return p + ((q - p) * 6 * h);
+            }
+            if (2 * h < 1)
+            {
+                return q;
+            }
+            if (3 * h < 2)
+            {
+                return p + ((q - p) * 6 * ((2.0f / 3.0f) - h));
+            }
+            return p;
+        }
+        /// <summary>
+        /// 处理图像饱和度
+        /// </summary>
+        /// <param name="color"></param>
+        /// <param name="lumMod"></param>
+        /// <param name="lumOff"></param>
+        /// <returns></returns>
+        public static string GetColorLumModAndLumOff(Color color, int lumMod = 0, int lumOff = 0)
+        {
+            ColorHSL colorHSL = RgbToHsl(new ColorRGB(color.R, color.G, color.B));
+            colorHSL.L = colorHSL.L * lumMod / 100_000.0 + lumOff / 100_000.0;
+            ColorRGB colorRGB = HslToRgb(colorHSL);
+            return ColorTranslator.ToHtml(Color.FromArgb(colorRGB.R, colorRGB.G, colorRGB.B)).Replace("#","");
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="color">原色RGB</param>
+        /// <param name="pa">混合原色占百分比/100% </param>
+        /// <param name="Type">Shade 与黑色混合  Tint与白色混合</param>
+        /// <returns></returns>
+        public static string  GetShadeOrTintColor(Color color, double val, string Type)
+        {
+            ColorConverter converter = new ColorConverter();
+            if (Type.Equals("Shade"))
+            {
+                return converter.SetShade(color, val);
+            }
+            else if (Type.Equals("Tint"))
+            {
+                return converter.SetTint(color, val);
+            }
+            else { return ColorTranslator.ToHtml(color).Replace("#",""); }
+        }
+
+    }
+}

+ 83 - 0
TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorRGB.cs

@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Helper.Common.ColorHelper
+{
+    /// <summary>
+    /// 类      名:ColorRGB
+    /// 功      能:R 红色 \ G 绿色 \ B 蓝色 颜色模型
+    ///                 所有颜色模型的基类,RGB是用于输出到屏幕的颜色模式,所以所有模型都将转换成RGB输出
+    /// </summary>
+    public class ColorRGB
+    {
+        /// <summary>
+        /// 构造方法
+        /// </summary>
+        /// <param name="r"></param>
+        /// <param name="g"></param>
+        /// <param name="b"></param>
+        public ColorRGB(int r, int g, int b)
+        {
+            this._r = r;
+            this._g = g;
+            this._b = b;
+        }
+
+        private int _r;
+        private int _g;
+        private int _b;
+
+        /// <summary>
+        /// 红色
+        /// </summary>
+        public int R
+        {
+            get { return this._r; }
+            set
+            {
+                this._r = value;
+                this._r = this._r > 255 ? 255 : this._r;
+                this._r = this._r < 0 ? 0 : this._r;
+            }
+        }
+
+        /// <summary>
+        /// 绿色
+        /// </summary>
+        public int G
+        {
+            get { return this._g; }
+            set
+            {
+                this._g = value;
+                this._g = this._g > 255 ? 255 : this._g;
+                this._g = this._g < 0 ? 0 : this._g;
+            }
+        }
+
+        /// <summary>
+        /// 蓝色
+        /// </summary>
+        public int B
+        {
+            get { return this._b; }
+            set
+            {
+                this._b = value;
+                this._b = this._b > 255 ? 255 : this._b;
+                this._b = this._b < 0 ? 0 : this._b;
+            }
+        }
+
+        /// <summary>
+        /// 获取实际颜色
+        /// </summary>
+        /// <returns></returns>
+        public Color GetColor()
+        {
+            return Color.FromArgb(this._r, this._g, this._b);
+        }
+    } 
+}

+ 147 - 0
TEAMModelOS.SDK/Helper/Common/DateTimeHelper/DateTimeHelper.cs

@@ -0,0 +1,147 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Helper.Common.DateTimeHelper
+{
+    public static class DateTimeHelper
+    {
+        /// <summary>
+        /// 时间戳转换为日期(时间戳单位秒)
+        /// </summary>
+        /// <param name="TimeStamp"></param>
+        /// <returns></returns>
+        public static DateTime ConvertToDateTime(long timeStamp)
+        {
+            var dtStart = TimeZoneInfo.ConvertTimeToUtc(new DateTime(1970, 1, 1));
+            TimeSpan toNow = new TimeSpan(timeStamp);
+            return dtStart.Add(toNow);
+            //var start = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+            //return start.AddMilliseconds(timeStamp).AddHours(8);
+        }
+        /// <summary>
+        /// 日期转换为时间戳(时间戳单位秒)
+        /// </summary>
+        /// <param name="TimeStamp"></param>
+        /// <returns></returns>
+        public static long ConvertToTimeStamp13(DateTime time)
+        {
+            DateTime Jan1st1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+            return (long)(time.AddHours(-8) - Jan1st1970).TotalMilliseconds;
+        }
+        /// <summary>
+        /// 日期转换为时间戳(时间戳单位秒)
+        /// </summary>
+        /// <param name="TimeStamp"></param>
+        /// <returns></returns>
+        public static long ConvertToTimeStamp10(DateTime time)
+        {
+            DateTime Jan1st1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+            return (long)(time.AddHours(-8) - Jan1st1970).TotalMilliseconds / 1000;
+        }
+
+        public static DateTime FromUnixTimestamp(this long unixtime)
+        {
+            DateTime sTime = TimeZoneInfo.ConvertTime(new DateTime(1970, 1, 1), TimeZoneInfo.Utc, TimeZoneInfo.Local);
+            return sTime.AddMilliseconds(unixtime);
+        }
+
+        public static DateTime FromUnixTimestampOffSet(this long unixtime, int offset)
+        {
+            DateTime sTime = TimeZoneInfo.ConvertTime(new DateTime(1970, 1, 1), TimeZoneInfo.Utc, TimeZoneInfo.Local);
+            int serverOffset = (int)TimeZoneInfo.Local.GetUtcOffset(DateTime.Now).TotalMinutes;
+            int subOffset = offset - serverOffset;
+            return sTime.AddMilliseconds(unixtime).AddMinutes(subOffset);
+        }
+        public static long ToUnixTimestamp(this DateTime datetime)
+        {
+            //DateTime sTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+            DateTime sTime = TimeZoneInfo.ConvertTime(new DateTime(1970, 1, 1), TimeZoneInfo.Utc, TimeZoneInfo.Local);
+            return (long)(datetime - sTime).TotalMilliseconds;
+        }
+        /// <summary>
+        /// 获取当前cpu振荡时间戳 17位数
+        /// </summary>
+        /// <returns></returns>
+        public static long GetCPUMillisecond()
+        {
+            return DateTime.Now.ToUniversalTime().Ticks - 621355968000000000;
+        }
+        /// <summary>
+        /// 获取标准毫秒级时间戳 13位数
+        /// </summary>
+        /// <returns></returns>
+        public static long GetMillisecond()
+        {
+            return (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000;
+        }
+        /// <summary>
+        /// 获取当前年
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCurrentYear()
+        {
+            return DateTime.Now.Year;
+        }
+        /// <summary>
+        /// 获取当前月份
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCurrentMonth()
+        {
+            return DateTime.Now.Month;
+        }
+        /// <summary>
+        /// 获取星期几
+        /// </summary>
+        /// <returns></returns>
+        public static DayOfWeek GetCurrentDayOfWeek()
+        {
+            return DateTime.Now.DayOfWeek;
+        }
+        /// <summary>
+        /// 获取本年第几天
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCurrentDayOfYear()
+        {
+            return DateTime.Now.DayOfYear;
+        }
+        /// <summary>
+        /// 获取当前小时
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCurrentHour()
+        {
+            return DateTime.Now.Hour;
+        }
+        /// <summary>
+        /// 获取当前分钟
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCurrentMinute()
+        {
+            return DateTime.Now.Minute;
+        }
+        /// <summary>
+        /// 获取当前秒
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCurrentSecond()
+        {
+            return DateTime.Now.Second;
+        }
+        /// <summary>
+        /// 获得 GMT+8 时间
+        /// </summary>
+        /// <returns></returns>
+        public static DateTime ChinaTime()
+        {
+
+            TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("China Standard Time");//设置时区
+            DateTime easternTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, easternZone);
+            return easternTime;
+        }
+
+    }
+}

+ 799 - 0
TEAMModelOS.SDK/Helper/Common/FileHelper/FileHelper.cs

@@ -0,0 +1,799 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Net;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Helper.Common.FileHelper
+{
+    public class FileHelper
+    {
+        #region 获取文件到集合中
+        /// <summary>
+        /// 读取指定位置文件列表到集合中
+        /// </summary>
+        /// <param name="path">指定路径</param>
+        /// <returns></returns>
+        public static DataTable GetFileTable(string path)
+        {
+            DataTable dt = new DataTable();
+            dt.Columns.Add("name", typeof(string));
+            dt.Columns.Add("ext", typeof(string));
+            dt.Columns.Add("size", typeof(long));
+            dt.Columns.Add("time", typeof(DateTime));
+
+            DirectoryInfo dirinfo = new DirectoryInfo(path);
+            FileInfo fi;
+            DirectoryInfo dir;
+            string FileName, FileExt;
+            long FileSize = 0;
+            DateTime FileModify;
+            try
+            {
+                foreach (FileSystemInfo fsi in dirinfo.GetFileSystemInfos())
+                {
+                    FileName = string.Empty;
+                    FileExt = string.Empty;
+                    if (fsi is FileInfo)
+                    {
+                        fi = (FileInfo)fsi;
+                        //获取文件名称
+                        FileName = fi.Name;
+                        //获取文件扩展名
+                        FileExt = fi.Extension;
+                        //获取文件大小
+                        FileSize = fi.Length;
+                        //获取文件最后修改时间
+                        FileModify = fi.LastWriteTime;
+                    }
+                    else
+                    {
+                        dir = (DirectoryInfo)fsi;
+                        //获取目录名
+                        FileName = dir.Name;
+                        //获取目录最后修改时间
+                        FileModify = dir.LastWriteTime;
+                        //设置目录文件为文件夹
+                        FileExt = "文件夹";
+                    }
+                    DataRow dr = dt.NewRow();
+                    dr["name"] = FileName;
+                    dr["ext"] = FileExt;
+                    dr["size"] = FileSize;
+                    dr["time"] = FileModify;
+                    dt.Rows.Add(dr);
+                }
+            }
+            catch
+            {
+
+                throw;
+            }
+            return dt;
+        }
+
+        #endregion
+
+        #region 检测指定路径是否存在
+        /// <summary>
+        /// 检测指定路径是否存在
+        /// </summary>
+        /// <param name="path">目录的绝对路径</param> 
+        public static bool IsExistDirectory(string path)
+        {
+            return Directory.Exists(path);
+        }
+        #endregion
+
+        #region 检测指定文件是否存在,如果存在则返回true
+        /// <summary>
+        /// 检测指定文件是否存在,如果存在则返回true
+        /// </summary>
+        /// <param name="filePath">文件的绝对路径</param>  
+        public static bool IsExistFile(string filePath)
+        {
+            return File.Exists(filePath);
+        }
+        #endregion
+
+        #region 创建文件夹
+        /// <summary>
+        /// 创建文件夹
+        /// </summary>
+        /// <param name="folderPath">文件夹的绝对路径</param>
+        public static void CreateFolder(string folderPath)
+        {
+            if (!IsExistDirectory(folderPath))
+            {
+                Directory.CreateDirectory(folderPath);
+            }
+        }
+        #endregion 
+
+        #region 判断上传文件后缀名
+        /// <summary>
+        /// 判断上传文件后缀名
+        /// </summary>
+        /// <param name="strExtension">后缀名</param>
+        public static bool IsCanEdit(string strExtension)
+        {
+            strExtension = strExtension.ToLower();
+            if (strExtension.LastIndexOf(".", StringComparison.Ordinal) >= 0)
+            {
+                strExtension = strExtension.Substring(strExtension.LastIndexOf(".", StringComparison.Ordinal));
+            }
+            else
+            {
+                strExtension = ".txt";
+            }
+            string[] strArray = new string[] { ".htm", ".html", ".txt", ".js", ".css", ".xml", ".sitemap" };
+            for (int i = 0; i < strArray.Length; i++)
+            {
+                if (strExtension.Equals(strArray[i]))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+
+        public static bool IsSafeName(string strExtension)
+        {
+            strExtension = strExtension.ToLower();
+            if (strExtension.LastIndexOf(".") >= 0)
+            {
+                strExtension = strExtension.Substring(strExtension.LastIndexOf("."));
+            }
+            else
+            {
+                strExtension = ".txt";
+            }
+            string[] strArray = new string[] { ".jpg", ".gif", ".png" };
+            for (int i = 0; i < strArray.Length; i++)
+            {
+                if (strExtension.Equals(strArray[i]))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public static bool IsZipName(string strExtension)
+        {
+            strExtension = strExtension.ToLower();
+            if (strExtension.LastIndexOf(".") >= 0)
+            {
+                strExtension = strExtension.Substring(strExtension.LastIndexOf("."));
+            }
+            else
+            {
+                strExtension = ".txt";
+            }
+            string[] strArray = new string[] { ".zip", ".rar" };
+            for (int i = 0; i < strArray.Length; i++)
+            {
+                if (strExtension.Equals(strArray[i]))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+        #endregion
+
+        #region 创建文件夹
+        /// <summary>
+        /// 创建文件夹
+        /// </summary>
+        /// <param name="fileName">文件的绝对路径</param>
+        public static void CreateSuffic(string fileName)
+        {
+            try
+            {
+                if (!Directory.Exists(fileName))
+                {
+                    Directory.CreateDirectory(fileName);
+                }
+            }
+            catch (Exception ex)
+            {
+                var s = ex.Message;
+
+                throw;
+            }
+        }
+
+        /// <summary>
+        /// 创建文件夹
+        /// </summary>
+        /// <param name="fileName">文件的绝对路径</param>
+        public static void CreateFiles(string fileName)
+        {
+            try
+            {
+                //判断文件是否存在,不存在创建该文件
+                if (!IsExistFile(fileName))
+                {
+                    FileInfo file = new FileInfo(fileName);
+                    FileStream fs = file.Create();
+                    fs.Close();
+                }
+            }
+            catch (Exception ex)
+            {
+
+                throw ex;
+            }
+        }
+
+        /// <summary>
+        /// 创建一个文件,并将字节流写入文件。
+        /// </summary>
+        /// <param name="filePath">文件的绝对路径</param>
+        /// <param name="buffer">二进制流数据</param>
+        public static void CreateFile(string filePath, byte[] buffer)
+        {
+            try
+            {
+                //判断文件是否存在,不存在创建该文件
+                if (!IsExistFile(filePath))
+                {
+                    FileInfo file = new FileInfo(filePath);
+                    FileStream fs = file.Create();
+                    fs.Write(buffer, 0, buffer.Length);
+                    fs.Close();
+                }
+                else
+                {
+                    File.WriteAllBytes(filePath, buffer);
+                }
+            }
+            catch (Exception ex)
+            {
+
+                throw ex;
+            }
+        }
+        #endregion
+
+        #region 将文件移动到指定目录
+        /// <summary>
+        /// 将文件移动到指定目录
+        /// </summary>
+        /// <param name="sourceFilePath">需要移动的源文件的绝对路径</param>
+        /// <param name="descDirectoryPath">移动到的目录的绝对路径</param>
+        public static void Move(string sourceFilePath, string descDirectoryPath)
+        {
+            string sourceName = GetFileName(sourceFilePath);
+            if (IsExistDirectory(descDirectoryPath))
+            {
+                //如果目标中存在同名文件,则删除
+                if (IsExistFile(descDirectoryPath + "\\" + sourceFilePath))
+                {
+                    DeleteFile(descDirectoryPath + "\\" + sourceFilePath);
+                }
+                else
+                {
+                    //将文件移动到指定目录
+                    File.Move(sourceFilePath, descDirectoryPath + "\\" + sourceFilePath);
+                }
+            }
+        }
+        #endregion
+
+        # region 将源文件的内容复制到目标文件中
+        /// <summary>
+        /// 将源文件的内容复制到目标文件中
+        /// </summary>
+        /// <param name="sourceFilePath">源文件的绝对路径</param>
+        /// <param name="descDirectoryPath">目标文件的绝对路径</param>
+        public static void Copy(string sourceFilePath, string descDirectoryPath)
+        {
+            File.Copy(sourceFilePath, descDirectoryPath, true);
+        }
+        #endregion
+
+        #region 从文件的绝对路径中获取文件名( 不包含扩展名 )
+        /// <summary>
+        /// 从文件的绝对路径中获取文件名( 不包含扩展名 )
+        /// </summary>
+        /// <param name="filePath">文件的绝对路径</param> 
+        public static string GetFileName(string filePath)
+        {
+            FileInfo file = new FileInfo(filePath);
+            return file.Name;
+        }
+        #endregion
+
+        #region 获取文件的后缀名
+        /// <summary>
+        /// 获取文件的后缀名
+        /// </summary>
+        /// <param name="filePath">文件的绝对路径</param>
+        public static string GetExtension(string filePath)
+        {
+            FileInfo file = new FileInfo(filePath);
+            return file.Extension;
+        }
+
+        /// <summary>
+        /// 返回文件扩展名,不含“.”
+        /// </summary>
+        /// <param name="filepath">文件全名称</param>
+        /// <returns>string</returns>
+        public static string GetFileExt(string filepath)
+        {
+            if (string.IsNullOrEmpty(filepath))
+            {
+                return "";
+            }
+            if (filepath.LastIndexOf(".", StringComparison.Ordinal) > 0)
+            {
+                return filepath.Substring(filepath.LastIndexOf(".", StringComparison.Ordinal) + 1); //文件扩展名,不含“.”
+            }
+            return "";
+        }
+        #endregion
+
+        #region 删除指定文件
+        /// <summary>
+        /// 删除指定文件
+        /// </summary>
+        /// <param name="filePath">文件的绝对路径</param>
+        public static void DeleteFile(string filePath)
+        {
+            if (IsExistFile(filePath))
+            {
+                File.Delete(filePath);
+            }
+        }
+        #endregion
+
+        // <summary>
+        ///直接删除指定目录下的所有文件及文件夹(保留目录)
+        /// </summary>
+        /// <param name="strPath">文件夹路径</param>
+        /// <returns>执行结果</returns>
+
+        public static void DeleteDirAndFiles(string file)
+        {
+            try
+            {
+                //去除文件夹和子文件的只读属性
+                //去除文件夹的只读属性
+                System.IO.DirectoryInfo fileInfo = new DirectoryInfo(file);
+                fileInfo.Attributes = FileAttributes.Normal & FileAttributes.Directory;
+                //去除文件的只读属性
+                System.IO.File.SetAttributes(file, System.IO.FileAttributes.Normal);
+                //判断文件夹是否还存在
+                if (Directory.Exists(file))
+                {
+                    foreach (string f in Directory.GetFileSystemEntries(file))
+                    {
+                        if (File.Exists(f))
+                        {
+                            //如果有子文件删除文件
+                            File.Delete(f);
+                            Console.WriteLine(f);
+                        }
+                        else
+                        {
+                            //循环递归删除子文件夹
+                            DeleteDirAndFiles(f);
+                        }
+                    }
+                    //删除空文件夹
+                    Directory.Delete(file);
+                }
+            }
+            catch (Exception ex) // 异常处理
+            {
+                Console.WriteLine(ex.Message.ToString());// 异常信息
+            }
+        }
+
+
+        #region 删除指定目录及其所有子目录
+        /// <summary>
+        /// 删除指定目录及其所有子目录
+        /// </summary>
+        /// <param name="directoryPath">文件的绝对路径</param>
+        public static void DeleteDirectory(string directoryPath)
+        {
+            if (IsExistDirectory(directoryPath))
+            {
+                Directory.Delete(directoryPath);
+            }
+        }
+        #endregion
+
+        #region 清空指定目录下所有文件及子目录,但该目录依然保存.
+        /// <summary>
+        /// 清空指定目录下所有文件及子目录,但该目录依然保存.
+        /// </summary>
+        /// <param name="directoryPath">指定目录的绝对路径</param>
+        public static void ClearDirectory(string directoryPath)
+        {
+            if (!IsExistDirectory(directoryPath)) return;
+            //删除目录中所有的文件
+            string[] fileNames = GetFileNames(directoryPath);
+            for (int i = 0; i < fileNames.Length; i++)
+            {
+                DeleteFile(fileNames[i]);
+            }
+            //删除目录中所有的子目录
+            string[] directoryNames = GetDirectories(directoryPath);
+            for (int i = 0; i < directoryNames.Length; i++)
+            {
+                DeleteDirectory(directoryNames[i]);
+            }
+        }
+        #endregion
+
+        #region  剪切  粘贴
+        /// <summary>
+        /// 剪切文件
+        /// </summary>
+        /// <param name="source">原路径</param> 
+        /// <param name="destination">新路径</param> 
+        public bool FileMove(string source, string destination)
+        {
+            bool ret = false;
+            FileInfo file_s = new FileInfo(source);
+            FileInfo file_d = new FileInfo(destination);
+            if (file_s.Exists)
+            {
+                if (!file_d.Exists)
+                {
+                    file_s.MoveTo(destination);
+                    ret = true;
+                }
+            }
+            if (ret == true)
+            {
+                //Response.Write("<script>alert('剪切文件成功!');</script>");
+            }
+            else
+            {
+                //Response.Write("<script>alert('剪切文件失败!');</script>");
+            }
+            return ret;
+        }
+        #endregion
+
+        #region 检测指定目录是否为空
+        /// <summary>
+        /// 检测指定目录是否为空
+        /// </summary>
+        /// <param name="directoryPath">指定目录的绝对路径</param>  
+        public static bool IsEmptyDirectory(string directoryPath)
+        {
+            try
+            {
+                //判断文件是否存在
+                string[] fileNames = GetFileNames(directoryPath);
+                if (fileNames.Length > 0)
+                {
+                    return false;
+                }
+                //判断是否存在文件夹
+                string[] directoryNames = GetDirectories(directoryPath);
+                if (directoryNames.Length > 0)
+                {
+                    return false;
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                var s = ex.Message;
+                return true;
+            }
+        }
+        #endregion
+
+        #region 获取指定目录中所有文件列表
+        /// <summary>
+        /// 获取指定目录中所有文件列表
+        /// </summary>
+        /// <param name="directoryPath">指定目录的绝对路径</param>  
+        public static string[] GetFileNames(string directoryPath)
+        {
+            if (!IsExistDirectory(directoryPath))
+            {
+                throw new FileNotFoundException();
+            }
+            return Directory.GetFiles(directoryPath);
+        }
+        #endregion
+
+        #region 获取指定目录中的子目录列表
+        /// <summary>
+        /// 获取指定目录中所有子目录列表,若要搜索嵌套的子目录列表,请使用重载方法
+        /// </summary>
+        /// <param name="directoryPath">指定目录的绝对路径</param>
+        public static string[] GetDirectories(string directoryPath)
+        {
+            try
+            {
+                return Directory.GetDirectories(directoryPath);
+            }
+            catch (Exception ex)
+            {
+
+                throw ex;
+            }
+        }
+
+        /// <summary>
+        /// 获取指定目录及子目录中所有子目录列表
+        /// </summary>
+        /// <param name="directoryPath">指定目录的绝对路径</param>
+        /// <param name="searchPattern">模式字符串,"*"代表0或N个字符,"?"代表1个字符。
+        /// 范例:"Log*.xml"表示搜索所有以Log开头的Xml文件。</param>
+        /// <param name="isSearchChild">是否搜索子目录</param>
+        public static string[] GetDirectories(string directoryPath, string searchPattern, bool isSearchChild)
+        {
+            try
+            {
+                if (isSearchChild)
+                {
+                    return Directory.GetDirectories(directoryPath, searchPattern, SearchOption.AllDirectories);
+                }
+                else
+                {
+                    return Directory.GetDirectories(directoryPath, searchPattern, SearchOption.TopDirectoryOnly);
+                }
+            }
+            catch (Exception ex)
+            {
+
+                throw ex;
+            }
+        }
+        #endregion
+
+        #region 获取一个文件的长度
+        /// <summary> 
+        /// 获取一个文件的长度,单位为Byte 
+        /// </summary> 
+        /// <param name="filePath">文件的绝对路径</param>         
+        public static int GetFileSize(string filePath)
+        {
+            //创建一个文件对象 
+            FileInfo fi = new FileInfo(filePath);
+            //获取文件的大小 
+            return (int)fi.Length;
+        }
+        /// <summary> 
+        /// 获取一个文件的长度,单位为KB 
+        /// </summary> 
+        /// <param name="filePath">文件的路径</param>         
+        public static double GetFileSizeByKb(string filePath)
+        {
+            //创建一个文件对象 
+            FileInfo fi = new FileInfo(filePath);
+            //获取文件的大小 
+            return Math.Round(Convert.ToDouble(filePath.Length) / 1024, 2);// ConvertHelper.ToDouble(ConvertHelper.ToDouble(fi.Length) / 1024, 1);
+        }
+
+        /// <summary> 
+        /// 获取一个文件的长度,单位为MB 
+        /// </summary> 
+        /// <param name="filePath">文件的路径</param>         
+        public static double GetFileSizeByMb(string filePath)
+        {
+            //创建一个文件对象 
+            FileInfo fi = new FileInfo(filePath);
+            //获取文件的大小 
+            return Math.Round(Convert.ToDouble(Convert.ToDouble(fi.Length) / 1024 / 1024), 2);
+        }
+
+        #endregion
+
+        #region 获取所有文件夹及子文件夹
+        /// <summary>
+        /// 获取所有文件夹及子文件夹
+        /// </summary>
+        /// <param name="dirPath"></param>
+        /// <returns></returns>
+        public static List<ArrayFiles> GetDirs(string dirPath)
+        {
+            var list = new List<ArrayFiles>();
+            return GetArrys(dirPath, 0, list);
+        }
+
+        private static int zdId = 0;
+        private static List<ArrayFiles> GetArrys(string dirPath, int pid, List<ArrayFiles> list)
+        {
+            if (!Directory.Exists(dirPath)) return list;
+            if (Directory.GetDirectories(dirPath).Length <= 0) return list;
+            foreach (string path in Directory.GetDirectories(dirPath))
+            {
+                zdId++;
+                var model = new ArrayFiles()
+                {
+                    Id = zdId,
+                    Name = path.Substring(path.LastIndexOf('\\') + 1, path.Length - (path.LastIndexOf('\\') + 1)),
+                    Pid = pid,
+                    Open = false,
+                    Target = "DeployBase",
+                    Url = "/FytAdmin/FileMiam/DocList?path=" + path
+                };
+                list.Add(model);
+                GetArrys(path, model.Id, list);
+            }
+            return list;
+        }
+
+        public class ArrayFiles
+        {
+            public int Id { get; set; }
+            public int Pid { get; set; }
+            public string Name { get; set; }
+            public Boolean Open { get; set; }
+            public string Target { get; set; }
+            public string Url { get; set; }
+        }
+        #endregion
+
+        #region 将文件读取到字符串中
+        /// <summary>
+        /// 将文件读取到字符串中
+        /// </summary>
+        /// <param name="filePath">文件的绝对路径</param>
+        public static string FileToString(string filePath)
+        {
+            return FileToString(filePath, Encoding.UTF8);
+        }
+        /// <summary>
+        /// 将文件读取到字符串中
+        /// </summary>
+        /// <param name="filePath">文件的绝对路径</param>
+        /// <param name="encoding">字符编码</param>
+        public static string FileToString(string filePath, Encoding encoding)
+        {
+            //创建流读取器
+            StreamReader reader = new StreamReader(filePath, encoding);
+            try
+            {
+                //读取流
+                return reader.ReadToEnd();
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            finally
+            {
+                //关闭流读取器
+                reader.Close();
+            }
+        }
+        #endregion
+    }
+
+    /// <summary>
+    /// 远程文件下载
+    /// </summary>
+    public class HttpDldFile
+    {
+        /// <summary>
+        /// Http方式下载文件
+        /// </summary>
+        /// <param name="url">http地址</param>
+        /// <param name="localfile">本地文件</param>
+        /// <returns></returns>
+        public bool Download(string url, string localfile)
+        {
+            bool flag = false;
+            long startPosition = 0; // 上次下载的文件起始位置
+            FileStream writeStream; // 写入本地文件流对象
+
+            long remoteFileLength = GetHttpLength(url);// 取得远程文件长度
+            //System.Console.WriteLine("remoteFileLength=" + remoteFileLength);
+            if (remoteFileLength == 745)
+            {
+                System.Console.WriteLine("远程文件不存在.");
+                return false;
+            }
+
+            // 判断要下载的文件夹是否存在
+            if (File.Exists(localfile))
+            {
+
+                writeStream = File.OpenWrite(localfile);             // 存在则打开要下载的文件
+                startPosition = writeStream.Length;                  // 获取已经下载的长度
+
+                if (startPosition >= remoteFileLength)
+                {
+                    System.Console.WriteLine("本地文件长度" + startPosition + "已经大于等于远程文件长度" + remoteFileLength);
+                    writeStream.Close();
+
+                    return false;
+                }
+                else
+                {
+                    writeStream.Seek(startPosition, SeekOrigin.Current); // 本地文件写入位置定位
+                }
+            }
+            else
+            {
+                writeStream = new FileStream(localfile, FileMode.Create);// 文件不保存创建一个文件
+                startPosition = 0;
+            }
+
+
+            try
+            {
+                HttpWebRequest myRequest = (HttpWebRequest)HttpWebRequest.Create(url);// 打开网络连接
+
+                if (startPosition > 0)
+                {
+                    myRequest.AddRange((int)startPosition);// 设置Range值,与上面的writeStream.Seek用意相同,是为了定义远程文件读取位置
+                }
+
+
+                Stream readStream = myRequest.GetResponse().GetResponseStream();// 向服务器请求,获得服务器的回应数据流
+
+
+                byte[] btArray = new byte[512];// 定义一个字节数据,用来向readStream读取内容和向writeStream写入内容
+                int contentSize = readStream.Read(btArray, 0, btArray.Length);// 向远程文件读第一次
+
+                long currPostion = startPosition;
+
+                while (contentSize > 0)// 如果读取长度大于零则继续读
+                {
+                    currPostion += contentSize;
+                    int percent = (int)(currPostion * 100 / remoteFileLength);
+                    System.Console.WriteLine("percent=" + percent + "%");
+
+                    writeStream.Write(btArray, 0, contentSize);// 写入本地文件
+                    contentSize = readStream.Read(btArray, 0, btArray.Length);// 继续向远程文件读取
+                }
+
+                //关闭流
+                writeStream.Close();
+                readStream.Close();
+
+                flag = true;        //返回true下载成功
+            }
+            catch (Exception)
+            {
+                writeStream.Close();
+                flag = false;       //返回false下载失败
+            }
+
+            return flag;
+        }
+
+        // 从文件头得到远程文件的长度
+        private static long GetHttpLength(string url)
+        {
+            long length = 0;
+
+            try
+            {
+                HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);// 打开网络连接
+                HttpWebResponse rsp = (HttpWebResponse)req.GetResponse();
+
+                if (rsp.StatusCode == HttpStatusCode.OK)
+                {
+                    length = rsp.ContentLength;// 从文件头得到远程文件的长度
+                }
+
+                rsp.Close();
+                return length;
+            }
+            catch (Exception e)
+            {
+                var s = e.Message;
+                return length;
+            }
+
+        }
+    }
+}

+ 550 - 0
TEAMModelOS.SDK/Helper/Common/FileHelper/FileHelperCore.cs

@@ -0,0 +1,550 @@
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading.Tasks;
+
+namespace TEAMModelOS.SDK.Helper.Common.FileHelper
+{
+    /// <summary>
+    /// Describe:文件帮助类
+    /// </summary>
+    public class FileHelperCore
+    {
+        private static IWebHostEnvironment _hostingEnvironment = new HttpContextAccessor().HttpContext.RequestServices.GetService(typeof(IWebHostEnvironment)) as IWebHostEnvironment;
+
+        /// <summary>
+        /// 目录分隔符
+        /// windows "\" OSX and Linux  "/"
+        /// </summary>
+        private static string DirectorySeparatorChar = Path.DirectorySeparatorChar.ToString();
+        /// <summary>
+        /// 包含应用程序的目录的绝对路径
+        /// </summary>
+        private static string _ContentRootPath = _hostingEnvironment.ContentRootPath;
+
+        #region 检测指定路径是否存在
+
+        /// <summary>
+        /// 检测指定路径是否存在
+        /// </summary>
+        /// <param name="path">路径</param>
+        /// <returns></returns>
+        public static bool IsExist(string path)
+        {
+            return IsDirectory(MapPath(path)) ? Directory.Exists(MapPath(path)) : File.Exists(MapPath(path));
+        }
+        /// <summary>
+        /// 检测指定路径是否存在(异步方式)
+        /// </summary>
+        /// <param name="path">路径</param>
+        /// <returns></returns>
+        public static async Task<bool> IsExistAsync(string path)
+        {
+            return await Task.Run(() => IsDirectory(MapPath(path)) ? Directory.Exists(MapPath(path)) : File.Exists(MapPath(path)));
+        }
+
+        #endregion
+
+        #region 检测目录是否为空
+
+        /// <summary>
+        /// 检测目录是否为空
+        /// </summary>
+        /// <param name="path">路径</param>
+        /// <returns></returns>
+        public static bool IsEmptyDirectory(string path)
+        {
+            return Directory.GetFiles(MapPath(path)).Length <= 0 && Directory.GetDirectories(MapPath(path)).Length <= 0;
+        }
+        /// <summary>
+        /// 检测目录是否为空
+        /// </summary>
+        /// <param name="path">路径</param>
+        /// <returns></returns>
+        public static async Task<bool> IsEmptyDirectoryAsync(string path)
+        {
+            return await Task.Run(() => Directory.GetFiles(MapPath(path)).Length <= 0 && Directory.GetDirectories(MapPath(path)).Length <= 0);
+        }
+
+        #endregion
+
+        #region 创建目录
+
+        /// <summary>
+        /// 创建目录
+        /// </summary>
+        /// <param name="path">路径</param>
+        public static void CreateFiles(string path)
+        {
+            try
+            {
+                if (IsDirectory(MapPath(path)))
+                    Directory.CreateDirectory(MapPath(path));
+                else
+                    File.Create(MapPath(path)).Dispose();
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
+        #endregion
+
+        #region 删除文件或目录
+
+        /// <summary>
+        /// 删除目录或文件
+        /// </summary>
+        /// <param name="path">路径</param>
+        public static void DeleteFiles(string path)
+        {
+            try
+            {
+                if (IsExist(path))
+                {
+                    if (IsDirectory(MapPath(path)))
+                        Directory.Delete(MapPath(path));
+                    else
+                        File.Delete(MapPath(path));
+                }
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+        
+        /// <summary>
+        /// 清空目录下所有文件及子目录,依然保留该目录
+        /// </summary>
+        /// <param name="path"></param>
+        public static void ClearDirectory(string path)
+        {
+            if (IsExist(path))
+            {
+                //目录下所有文件
+                string[] files = Directory.GetFiles(MapPath(path));
+                foreach (var file in files)
+                {
+                    DeleteFiles(file);
+                }
+                //目录下所有子目录
+                string[] directorys = Directory.GetDirectories(MapPath(path));
+                foreach (var dir in directorys)
+                {
+                    DeleteFiles(dir);
+                }
+            }
+        }
+
+        #endregion
+
+        #region 判断文件是否为隐藏文件(系统独占文件)
+
+        /// <summary>
+        /// 检测文件或文件夹是否为隐藏文件
+        /// </summary>
+        /// <param name="path">路径</param>
+        /// <returns></returns>
+        public static bool IsHiddenFile(string path)
+        {
+            return IsDirectory(MapPath(path)) ? InspectHiddenFile(new DirectoryInfo(MapPath(path))) : InspectHiddenFile(new FileInfo(MapPath(path)));
+        }
+        /// <summary>
+        /// 检测文件或文件夹是否为隐藏文件(异步方式)
+        /// </summary>
+        /// <param name="path">路径</param>
+        /// <returns></returns>
+        public static async Task<bool> IsHiddenFileAsync(string path)
+        {
+            return await Task.Run(() => IsDirectory(MapPath(path)) ? InspectHiddenFile(new DirectoryInfo(MapPath(path))) : InspectHiddenFile(new FileInfo(MapPath(path))));
+        }
+        /// <summary>
+        /// 私有方法 文件是否为隐藏文件(系统独占文件)
+        /// </summary>
+        /// <param name="fileSystemInfo"></param>
+        /// <returns></returns>
+        private static bool InspectHiddenFile(FileSystemInfo fileSystemInfo)
+        {
+            if (fileSystemInfo.Name.StartsWith("."))
+            {
+                return true;
+            }
+            else if (fileSystemInfo.Exists &&
+                ((fileSystemInfo.Attributes & FileAttributes.Hidden) != 0 ||
+                 (fileSystemInfo.Attributes & FileAttributes.System) != 0))
+            {
+                return true;
+            }
+
+            return false;
+        }
+
+        #endregion
+
+        #region 文件操作
+
+        #region 复制文件
+
+        /// <summary>
+        /// 复制文件内容到目标文件夹
+        /// </summary>
+        /// <param name="sourcePath">源文件</param>
+        /// <param name="targetPath">目标文件夹</param>
+        /// <param name="isOverWrite">是否可以覆盖</param>
+        public static void Copy(string sourcePath, string targetPath, bool isOverWrite = true)
+        {
+            File.Copy(MapPath(sourcePath), MapPath(targetPath) + GetFileName(sourcePath), isOverWrite);
+        }
+        /// <summary>
+        /// 复制文件内容到目标文件夹
+        /// </summary>
+        /// <param name="sourcePath">源文件</param>
+        /// <param name="targetPath">目标文件夹</param>
+        /// <param name="newName">新文件名称</param>
+        /// <param name="isOverWrite">是否可以覆盖</param>
+        public static void Copy(string sourcePath, string targetPath, string newName, bool isOverWrite = true)
+        {
+            File.Copy(MapPath(sourcePath), MapPath(targetPath) + newName, isOverWrite);
+        }
+
+        #endregion
+
+        #region 移动文件
+
+        /// <summary>
+        /// 移动文件到目标目录
+        /// </summary>
+        /// <param name="sourcePath">源文件</param>
+        /// <param name="targetPath">目标目录</param>
+        public static void Move(string sourcePath, string targetPath)
+        {
+            string sourceFileName = GetFileName(sourcePath);
+            //如果目标目录不存在则创建
+            if (IsExist(targetPath))
+            {
+                CreateFiles(targetPath);
+            }
+            else
+            {
+                //如果目标目录存在同名文件则删除
+                if (IsExist(Path.Combine(MapPath(targetPath), sourceFileName)))
+                {
+                    DeleteFiles(Path.Combine(MapPath(targetPath), sourceFileName));
+                }
+            }
+
+            File.Move(MapPath(sourcePath), Path.Combine(MapPath(targetPath), sourceFileName));
+
+
+        }
+
+        #endregion
+
+        /// <summary>
+        /// 获取文件名和扩展名
+        /// </summary>
+        /// <param name="path">文件路径</param>
+        /// <returns></returns>
+        public static string GetFileName(string path)
+        {
+            return Path.GetFileName(MapPath(path));
+        }
+
+        /// <summary>
+        /// 获取文件名不带扩展名
+        /// </summary>
+        /// <param name="path">文件路径</param>
+        /// <returns></returns>
+        public static string GetFileNameWithOutExtension(string path)
+        {
+            return Path.GetFileNameWithoutExtension(MapPath(path));
+        }
+
+        /// <summary>
+        /// 获取文件扩展名
+        /// </summary>
+        /// <param name="path">文件路径</param>
+        /// <returns></returns>
+        public static string GetFileExtension(string path)
+        {
+            return Path.GetExtension(MapPath(path));
+        }
+
+        #endregion
+
+        #region 获取文件绝对路径
+
+        /// <summary>
+        /// 获取文件绝对路径
+        /// </summary>
+        /// <param name="path">文件路径</param>
+        /// <returns></returns>
+        public static string MapPath(string path)
+        {
+            return Path.Combine(_ContentRootPath, path.TrimStart('~', '/').Replace("/", DirectorySeparatorChar));
+        }
+        /// <summary>
+        /// 获取文件绝对路径(异步方式)
+        /// </summary>
+        /// <param name="path">文件路径</param>
+        /// <returns></returns>
+        public static async Task<string> MapPathAsync(string path)
+        {
+            return await Task.Run(() => Path.Combine(_ContentRootPath, path.TrimStart('~', '/').Replace("/", DirectorySeparatorChar)));
+        }
+
+
+        /// <summary>
+        /// 是否为目录或文件夹
+        /// </summary>
+        /// <param name="path">路径</param>
+        /// <returns></returns>
+        public static bool IsDirectory(string path)
+        {
+            if (path.EndsWith(DirectorySeparatorChar))
+                return true;
+            else
+                return false;
+        }
+
+        #endregion
+
+        #region 物理路径转虚拟路径
+        public static string PhysicalToVirtual(string physicalPath)
+        {
+            return physicalPath.Replace(_ContentRootPath, "").Replace(DirectorySeparatorChar, "/");
+        }
+        #endregion
+
+        #region 文件格式
+        /// <summary>
+        /// 是否可添加水印
+        /// </summary>
+        /// <param name="_fileExt">文件扩展名,不含“.”</param>
+        /// <returns></returns>
+        public static bool IsCanWater(string _fileExt)
+        {
+            var images = new List<string> { "jpg", "jpeg" };
+            if (images.Contains(_fileExt.ToLower())) return true;
+            return false;
+        }
+        /// <summary>
+        /// 是否为图片
+        /// </summary>
+        /// <param name="_fileExt">文件扩展名,不含“.”</param>
+        /// <returns></returns>
+        public static bool IsImage(string _fileExt)
+        {
+            var images = new List<string> { "bmp", "gif", "jpg", "jpeg", "png" };
+            if (images.Contains(_fileExt.ToLower())) return true;
+            return false;
+        }
+        /// <summary>
+        /// 是否为视频
+        /// </summary>
+        /// <param name="_fileExt">文件扩展名,不含“.”</param>
+        /// <returns></returns>
+        public static bool IsVideos(string _fileExt)
+        {
+            var videos = new List<string> { "rmvb", "mkv", "ts", "wma", "avi", "rm", "mp4", "flv", "mpeg", "mov", "3gp", "mpg" };
+            if (videos.Contains(_fileExt.ToLower())) return true;
+            return false;
+        }
+        /// <summary>
+        /// 是否为音频
+        /// </summary>
+        /// <param name="_fileExt">文件扩展名,不含“.”</param>
+        /// <returns></returns>
+        public static bool IsMusics(string _fileExt)
+        {
+            var musics = new List<string> { "mp3", "wav" };
+            if (musics.Contains(_fileExt.ToLower())) return true;
+            return false;
+        }
+        /// <summary>
+        /// 是否为文档
+        /// </summary>
+        /// <param name="_fileExt">文件扩展名,不含“.”</param>
+        /// <returns></returns>
+        public static bool IsDocument(string _fileExt)
+        {
+            var documents = new List<string> { "doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "pdf" };
+            if (documents.Contains(_fileExt.ToLower())) return true;
+            return false;
+        }
+        #endregion
+
+        #region 文件图标
+        public static string FindFileIcon(string fileExt)
+        {
+            if (IsImage(fileExt))
+                return "fa fa-image";
+            if (IsVideos(fileExt))
+                return "fa fa-film";
+            if (IsMusics(fileExt))
+                return "fa fa-music";
+            if (IsDocument(fileExt))
+                switch (fileExt.ToLower())
+                {
+                    case ".xls":
+                    case ".xlsx":
+                        return "fa fa-file-excel-o";
+                    case ".ppt":
+                    case ".pptx":
+                        return "fa fa-file-powerpoint-o";
+                    case ".pdf":
+                        return "fa fa-file-pdf-o";
+                    case ".txt":
+                        return "fa fa-file-text-o";
+                    default:
+                        return "fa fa-file-word-o";
+                }
+            if (fileExt.ToLower() .Equals( "zip") || fileExt.ToLower().Equals("rar)"))
+                return "fa fa-file-zip-o";
+            else
+                return "fa fa-file";
+        }
+        #endregion
+
+        #region 文件大小转换
+        /// <summary>
+        ///  文件大小转为B、KB、MB、GB...
+        /// </summary>
+        /// <param name="size"></param>
+        /// <returns></returns>
+        public static string FileSizeTransf(long size)
+        {
+            String[] units = new String[] { "B", "KB", "MB", "GB", "TB", "PB" };
+            long mod = 1024;
+            int i = 0;
+            while (size > mod)
+            {
+                size /= mod;
+                i++;
+            }
+            return size + units[i];
+
+        }
+        #endregion
+
+        #region 获取目录下所有文件
+        public static List<FilesInfo> FindFiles(string path, string staticFiles = "/wwwroot")
+        {
+            string[] folders = Directory.GetDirectories(MapPath(path), "*", SearchOption.AllDirectories);
+            var Files = new List<FilesInfo>();
+
+            foreach (var folder in folders)
+            {
+                foreach (var fsi in new DirectoryInfo(folder).GetFiles())
+                {
+                    Files.Add(new FilesInfo()
+                    {
+                        Name = fsi.Name,
+                        FullName = fsi.FullName,
+                        FileExt = fsi.Extension,
+                        FileOriginalSize = fsi.Length,
+                        FileSize = FileSizeTransf(fsi.Length),
+                        FileIcon = FindFileIcon(fsi.Extension.Remove(0, 1)),
+                        FileName = PhysicalToVirtual(fsi.FullName).Replace(staticFiles, ""),
+                        FileStyle = IsImage(fsi.Extension.Remove(0, 1)) ? "images" :
+                                    IsDocument(fsi.Extension.Remove(0, 1)) ? "documents" :
+                                    IsVideos(fsi.Extension.Remove(0, 1)) ? "videos" :
+                                    IsMusics(fsi.Extension.Remove(0, 1)) ? "musics" : "others",
+                        CreateDate = fsi.CreationTime,
+                        LastWriteDate = fsi.LastWriteTime,
+                        LastAccessDate = fsi.LastAccessTime
+                    });
+                }
+            }
+            return Files;
+        }
+
+        /// <summary>
+        /// 获得指定文件夹下面的所有文件
+        /// </summary>
+        /// <param name="path"></param>
+        /// <param name="staticFiles"></param>
+        /// <returns></returns>
+        public static List<FilesInfo> ResolveFileInfo(string path, string staticFiles = "/wwwroot")
+        {
+            var foldersPath = MapPath(path);
+            var Files = new List<FilesInfo>();
+            foreach (var fsi in new DirectoryInfo(foldersPath).GetFiles())
+            {
+                Files.Add(new FilesInfo()
+                {
+                    Name = fsi.Name,
+                    FullName = fsi.FullName,
+                    FileExt = fsi.Extension,
+                    FileOriginalSize = fsi.Length,
+                    FileSize = FileSizeTransf(fsi.Length),
+                    FileIcon = FindFileIcon(fsi.Extension.Remove(0, 1)),
+                    FileName = PhysicalToVirtual(fsi.FullName).Replace(staticFiles, ""),
+                    FileStyle = IsImage(fsi.Extension.Remove(0, 1)) ? "images" :
+                                IsDocument(fsi.Extension.Remove(0, 1)) ? "documents" :
+                                IsVideos(fsi.Extension.Remove(0, 1)) ? "videos" :
+                                IsMusics(fsi.Extension.Remove(0, 1)) ? "musics" : "others",
+                    CreateDate = fsi.CreationTime,
+                    LastWriteDate = fsi.LastWriteTime,
+                    LastAccessDate = fsi.LastAccessTime
+                });
+            }
+            return Files;
+        }
+        #endregion
+
+    }
+
+    public class FilesInfo
+    {
+        /// <summary>
+        /// 文件名称
+        /// </summary>
+        public string Name { get; set; }
+        /// <summary>
+        /// 文件物理路径
+        /// </summary>
+        public string FullName { get; set; }
+        /// <summary>
+        /// 扩展名
+        /// </summary>
+        public string FileExt { get; set; }
+        /// <summary>
+        /// 原始大小(字节)
+        /// </summary>
+        public long FileOriginalSize { get; set; }
+        /// <summary>
+        /// 文件大小
+        /// </summary>
+        public string FileSize { get; set; }
+        /// <summary>
+        /// 文件虚拟路径
+        /// </summary>
+        public string FileName { get; set; }
+        /// <summary>
+        /// 文件类型
+        /// </summary>
+        public string FileStyle { get; set; }
+        /// <summary>
+        /// 文件图标
+        /// </summary>
+        public string FileIcon { get; set; }
+        /// <summary>
+        /// 创建时间
+        /// </summary>
+        public DateTime CreateDate { get; set; }
+        /// <summary>
+        /// 最后修改时间
+        /// </summary>
+        public DateTime LastWriteDate { get; set; }
+        /// <summary>
+        /// 最后访问时间
+        /// </summary>
+        public DateTime LastAccessDate { get; set; }
+
+    }
+}

+ 38 - 0
TEAMModelOS.SDK/Helper/Common/JsonHelper/ClassSerializers.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Helper.Common.JsonHelper
+{
+    /// <summary>
+    ///   对象与二进制流的互相转换。
+    /// </summary>
+    public class ClassSerializers
+    {
+        #region 对象与二进制流的互相转换
+        /// <summary>
+        ///   将对象流转换成二进制流
+        /// </summary>
+        public static MemoryStream SerializeBinary(object request) //将对象流转换成二进制流
+        {
+            BinaryFormatter serializer = new BinaryFormatter();
+            MemoryStream memStream = new MemoryStream(); //创建一个内存流存储区
+            serializer.Serialize(memStream, request); //将对象序列化为内存流中
+            return memStream;
+        }
+        /// <summary>
+        ///   将二进制流转换成对象
+        /// </summary>
+        public static object DeSerializeBinary(MemoryStream memStream) //将二进制流转换成对象
+        {
+            memStream.Position = 0;
+            BinaryFormatter deserializer = new BinaryFormatter();
+            object newobj = deserializer.Deserialize(memStream); //将内存流反序列化为对象
+            memStream.Close(); //关闭内存流,并释放
+            return newobj;
+        }
+        #endregion
+    }
+}

+ 206 - 0
TEAMModelOS.SDK/Helper/Common/JsonHelper/JsonSerialization.cs

@@ -0,0 +1,206 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Helper.Common.JsonHelper
+{
+    public static class JsonSerialization
+    {
+        static JsonSerializerSettings settings = new JsonSerializerSettings()
+        {
+            ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
+            PreserveReferencesHandling = PreserveReferencesHandling.None
+        };
+
+        /// <summary>
+        /// 使用json序列化为字符串
+        /// </summary>
+        /// <param name="dateTimeFormat">默认null,即使用json.net默认的序列化机制,如:"\/Date(1439335800000+0800)\/"</param>
+        /// <returns></returns>
+        public static string ToJson(this object input, string dateTimeFormat = "yyyy-MM-dd HH:mm:ss", bool ignoreNullValue = true, bool isIndented = false)
+        {
+            settings.NullValueHandling = ignoreNullValue ? Newtonsoft.Json.NullValueHandling.Ignore : NullValueHandling.Include;
+
+            if (!string.IsNullOrWhiteSpace(dateTimeFormat))
+            {
+                var jsonConverter = new List<JsonConverter>()
+                {
+                    new Newtonsoft.Json.Converters.IsoDateTimeConverter(){ DateTimeFormat = dateTimeFormat }//如: "yyyy-MM-dd HH:mm:ss"
+                };
+                settings.Converters = jsonConverter;
+            }
+
+            //no format
+            var format = isIndented ? Newtonsoft.Json.Formatting.Indented : Formatting.None;
+            var json = JsonConvert.SerializeObject(input, format, settings);
+            return json;
+        }
+        /// <summary>
+        /// 使用json序列化为字符串
+        /// </summary>
+        /// <param name="dateTimeFormat">默认null,即使用json.net默认的序列化机制,如:"\/Date(1439335800000+0800)\/"</param>
+        /// <returns></returns>
+        public static string ToJsonAbs(this object input, string dateTimeFormat = "yyyy-MM-dd HH:mm:ss", bool ignoreNullValue = true, bool isIndented = false)
+        {
+
+            settings = new JsonSerializerSettings
+            {
+                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
+                TypeNameHandling = TypeNameHandling.All
+            };
+            settings.NullValueHandling = ignoreNullValue ? Newtonsoft.Json.NullValueHandling.Ignore : NullValueHandling.Include;
+
+            if (!string.IsNullOrWhiteSpace(dateTimeFormat))
+            {
+                var jsonConverter = new List<JsonConverter>()
+                {
+                    new Newtonsoft.Json.Converters.IsoDateTimeConverter(){ DateTimeFormat = dateTimeFormat }//如: "yyyy-MM-dd HH:mm:ss"
+                };
+                settings.Converters = jsonConverter;
+            }
+
+            //no format
+            var format = isIndented ? Newtonsoft.Json.Formatting.Indented : Formatting.None;
+            var json = JsonConvert.SerializeObject(input, format, settings);
+            return json;
+        }
+        /// <summary>
+        /// 从序列化字符串里反序列化
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="input"></param>
+        /// <param name="dateTimeFormat">默认null,即使用json.net默认的序列化机制</param>
+        /// <returns></returns>
+        public static T FromJsonAbs<T>(this string input, string dateTimeFormat = "yyyy-MM-dd HH:mm:ss", bool ignoreNullValue = true)
+        {
+            var settings = new JsonSerializerSettings()
+            {
+                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
+                PreserveReferencesHandling = PreserveReferencesHandling.Objects,
+                TypeNameHandling = TypeNameHandling.All
+            };
+            settings.NullValueHandling = ignoreNullValue ? Newtonsoft.Json.NullValueHandling.Ignore : NullValueHandling.Include;
+
+            if (!string.IsNullOrWhiteSpace(dateTimeFormat))
+            {
+                var jsonConverter = new List<JsonConverter>()
+                {
+                    new Newtonsoft.Json.Converters.IsoDateTimeConverter(){ DateTimeFormat = dateTimeFormat }//如: "yyyy-MM-dd HH:mm:ss"
+                };
+                settings.Converters = jsonConverter;
+            }
+
+            return JsonConvert.DeserializeObject<T>(input, settings);
+        }
+        /// <summary>
+        /// 从序列化字符串里反序列化
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="input"></param>
+        /// <param name="dateTimeFormat">默认null,即使用json.net默认的序列化机制</param>
+        /// <returns></returns>
+        public static T TryFromJson<T>(this string input, string dateTimeFormat = "yyyy-MM-dd HH:mm:ss", bool ignoreNullValue = true)
+        {
+            try
+            {
+                return input.FromJson<T>(dateTimeFormat, ignoreNullValue);
+            }
+            catch
+            {
+                return default(T);
+            }
+        }
+
+
+        /// <summary>
+        /// 从字典获取对象
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="input"></param>
+        /// <param name="dateTimeFormat">默认null,即使用json.net默认的序列化机制</param>
+        /// <returns></returns>
+        public static T DictToObj<T>(this Dictionary<string,object> dict, string dateTimeFormat = "yyyy-MM-dd HH:mm:ss", bool ignoreNullValue = true)
+        {
+            try
+            {
+                string input= ToJson(dict);
+                return input.FromJson<T>(dateTimeFormat, ignoreNullValue);
+            }
+            catch
+            {
+                return default(T);
+            }
+        }
+        /// <summary>
+        /// 从对象获取字典
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <param name="dateTimeFormat"></param>
+        /// <param name="ignoreNullValue"></param>
+        /// <returns></returns>
+        public static Dictionary<string ,object> ObjToDict(this object obj, string dateTimeFormat = "yyyy-MM-dd HH:mm:ss", bool ignoreNullValue = true)
+        {
+            string input = ToJson(obj);
+            return input.FromJson<Dictionary<string, object>>(dateTimeFormat, ignoreNullValue);
+        }
+
+        /// <summary>
+        /// 从序列化字符串里反序列化
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="input"></param>
+        /// <param name="dateTimeFormat">默认null,即使用json.net默认的序列化机制</param>
+        /// <returns></returns>
+        public static T FromJson<T>(this string input, string dateTimeFormat = "yyyy-MM-dd HH:mm:ss", bool ignoreNullValue = true)
+        {
+            var settings = new JsonSerializerSettings()
+            {
+                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
+                PreserveReferencesHandling = PreserveReferencesHandling.Objects,
+            };
+            settings.NullValueHandling = ignoreNullValue ? Newtonsoft.Json.NullValueHandling.Ignore : NullValueHandling.Include;
+
+            if (!string.IsNullOrWhiteSpace(dateTimeFormat))
+            {
+                var jsonConverter = new List<JsonConverter>()
+                {
+                    new Newtonsoft.Json.Converters.IsoDateTimeConverter(){ DateTimeFormat = dateTimeFormat }//如: "yyyy-MM-dd HH:mm:ss"
+                };
+                settings.Converters = jsonConverter;
+            }
+
+            return JsonConvert.DeserializeObject<T>(input, settings);
+        }
+        /// <summary>
+        /// 从序列化字符串里反序列化
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="input"></param>
+        /// <param name="dateTimeFormat">默认null,即使用json.net默认的序列化机制</param>
+        /// <returns></returns>
+        public static object FromJson(this string input, Type type, string dateTimeFormat = "yyyy-MM-dd HH:mm:ss", bool ignoreNullValue = true)
+        {
+            var settings = new JsonSerializerSettings()
+            {
+                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
+                PreserveReferencesHandling = PreserveReferencesHandling.Objects,
+            };
+            if (ignoreNullValue)
+            {
+                settings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
+            }
+
+            if (!string.IsNullOrWhiteSpace(dateTimeFormat))
+            {
+                var jsonConverter = new List<JsonConverter>()
+                {
+                    new Newtonsoft.Json.Converters.IsoDateTimeConverter(){ DateTimeFormat = dateTimeFormat }//如: "yyyy-MM-dd HH:mm:ss"
+                };
+                settings.Converters = jsonConverter;
+            }
+
+            return JsonConvert.DeserializeObject(input, type, settings);
+        }
+    }
+}

+ 35 - 0
TEAMModelOS.SDK/Helper/Common/ReflectorExtensions/ReflectorExtensions.cs

@@ -0,0 +1,35 @@
+using AspectCore.Extensions.Reflection;
+using System;
+using System.Reflection;
+
+namespace TEAMModelOS.SDK.Helper.Common.ReflectorExtensions
+{
+    public static class ReflectorExtensions
+    {
+        public static T GetPropertyValue<T>(this object obj, string name, BindingFlags bindingFlags) where T : class
+        {
+            var chProperty = obj.GetType().GetTypeInfo().GetProperty(name, bindingFlags);
+            var chReflector = chProperty.GetReflector();
+            var value = chReflector.GetValue(obj) as T;
+
+            return value;
+        }
+
+        public static Tuple<T, FieldInfo> GetFieldValue<T>(this object obj, string name, BindingFlags bindingFlags) where T : class
+        {
+            var chField = obj.GetType().GetTypeInfo().GetField(name, bindingFlags);
+            var chReflector = chField.GetReflector();
+            var value = chReflector.GetValue(obj) as T;
+
+            return Tuple.Create(value, chField);
+        }
+
+        public static T GetFieldValue<T>(this Type type, string name, BindingFlags bindingFlags) where T : class
+        {
+            var chField = type.GetTypeInfo().GetField(name, bindingFlags);
+            var chReflector = chField.GetReflector();
+            var value = chReflector.GetValue(null) as T;
+            return value;
+        }
+    }
+}

+ 36 - 0
TEAMModelOS.SDK/Helper/Common/StringHelper/BufferHelper.cs

@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Helper.Common.StringHelper
+{
+    public class BufferHelper
+    {
+        public static byte[] BufferMerge(byte[] first, byte[] last) {
+            int len = first.Length + last.Length;
+            byte[] lenArr = BitConverter.GetBytes(len);
+            if (BitConverter.IsLittleEndian) {
+                Array.Reverse(lenArr);
+            }
+            byte[] resArr = new byte[lenArr.Length + first.Length + last.Length];
+            lenArr.CopyTo(resArr, 0);
+            first.CopyTo(resArr, lenArr.Length);
+            last.CopyTo(resArr, first.Length);
+            return resArr;
+        }
+
+        public static Stream StreamMerge(Stream streamA, Stream streamB) {
+            byte[] bufferA = new byte[streamA.Length];
+            byte[] bufferB = new byte[streamB.Length];
+            streamA.Read(bufferA, 0, bufferA.Length);
+            streamA.Seek(0, SeekOrigin.Begin);
+            streamB.Read(bufferB, 0, bufferB.Length);
+            streamB.Seek(0, SeekOrigin.Begin);
+            byte [] buffer= BufferMerge(bufferA, bufferB);
+            Stream stream = new MemoryStream(buffer);
+            return stream;
+
+        }
+    }
+}

+ 85 - 0
TEAMModelOS.SDK/Helper/Common/StringHelper/HtmlHelper.cs

@@ -0,0 +1,85 @@
+using HtmlAgilityPack;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.RegularExpressions;
+using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
+
+namespace TEAMModelOS.SDK.Helper.Common.StringHelper
+{
+    public class HtmlHelper
+    {
+        public static string DoUselessTag(string str)
+        {
+            if (str.StartsWith("</p>"))
+            {
+                str = str.Substring(4);
+            }
+            if (str.EndsWith("<p>"))
+            {
+                str = str.Substring(0, str.Length - 1 - 2);
+            }
+            if (str.EndsWith("<p >"))
+            {
+                str = str.Substring(0, str.Length - 1 - 3);
+            }
+            if (str.EndsWith("<p  >"))
+            {
+                str = str.Substring(0, str.Length - 1 - 4);
+            }
+            if (str.StartsWith("<p >") && !str.Contains("</p>"))
+            {
+                str = str.Replace("<p >", "");
+            }
+            if (str.StartsWith("<p  >") && !str.Contains("</p>"))
+            {
+                str = str.Replace("<p  >", "");
+            }
+            if (str.StartsWith("<p>") && !str.Contains("</p>"))
+            {
+                str = str.Replace("<p>", "");
+            }
+            if (str.EndsWith("</p>") && !str.Contains("<p>")&& !str.Contains("<p >") && !str.Contains("<p  >")){
+                str = str.Replace("</p>", "");
+            }
+
+            return str;
+        }
+
+        /// <summary>
+        /// 从html获取文本及img的url  去掉其他标签的干扰,空格。以获取更准确的sha1校验值
+        /// </summary>
+        /// <param name="html"></param>
+        /// <returns></returns>
+        public static string DoTextImg(string html)
+        {
+            HtmlDocument doc = new HtmlDocument();
+            doc.LoadHtml(html);
+            List<string> urls = GetHtmlImageUrlList(html);
+            StringBuilder builder = new StringBuilder(doc.DocumentNode.InnerText.Replace("&nbsp;", ""));
+            if (urls.IsNotEmpty())
+            {
+                foreach (string url in urls)
+                {
+                    builder.Append(url);
+                }
+            }
+            return builder.ToString();
+        }
+
+        public static List<string> GetHtmlImageUrlList(string sHtmlText)
+        {
+            // 定义正则表达式用来匹配 img 标签   
+            Regex regImg = new Regex(@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>", RegexOptions.IgnoreCase);
+
+            // 搜索匹配的字符串   
+            MatchCollection matches = regImg.Matches(sHtmlText);
+            //string[] sUrlList = new string[matches.Count];
+            List<string> urls = new List<string>();
+            // 取得匹配项列表   
+            foreach (Match match in matches)
+                urls.Add(match.Groups["imgUrl"].Value);
+            return urls;
+        }
+    }
+}

+ 121 - 0
TEAMModelOS.SDK/Helper/Common/StringHelper/StringHelper.cs

@@ -0,0 +1,121 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Helper.Common.StringHelper
+{
+    public class StringHelper
+    {
+        #region 截取字符串
+        public static string GetSubString(string pSrcString, int pLength, string pTailString)
+        {
+            return GetSubString(pSrcString, 0, pLength, pTailString);
+        }
+        public static string GetSubString(string pSrcString, int pStartIndex, int pLength, string pTailString)
+        {
+            string str = pSrcString;
+            byte[] bytes = Encoding.UTF8.GetBytes(pSrcString);
+            foreach (char ch in Encoding.UTF8.GetChars(bytes))
+            {
+                if (((ch > 'ࠀ') && (ch < '一')) || ((ch > 0xac00) && (ch < 0xd7a3)))
+                {
+                    if (pStartIndex >= pSrcString.Length)
+                    {
+                        return "";
+                    }
+                    return pSrcString.Substring(pStartIndex, ((pLength + pStartIndex) > pSrcString.Length) ? (pSrcString.Length - pStartIndex) : pLength);
+                }
+            }
+            if (pLength < 0)
+            {
+                return str;
+            }
+            byte[] sourceArray = Encoding.Default.GetBytes(pSrcString);
+            if (sourceArray.Length <= pStartIndex)
+            {
+                return str;
+            }
+            int length = sourceArray.Length;
+            if (sourceArray.Length > (pStartIndex + pLength))
+            {
+                length = pLength + pStartIndex;
+            }
+            else
+            {
+                pLength = sourceArray.Length - pStartIndex;
+                pTailString = "";
+            }
+            int num2 = pLength;
+            int[] numArray = new int[pLength];
+            byte[] destinationArray = null;
+            int num3 = 0;
+            for (int i = pStartIndex; i < length; i++)
+            {
+                if (sourceArray[i] > 0x7f)
+                {
+                    num3++;
+                    if (num3 == 3)
+                    {
+                        num3 = 1;
+                    }
+                }
+                else
+                {
+                    num3 = 0;
+                }
+                numArray[i] = num3;
+            }
+            if ((sourceArray[length - 1] > 0x7f) && (numArray[pLength - 1] == 1))
+            {
+                num2 = pLength + 1;
+            }
+            destinationArray = new byte[num2];
+            Array.Copy(sourceArray, pStartIndex, destinationArray, 0, num2);
+            return (Encoding.Default.GetString(destinationArray) + pTailString);
+        }
+        #endregion
+
+        /// <summary>
+        /// 将字符串转换为int类型数组
+        /// </summary>
+        /// <param name="str">如1,2,3,4,5</param>
+        /// <returns></returns>
+        public static List<string> StrToListString(string str)
+        {
+            var list = new List<string>();
+            if (!str.Contains(","))
+            {
+                list.Add(str);
+                return list;
+            }
+            var slist = str.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+            foreach (var item in slist)
+            {
+                list.Add(item);
+            }
+            return list;
+        }
+
+        /// <summary>
+        /// 截取两个字符串中间的字符串
+        /// </summary>
+        /// <param name="sourse"></param>
+        /// <param name="startstr"></param>
+        /// <param name="endstr"></param>
+        /// <returns></returns>
+        public static string SubMidString(string sourse, string startstr, string endstr)
+        {
+            string result = string.Empty;
+            int startindex, endindex;
+            startindex = sourse.IndexOf(startstr);
+            if (startindex == -1)
+                return result;
+            string tmpstr = sourse.Substring(startindex + startstr.Length);
+            endindex = tmpstr.IndexOf(endstr);
+            if (endindex == -1)
+                return result;
+            result = tmpstr.Remove(endindex);
+            return result;
+        }
+    }
+}

+ 65 - 0
TEAMModelOS.SDK/Helper/Common/ValidateHelper/ValidateHelper.cs

@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel.DataAnnotations;
+
+namespace TEAMModelOS.SDK.Helper.Common.ValidateHelper
+{
+    public static class ValidateHelper
+    {
+        public static string AllowCountry { get; set; }
+        /// <summary>
+        /// 验证对象是否有效
+        /// </summary>
+        /// <param name="obj">要验证的对象</param>
+        /// <param name="validationResults"></param>
+        /// <returns></returns>
+        public static bool IsValid(this object obj, Collection<ValidationResult> validationResults)
+        {
+            return Validator.TryValidateObject(obj, new ValidationContext(obj, null, null), validationResults, true);
+        }
+
+        /// <summary>
+        /// 验证对象是否有效
+        /// </summary>
+        /// <param name="obj">要验证的对象</param>
+        /// <returns></returns>
+        public static T ValidObj<T>(T value)
+        {
+            var results = new Collection<ValidationResult>();
+            var validationContext = new ValidationContext(value, null, null);
+            bool f = Validator.TryValidateObject(value, validationContext, results, true);
+            if (f)
+            {
+                return value;
+            }
+            else
+            {
+                return default(T);
+            }
+        }
+        /// <summary>
+        /// 验证对象是否有效
+        /// </summary>
+        /// <param name="obj">要验证的对象</param>
+        /// <returns></returns>
+        public static bool IsValid(object value)
+        {
+            var results = new Collection<ValidationResult>();
+            var validationContext = new ValidationContext(value, null, null);
+            bool f = Validator.TryValidateObject(value, validationContext, results, true);
+            if (!f)
+            {
+                string s = "";
+                foreach (ValidationResult result in results)
+                {
+                    IEnumerator<string> enumerator = result.MemberNames.GetEnumerator();
+                    enumerator.MoveNext();
+                    s = s + enumerator.Current + ",";
+                }
+                throw new Exception(s + "字段不正确");
+            }
+            return f;
+        }
+    }
+}

+ 17 - 0
TEAMModelOS.SDK/Helper/Common/WMFConverter/Gdi/BrushDIBColorsEnum.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// DIB-Colors enum.
+    /// </summary>
+    public enum BrushDIBColorsEnum
+    {
+        DIB_PAL_COLORS = 1,
+        DIB_RGB_COLORS = 0,
+    }
+}

+ 24 - 0
TEAMModelOS.SDK/Helper/Common/WMFConverter/Gdi/BrushEnum.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Brush enum.
+    /// </summary>
+    public enum BrushBSEnum
+    {
+        BS_DIBPATTERN = 5,
+        BS_DIBPATTERN8X8 = 8,
+        BS_DIBPATTERNPT = 6,
+        BS_HATCHED = 2,
+        BS_HOLLOW = 1,
+        BS_NULL = 1,
+        BS_PATTERN = 3,
+        BS_PATTERN8X8 = 7,
+        BS_SOLID = 0,
+    }
+}

+ 21 - 0
TEAMModelOS.SDK/Helper/Common/WMFConverter/Gdi/BrushHSEnum.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// HS Brush enum
+    /// </summary>
+    public enum BrushHSEnum
+    {
+        HS_HORIZONTAL = 0,
+        HS_VERTICAL = 1,
+        HS_FDIAGONAL = 2,
+        HS_BDIAGONAL = 3,
+        HS_CROSS = 4,
+        HS_DIAGCROSS = 5,
+    }
+}

+ 34 - 0
TEAMModelOS.SDK/Helper/Common/WMFConverter/Gdi/FontCharsetEnum.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Charset Enum
+    /// </summary>
+    public enum FontCharsetEnum
+    {
+        ANSI_CHARSET = 0,
+        DEFAULT_CHARSET = 1,
+        SYMBOL_CHARSET = 2,
+        MAC_CHARSET = 77,
+        SHIFTJIS_CHARSET = 128,
+        HANGUL_CHARSET = 129,
+        JOHAB_CHARSET = 130,
+        GB2312_CHARSET = 134,
+        CHINESEBIG5_CHARSET = 136,
+        GREEK_CHARSET = 161,
+        TURKISH_CHARSET = 162,
+        VIETNAMESE_CHARSET = 163,
+        ARABIC_CHARSET = 178,
+        HEBREW_CHARSET = 177,
+        BALTIC_CHARSET = 186,
+        RUSSIAN_CHARSET = 204,
+        THAI_CHARSET = 222,
+        EASTEUROPE_CHARSET = 238,
+        OEM_CHARSET = 255,
+    }
+}

+ 0 - 0
TEAMModelOS.SDK/Helper/Common/WMFConverter/Gdi/FontClipPrecisEnum.cs


Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio