diff --git a/Gdsi-Api.sln b/Gdsi-Api.sln new file mode 100644 index 0000000..ccc4211 --- /dev/null +++ b/Gdsi-Api.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32414.318 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gdsi-Api", "Gdsi-Api\Gdsi-Api.csproj", "{0C4B9C63-E986-4C9F-9209-1678978D0762}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gdsi", "Gdsi\Gdsi.csproj", "{3EF3A083-5F36-436A-B87E-2D0964CAAD7C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0C4B9C63-E986-4C9F-9209-1678978D0762}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C4B9C63-E986-4C9F-9209-1678978D0762}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C4B9C63-E986-4C9F-9209-1678978D0762}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C4B9C63-E986-4C9F-9209-1678978D0762}.Release|Any CPU.Build.0 = Release|Any CPU + {3EF3A083-5F36-436A-B87E-2D0964CAAD7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3EF3A083-5F36-436A-B87E-2D0964CAAD7C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3EF3A083-5F36-436A-B87E-2D0964CAAD7C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3EF3A083-5F36-436A-B87E-2D0964CAAD7C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4CD08079-A8CD-4295-A10B-DEBB4B2ADE30} + EndGlobalSection +EndGlobal diff --git a/Gdsi-Api/App_Start/RouteConfig.cs b/Gdsi-Api/App_Start/RouteConfig.cs new file mode 100644 index 0000000..e9f8e52 --- /dev/null +++ b/Gdsi-Api/App_Start/RouteConfig.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using System.Web.Routing; + +namespace Gdsi_Api +{ + public class RouteConfig + { + public static void RegisterRoutes(RouteCollection routes) + { + routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); + + routes.MapRoute( + name: "Default", + url: "{controller}/{action}/{id}", + defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } + ); + } + } +} diff --git a/Gdsi-Api/Controllers/HomeController.cs b/Gdsi-Api/Controllers/HomeController.cs new file mode 100644 index 0000000..11099de --- /dev/null +++ b/Gdsi-Api/Controllers/HomeController.cs @@ -0,0 +1,48 @@ +using Gdsi.Domain; +using Gdsi.Model; +using Gdsi_Api.Helper; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; + +namespace Gdsi_Api.Controllers +{ + public class HomeController : Controller + { + public string Index() + { + return "广东省医保平台接口!"; + } + + public ActionResult GetInfo(string qrCode) + { + var req = new + { + qrCode + }; + // 开始时间 + string beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + Info info = GdsiApi.api_1101(qrCode); + // 结束时间 + string endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + LogHelper.saveInfoLog("GetInfo", beginTime, endTime, toJson(req), toJson(info)); + return Json(info); + } + + #region Tool + /// + /// 对象转Json字符串 + /// + /// 对象 + /// + private string toJson(object obj) + { + return JsonConvert.SerializeObject(obj); + } + #endregion + + } +} \ No newline at end of file diff --git a/Gdsi-Api/Gdsi-Api.csproj b/Gdsi-Api/Gdsi-Api.csproj new file mode 100644 index 0000000..aa7f5c3 --- /dev/null +++ b/Gdsi-Api/Gdsi-Api.csproj @@ -0,0 +1,205 @@ + + + + + + Debug + AnyCPU + + + 2.0 + {0C4B9C63-E986-4C9F-9209-1678978D0762} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Gdsi_Api + Gdsi-Api + v4.5 + false + true + + + + + + + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + true + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + + ..\packages\NLog.4.7.15\lib\net45\NLog.dll + + + + + + + + + + + + + + + + + + + + + + + + + True + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + + + + + + + True + ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll + + + True + ..\packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\System.Web.Mvc.dll + + + ..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll + + + True + ..\packages\Microsoft.AspNet.Razor.3.2.7\lib\net45\System.Web.Razor.dll + + + True + ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.dll + + + True + ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Deployment.dll + + + True + ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll + + + ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll + + + True + ..\packages\WebGrease.1.6.0\lib\WebGrease.dll + + + True + ..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll + + + + + ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll + + + + + + + Global.asax + + + + + + + + + + Web.config + + + Web.config + + + + + + + + + PreserveNewest + + + Designer + + + + + + {3ef3a083-5f36-436a-b87e-2d0964caad7c} + Gdsi + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + + + + True + True + 51665 + / + http://localhost:51665/ + False + False + + + False + + + + + + + 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 + + + + + \ No newline at end of file diff --git a/Gdsi-Api/Global.asax b/Gdsi-Api/Global.asax new file mode 100644 index 0000000..cfaa4d2 --- /dev/null +++ b/Gdsi-Api/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="Gdsi_Api.MvcApplication" Language="C#" %> diff --git a/Gdsi-Api/Global.asax.cs b/Gdsi-Api/Global.asax.cs new file mode 100644 index 0000000..6ef7c57 --- /dev/null +++ b/Gdsi-Api/Global.asax.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using System.Web.Optimization; +using System.Web.Routing; + +namespace Gdsi_Api +{ + public class MvcApplication : System.Web.HttpApplication + { + protected void Application_Start() + { + AreaRegistration.RegisterAllAreas(); + RouteConfig.RegisterRoutes(RouteTable.Routes); + } + } +} diff --git a/Gdsi-Api/Helper/LogHelper.cs b/Gdsi-Api/Helper/LogHelper.cs new file mode 100644 index 0000000..c234112 --- /dev/null +++ b/Gdsi-Api/Helper/LogHelper.cs @@ -0,0 +1,31 @@ +using NLog; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Gdsi_Api.Helper +{ + public class LogHelper + { + private static Logger infoLogger = NLog.LogManager.GetLogger("Info"); + + public static void saveInfoLog(string func, string beginTime, string endTime, string request, string response) + { + saveLog(infoLogger, func, beginTime, endTime, request, response); + } + + private static void saveLog(Logger logger, string func, string beginTime, string endTime, string request, string response) + { + string log = "\r\n" + "方法名:" + func + "\r\n"; + log += "开始时间:" + beginTime + "\r\n"; + log += "结束时间:" + endTime + "\r\n"; + log += "入参:" + "\r\n"; + log += "\t" + request + "\r\n"; + log += "返回:" + "\r\n"; + log += "\t" + response.Replace("\r\n", ""); + log += "\r\n"; + logger.Info(log); + } + } +} \ No newline at end of file diff --git a/Gdsi-Api/NLog.config b/Gdsi-Api/NLog.config new file mode 100644 index 0000000..0f2dda4 --- /dev/null +++ b/Gdsi-Api/NLog.config @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + diff --git a/Gdsi-Api/NLog.xsd b/Gdsi-Api/NLog.xsd new file mode 100644 index 0000000..d167472 --- /dev/null +++ b/Gdsi-Api/NLog.xsd @@ -0,0 +1,3728 @@ + + + + + + + + + + + + + + + Watch config file for changes and reload automatically. + + + + + Print internal NLog messages to the console. Default value is: false + + + + + Print internal NLog messages to the console error output. Default value is: false + + + + + Write internal NLog messages to the specified file. + + + + + Log level threshold for internal log messages. Default value is: Info. + + + + + Global log level threshold for application log messages. Messages below this level won't be logged. + + + + + Throw an exception when there is an internal error. Default value is: false. Not recommend to set to true in production! + + + + + Throw an exception when there is a configuration error. If not set, determined by throwExceptions. + + + + + Gets or sets a value indicating whether Variables should be kept on configuration reload. Default value is: false. + + + + + Write internal NLog messages to the System.Diagnostics.Trace. Default value is: false. + + + + + Write timestamps for internal NLog messages. Default value is: true. + + + + + Use InvariantCulture as default culture instead of CurrentCulture. Default value is: false. + + + + + Perform message template parsing and formatting of LogEvent messages (true = Always, false = Never, empty = Auto Detect). Default value is: empty. + + + + + + + + + + + + + + Make all targets within this section asynchronous (creates additional threads but the calling thread isn't blocked by any target writes). + + + + + + + + + + + + + + + + + Prefix for targets/layout renderers/filters/conditions loaded from this assembly. + + + + + Load NLog extensions from the specified file (*.dll) + + + + + Load NLog extensions from the specified assembly. Assembly name should be fully qualified. + + + + + + + + + + Filter on the name of the logger. May include wildcard characters ('*' or '?'). + + + + + Comma separated list of levels that this rule matches. + + + + + Minimum level that this rule matches. + + + + + Maximum level that this rule matches. + + + + + Level that this rule matches. + + + + + Comma separated list of target names. + + + + + Ignore further rules if this one matches. + + + + + Enable this rule. Note: disabled rules aren't available from the API. + + + + + Rule identifier to allow rule lookup with Configuration.FindRuleByName and Configuration.RemoveRuleByName. + + + + + + + + + + + + + + + Default action if none of the filters match. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the file to be included. You could use * wildcard. The name is relative to the name of the current config file. + + + + + Ignore any errors in the include file. + + + + + + + + Variable value. Note, the 'value' attribute has precedence over this one. + + + + + + Variable name. + + + + + Variable value. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Number of log events that should be processed in a batch by the lazy writer thread. + + + + + Whether to use the locking queue, instead of a lock-free concurrent queue The locking queue is less concurrent when many logger threads, but reduces memory allocation + + + + + Limit of full s to write before yielding into Performance is better when writing many small batches, than writing a single large batch + + + + + Action to be taken when the lazy writer thread request queue count exceeds the set limit. + + + + + Limit on the number of requests in the lazy writer thread request queue. + + + + + Time in milliseconds to sleep between batches. (1 or less means trigger on new activity) + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + + + Delay the flush until the LogEvent has been confirmed as written + + + + + Condition expression. Log events who meet this condition will cause a flush on the wrapped target. + + + + + Only flush when LogEvent matches condition. Ignore explicit-flush, config-reload-flush and shutdown-flush + + + + + Name of the target. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Number of log events to be buffered. + + + + + Timeout (in milliseconds) after which the contents of buffer will be flushed if there's no write in the specified period of time. Use -1 to disable timed flushes. + + + + + Action to take if the buffer overflows. + + + + + Indicates whether to use sliding timeout. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Encoding to be used. + + + + + Instance of that is used to format log messages. + + + + + End of line value if a newline is appended at the end of log message . + + + + + Maximum message size in bytes. + + + + + Indicates whether to append newline at the end of log message. + + + + + Get or set the SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. + + + + + Network address. + + + + + Size of the connection cache (number of connections which are kept alive). + + + + + The number of seconds a connection will remain idle before the first keep-alive probe is sent + + + + + Maximum queue size. + + + + + Maximum current connections. 0 = no maximum. + + + + + Action that should be taken if the will be more connections than . + + + + + Action that should be taken if the message is larger than maxMessageSize. + + + + + Indicates whether to keep connection open whenever possible. + + + + + NDLC item separator. + + + + + NDC item separator. + + + + + Indicates whether to include dictionary contents. + + + + + Indicates whether to include source info (file name and line number) in the information sent over the network. + + + + + Indicates whether to include NLog-specific extensions to log4j schema. + + + + + Indicates whether to include contents of the stack. + + + + + Indicates whether to include stack contents. + + + + + Indicates whether to include dictionary contents. + + + + + Indicates whether to include dictionary contents. + + + + + Option to include all properties from the log events + + + + + Indicates whether to include call site (class and method name) in the information sent over the network. + + + + + Option to include all properties from the log events + + + + + AppInfo field. By default it's the friendly name of the current AppDomain. + + + + + Renderer for log4j:event logger-xml-attribute (Default ${logger}) + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Layout that should be use to calculate the value for the parameter. + + + + + Viewer parameter name. + + + + + Whether an attribute with empty value should be included in the output + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Header. + + + + + Footer. + + + + + Indicates whether to auto-check if the console is available. - Disables console writing if Environment.UserInteractive = False (Windows Service) - Disables console writing if Console Standard Input is not available (Non-Console-App) + + + + + Enables output using ANSI Color Codes + + + + + The encoding for writing messages to the . + + + + + Indicates whether the error stream (stderr) should be used instead of the output stream (stdout). + + + + + Indicates whether to auto-flush after + + + + + Indicates whether to auto-check if the console has been redirected to file - Disables coloring logic when System.Console.IsOutputRedirected = true + + + + + Indicates whether to use default row highlighting rules. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Condition that must be met in order to set the specified foreground and background color. + + + + + Background color. + + + + + Foreground color. + + + + + + + + + + + + + + + + + Compile the ? This can improve the performance, but at the costs of more memory usage. If false, the Regex Cache is used. + + + + + Condition that must be met before scanning the row for highlight of words + + + + + Indicates whether to ignore case when comparing texts. + + + + + Regular expression to be matched. You must specify either text or regex. + + + + + Text to be matched. You must specify either text or regex. + + + + + Indicates whether to match whole words only. + + + + + Background color. + + + + + Foreground color. + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Header. + + + + + Footer. + + + + + Indicates whether to auto-flush after + + + + + Indicates whether to auto-check if the console is available - Disables console writing if Environment.UserInteractive = False (Windows Service) - Disables console writing if Console Standard Input is not available (Non-Console-App) + + + + + The encoding for writing messages to the . + + + + + Indicates whether to send the log messages to the standard error instead of the standard output. + + + + + Whether to enable batch writing using char[]-buffers, instead of using + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Obsolete - value will be ignored! The logging code always runs outside of transaction. Gets or sets a value indicating whether to use database transactions. Some data providers require this. + + + + + Indicates whether to keep the database connection open between the log events. + + + + + Name of the database provider. + + + + + Database password. If the ConnectionString is not provided this value will be used to construct the "Password=" part of the connection string. + + + + + Database host name. If the ConnectionString is not provided this value will be used to construct the "Server=" part of the connection string. + + + + + Database user name. If the ConnectionString is not provided this value will be used to construct the "User ID=" part of the connection string. + + + + + Name of the connection string (as specified in <connectionStrings> configuration section. + + + + + Connection string. When provided, it overrides the values specified in DBHost, DBUserName, DBPassword, DBDatabase. + + + + + Database name. If the ConnectionString is not provided this value will be used to construct the "Database=" part of the connection string. + + + + + Connection string using for installation and uninstallation. If not provided, regular ConnectionString is being used. + + + + + Configures isolated transaction batch writing. If supported by the database, then it will improve insert performance. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + Text of the SQL command to be run on each log level. + + + + + Type of the SQL command to be run on each log level. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Convert format of the property value + + + + + Culture used for parsing property string-value for type-conversion + + + + + Value to assign on the object-property + + + + + Name for the object-property + + + + + Type of the object-property + + + + + + + + + + + + + + Type of the command. + + + + + Connection string to run the command against. If not provided, connection string from the target is used. + + + + + Indicates whether to ignore failures. + + + + + Command text. + + + + + + + + + + + + + + + + + + + Database parameter name. + + + + + Layout that should be use to calculate the value for the parameter. + + + + + Database parameter DbType. + + + + + Database parameter size. + + + + + Database parameter precision. + + + + + Database parameter scale. + + + + + Type of the parameter. + + + + + Whether empty value should translate into DbNull. Requires database column to allow NULL values. + + + + + Convert format of the database parameter value. + + + + + Culture used for parsing parameter string-value for type-conversion + + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Header. + + + + + Footer. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Layout that renders event Category. + + + + + Optional entry type. When not set, or when not convertible to then determined by + + + + + Layout that renders event ID. + + + + + Name of the Event Log to write to. This can be System, Application or any user-defined name. + + + + + Name of the machine on which Event Log service is running. + + + + + Maximum Event log size in kilobytes. + + + + + Message length limit to write to the Event Log. + + + + + Value to be used as the event Source. + + + + + Action to take if the message is larger than the option. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether to return to the first target after any successful write. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Header. + + + + + Footer. + + + + + File encoding. + + + + + Line ending mode. + + + + + Maximum days of archive files that should be kept. + + + + + Indicates whether to compress archive files into the zip archive format. + + + + + Way file archives are numbered. + + + + + Name of the file to be used for an archive. + + + + + Is the an absolute or relative path? + + + + + Indicates whether to automatically archive log files every time the specified time passes. + + + + + Size in bytes above which log files will be automatically archived. Warning: combining this with isn't supported. We cannot create multiple archive files, if they should have the same name. Choose: + + + + + Maximum number of archive files that should be kept. + + + + + Indicates whether the footer should be written only when the file is archived. + + + + + Maximum number of log file names that should be stored as existing. + + + + + Indicates whether to delete old log file on startup. + + + + + File attributes (Windows only). + + + + + Indicates whether to create directories if they do not exist. + + + + + Cleanup invalid values in a filename, e.g. slashes in a filename. If set to true, this can impact the performance of massive writes. If set to false, nothing gets written when the filename is wrong. + + + + + Value of the file size threshold to archive old log file on startup. + + + + + Indicates whether to archive old log file on startup. + + + + + Value specifying the date format to use when archiving files. + + + + + Indicates whether to enable log file(s) to be deleted. + + + + + Indicates whether to write BOM (byte order mark) in created files + + + + + Indicates whether to replace file contents on each write instead of appending log message at the end. + + + + + Indicates whether file creation calls should be synchronized by a system global mutex. + + + + + Gets or set a value indicating whether a managed file stream is forced, instead of using the native implementation. + + + + + Is the an absolute or relative path? + + + + + Name of the file to write to. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + Indicates whether concurrent writes to the log file by multiple processes on different network hosts. + + + + + Maximum number of seconds that files are kept open. If this number is negative the files are not automatically closed after a period of inactivity. + + + + + Number of files to be kept open. Setting this to a higher value may improve performance in a situation where a single File target is writing to many files (such as splitting by level or by logger). + + + + + Indicates whether to keep log file open instead of opening and closing it on each logging event. + + + + + Whether or not this target should just discard all data that its asked to write. Mostly used for when testing NLog Stack except final write + + + + + Indicates whether concurrent writes to the log file by multiple processes on the same host. + + + + + Number of times the write is appended on the file before NLog discards the log message. + + + + + Delay in milliseconds to wait before attempting to write to the file again. + + + + + Log file buffer size in bytes. + + + + + Maximum number of seconds before open files are flushed. If this number is negative or zero the files are not flushed by timer. + + + + + Indicates whether to automatically flush the file buffers after each log message. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Condition expression. Log events who meet this condition will be forwarded to the wrapped target. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Windows domain name to change context to. + + + + + Required impersonation level. + + + + + Type of the logon provider. + + + + + Logon Type. + + + + + User account password. + + + + + Indicates whether to revert to the credentials of the process instead of impersonating another user. + + + + + Username to change context to. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Interval in which messages will be written up to the number of messages. + + + + + Maximum allowed number of messages written per . + + + + + Name of the target. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Endpoint address. + + + + + Name of the endpoint configuration in WCF configuration file. + + + + + Indicates whether to use a WCF service contract that is one way (fire and forget) or two way (request-reply) + + + + + Client ID. + + + + + Indicates whether to include per-event properties in the payload sent to the server. + + + + + Indicates whether to use binary message encoding. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + Layout that should be use to calculate the value for the parameter. + + + + + Name of the parameter. + + + + + Type of the parameter. + + + + + Type of the parameter. Obsolete alias for + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Header. + + + + + Footer. + + + + + Indicates whether NewLine characters in the body should be replaced with tags. + + + + + Priority used for sending mails. + + + + + Encoding to be used for sending e-mail. + + + + + BCC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + CC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + Indicates whether to add new lines between log entries. + + + + + Indicates whether to send message as HTML instead of plain text. + + + + + Sender's email address (e.g. joe@domain.com). + + + + + Mail message body (repeated for each log message send in one mail). + + + + + Mail subject. + + + + + Recipients' email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + Indicates the SMTP client timeout. + + + + + SMTP Server to be used for sending. + + + + + SMTP Authentication mode. + + + + + Username used to connect to SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + Password used to authenticate against SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + Indicates whether SSL (secure sockets layer) should be used when communicating with SMTP server. + + + + + Port number that SMTP Server is listening on. + + + + + Indicates whether the default Settings from System.Net.MailSettings should be used. + + + + + Folder where applications save mail messages to be processed by the local SMTP server. + + + + + Specifies how outgoing email messages will be handled. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Max number of items to have in memory + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Class name. + + + + + Method name. The method must be public and static. Use the AssemblyQualifiedName , https://msdn.microsoft.com/en-us/library/system.type.assemblyqualifiedname(v=vs.110).aspx e.g. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Encoding to be used. + + + + + End of line value if a newline is appended at the end of log message . + + + + + Maximum message size in bytes. + + + + + Indicates whether to append newline at the end of log message. + + + + + Network address. + + + + + Size of the connection cache (number of connections which are kept alive). + + + + + The number of seconds a connection will remain idle before the first keep-alive probe is sent + + + + + Indicates whether to keep connection open whenever possible. + + + + + Maximum current connections. 0 = no maximum. + + + + + Maximum queue size. + + + + + Action that should be taken if the will be more connections than . + + + + + Action that should be taken if the message is larger than maxMessageSize. + + + + + Get or set the SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Encoding to be used. + + + + + Instance of that is used to format log messages. + + + + + End of line value if a newline is appended at the end of log message . + + + + + Maximum message size in bytes. + + + + + Indicates whether to append newline at the end of log message. + + + + + Get or set the SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. + + + + + Network address. + + + + + Size of the connection cache (number of connections which are kept alive). + + + + + The number of seconds a connection will remain idle before the first keep-alive probe is sent + + + + + Maximum queue size. + + + + + Maximum current connections. 0 = no maximum. + + + + + Action that should be taken if the will be more connections than . + + + + + Action that should be taken if the message is larger than maxMessageSize. + + + + + Indicates whether to keep connection open whenever possible. + + + + + NDLC item separator. + + + + + NDC item separator. + + + + + Indicates whether to include dictionary contents. + + + + + Indicates whether to include source info (file name and line number) in the information sent over the network. + + + + + Indicates whether to include NLog-specific extensions to log4j schema. + + + + + Indicates whether to include contents of the stack. + + + + + Indicates whether to include stack contents. + + + + + Indicates whether to include dictionary contents. + + + + + Indicates whether to include dictionary contents. + + + + + Option to include all properties from the log events + + + + + Indicates whether to include call site (class and method name) in the information sent over the network. + + + + + Option to include all properties from the log events + + + + + AppInfo field. By default it's the friendly name of the current AppDomain. + + + + + Renderer for log4j:event logger-xml-attribute (Default ${logger}) + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Indicates whether to perform layout calculation. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether performance counter should be automatically created. + + + + + Name of the performance counter category. + + + + + Counter help text. + + + + + Name of the performance counter. + + + + + Performance counter type. + + + + + The value by which to increment the counter. + + + + + Performance counter instance name. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Default filter to be applied when no specific rule matches. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + Condition to be tested. + + + + + Resulting filter to be applied when the condition matches. + + + + + + + + + + + + + Name of the target. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + Name of the target. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + Number of times to repeat each log message. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + Number of retries that should be attempted on the wrapped target in case of a failure. + + + + + Time to wait between retries in milliseconds. + + + + + + + + + + + + + + + Name of the target. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + Name of the target. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Forward to (Instead of ) + + + + + Always use independent of + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + Should we include the BOM (Byte-order-mark) for UTF? Influences the property. This will only work for UTF-8. + + + + + Web service method name. Only used with Soap. + + + + + Web service namespace. Only used with Soap. + + + + + Protocol to be used when calling web service. + + + + + Custom proxy address, include port separated by a colon + + + + + Encoding. + + + + + Web service URL. + + + + + Value of the User-agent HTTP header. + + + + + Value whether escaping be done according to the old NLog style (Very non-standard) + + + + + Value whether escaping be done according to Rfc3986 (Supports Internationalized Resource Identifiers - IRIs) + + + + + Indicates whether to pre-authenticate the HttpWebRequest (Requires 'Authorization' in parameters) + + + + + Name of the root XML element, if POST of XML document chosen. If so, this property must not be null. (see and ). + + + + + (optional) root namespace of the XML document, if POST of XML document chosen. (see and ). + + + + + Proxy configuration when calling web service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Footer layout. + + + + + Header layout. + + + + + Body layout (can be repeated multiple times). + + + + + Custom column delimiter value (valid when ColumnDelimiter is set to 'Custom'). + + + + + Column delimiter. + + + + + Quote Character. + + + + + Quoting mode. + + + + + Indicates whether CVS should include header. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Layout of the column. + + + + + Name of the column. + + + + + Override of Quoting mode + + + + + + + + + + + + + + + + + + + + + + + + Should forward slashes be escaped? If true, / will be converted to \/ + + + + + Option to render the empty object value {} + + + + + Option to suppress the extra spaces in the output json + + + + + Option to exclude null/empty properties from the log event (as JSON) + + + + + List of property names to exclude when is true + + + + + Option to include all properties from the log event (as JSON) + + + + + Option to include all properties from the log event (as JSON) + + + + + Indicates whether to include contents of the dictionary. + + + + + Indicates whether to include contents of the dictionary. + + + + + Indicates whether to include contents of the dictionary. + + + + + Indicates whether to include contents of the dictionary. + + + + + How far should the JSON serializer follow object references before backing off + + + + + + + + + + + + + + + + + Layout that will be rendered as the attribute's value. + + + + + Name of the attribute. + + + + + Determines whether or not this attribute will be Json encoded. + + + + + Should forward slashes be escaped? If true, / will be converted to \/ + + + + + Indicates whether to escape non-ascii characters + + + + + Whether an attribute with empty value should be included in the output + + + + + + + + + + + + + + Footer layout. + + + + + Header layout. + + + + + Body layout (can be repeated multiple times). + + + + + + + + + + + + + + + + + + + + + + + Option to include all properties from the log events + + + + + Indicates whether to include call site (class and method name) in the information sent over the network. + + + + + Option to include all properties from the log events + + + + + Indicates whether to include contents of the dictionary. + + + + + Indicates whether to include contents of the dictionary. + + + + + Indicates whether to include contents of the stack. + + + + + Indicates whether to include contents of the stack. + + + + + Indicates whether to include contents of the dictionary. + + + + + Indicates whether to include source info (file name and line number) in the information sent over the network. + + + + + + + + + + + + + + Layout text. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Option to include all properties from the log event (as XML) + + + + + XML attribute name to use when rendering property-key When null (or empty) then key-attribute is not included + + + + + XML element name to use for rendering IList-collections items + + + + + How far should the XML serializer follow object references before backing off + + + + + Indicates whether to include contents of the dictionary. + + + + + Indicates whether to include contents of the dictionary. + + + + + Indicates whether to include contents of the dictionary. + + + + + Option to include all properties from the log event (as XML) + + + + + XML attribute name to use when rendering property-value When null (or empty) then value-attribute is not included and value is formatted as XML-element-value + + + + + List of property names to exclude when is true + + + + + XML element name to use when rendering properties + + + + + Determines whether or not this attribute will be Xml encoded. + + + + + Auto indent and create new lines + + + + + Whether a ElementValue with empty value should be included in the output + + + + + Value inside the root XML element + + + + + Name of the root XML element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Determines whether or not this attribute will be Xml encoded. + + + + + Name of the element + + + + + Value inside the element + + + + + Whether a ElementValue with empty value should be included in the output + + + + + Auto indent and create new lines + + + + + List of property names to exclude when is true + + + + + Option to include all properties from the log event (as XML) + + + + + Option to include all properties from the log event (as XML) + + + + + Indicates whether to include contents of the dictionary. + + + + + Indicates whether to include contents of the dictionary. + + + + + Indicates whether to include contents of the dictionary. + + + + + How far should the XML serializer follow object references before backing off + + + + + XML element name to use for rendering IList-collections items + + + + + XML attribute name to use when rendering property-key When null (or empty) then key-attribute is not included + + + + + XML element name to use when rendering properties + + + + + XML attribute name to use when rendering property-value When null (or empty) then value-attribute is not included and value is formatted as XML-element-value + + + + + + + + + + + + + Layout that will be rendered as the attribute's value. + + + + + Name of the attribute. + + + + + Determines whether or not this attribute will be Xml encoded. + + + + + Whether an attribute with empty value should be included in the output + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Condition expression. + + + + + + + + + + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + Substring to be matched. + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + String to compare the layout to. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + Substring to be matched. + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + String to compare the layout to. + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + + + + + + + + + + + + + + + + + + + + Action to be taken when filter matches. + + + + + Default number of unique filter values to expect, will automatically increase if needed + + + + + Applies the configured action to the initial logevent that starts the timeout period. Used to configure that it should ignore all events until timeout. + + + + + Layout to be used to filter log messages. + + + + + Max number of unique filter values to expect simultaneously + + + + + Max length of filter values, will truncate if above limit + + + + + How long before a filter expires, and logging is accepted again + + + + + Default buffer size for the internal buffers + + + + + Reuse internal buffers, and doesn't have to constantly allocate new buffers + + + + + Append FilterCount to the when an event is no longer filtered + + + + + Insert FilterCount value into when an event is no longer filtered + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Gdsi-Api/Properties/AssemblyInfo.cs b/Gdsi-Api/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ed4ae6e --- /dev/null +++ b/Gdsi-Api/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息是通过以下项进行控制的 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("Gdsi_Api")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Gdsi_Api")] +[assembly: AssemblyCopyright("版权所有(C) 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 将使此程序集中的类型 +// 对 COM 组件不可见。如果需要 +// COM,在该类型上将 ComVisible 属性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID +[assembly: Guid("7457c6e2-8757-4921-8ea2-dbf3b6b459ae")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 内部版本号 +// 修订号 +// +// 你可以指定所有值,也可以让修订版本和内部版本号采用默认值, +// 方法是按如下所示使用 "*": +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Gdsi-Api/Web.Debug.config b/Gdsi-Api/Web.Debug.config new file mode 100644 index 0000000..4bfe62f --- /dev/null +++ b/Gdsi-Api/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/Gdsi-Api/Web.Release.config b/Gdsi-Api/Web.Release.config new file mode 100644 index 0000000..dd89ed8 --- /dev/null +++ b/Gdsi-Api/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + diff --git a/Gdsi-Api/Web.config b/Gdsi-Api/Web.config new file mode 100644 index 0000000..0099fea --- /dev/null +++ b/Gdsi-Api/Web.config @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Gdsi-Api/favicon.ico b/Gdsi-Api/favicon.ico new file mode 100644 index 0000000..a3a7999 Binary files /dev/null and b/Gdsi-Api/favicon.ico differ diff --git a/Gdsi-Api/packages.config b/Gdsi-Api/packages.config new file mode 100644 index 0000000..3f541d3 --- /dev/null +++ b/Gdsi-Api/packages.config @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Gdsi/Config/GdsiConfig.cs b/Gdsi/Config/GdsiConfig.cs new file mode 100644 index 0000000..801a2ab --- /dev/null +++ b/Gdsi/Config/GdsiConfig.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Gdsi.Config +{ + public class GdsiConfig + { + // 医保服务调用地址 + public static string server_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"; + // 医疗机构编码 + public static string fixmedins_code = "H44040300017"; + // 医疗机构名称 + public static string fixmedins_name = "珠海市斗门区侨立中医院"; + // 经办人 + public static string opter = "zzj001"; + // 经办人姓名 + public static string opter_name = "自助机缴费"; + // 就医地医保区划 + public static string city_code = "440403"; + // 应用编码 + public static string paasid = "zh_prd_ejyy"; + // 密钥 + public static string key = "w42Clf7CG5FpvDTdmy6vFeN5pdnpWUhg"; + } +} diff --git a/Gdsi/Domain/GdsiApi.cs b/Gdsi/Domain/GdsiApi.cs new file mode 100644 index 0000000..b71e94d --- /dev/null +++ b/Gdsi/Domain/GdsiApi.cs @@ -0,0 +1,142 @@ +using Gdsi.Config; +using Gdsi.Helper; +using Gdsi.Model; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Gdsi.Domain +{ + public class GdsiApi + { + private static string api_9001() + { + string result = ""; + var req = new + { + infno = "9001", + msgid = GdsiConfig.fixmedins_code + DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1, 10000).ToString().PadLeft(4, '0'), + mdtrtarea_admvs = GdsiConfig.city_code, + insuplc_admdvs = GdsiConfig.city_code, + recer_sys_code = "FD0001", + dev_no = "", + dev_safe_info = "", + cainfo = "", + signtype = "SM3", + infver = "V1.0", + opter_type = "2", + opter = GdsiConfig.opter, + opter_name = GdsiConfig.opter_name, + inf_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + fixmedins_code = GdsiConfig.fixmedins_code, + fixmedins_name = GdsiConfig.fixmedins_name, + sign_no = "", + app_id = "", + enc_type = "", + input = new + { + signIn = new + { + opter_no = GdsiConfig.opter, + mac = "00-50-56-82-8B-F4", + ip = "192.168.30.33" + } + } + }; + string strReq = JsonConvert.SerializeObject(req); + string strRes = Http.HttpPostByHeader(GdsiConfig.server_url + "9001", strReq); + try + { + JObject jObject = JsonConvert.DeserializeObject(strRes) as JObject; + if (jObject["infcode"].ToString() == "0") + { + if (jObject["output"]["signinoutb"]["sign_no"] == null) + { + return result; + } + result = jObject["output"]["signinoutb"]["sign_no"].ToString(); + return result; + } + return result; + } + catch + { + return result; + } + } + + public static Info api_1101(string qrCode) + { + Info info = new Info(); + string signNo = api_9001(); + if ("".Equals(signNo)) + { + info.Msg = "签到出错"; + return info; + } + var req = new + { + infno = "1101", + msgid = GdsiConfig.fixmedins_code + DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1, 10000).ToString().PadLeft(4, '0'), + mdtrtarea_admvs = GdsiConfig.city_code, + insuplc_admdvs = GdsiConfig.city_code, + recer_sys_code = "FD0001", + dev_no = "", + dev_safe_info = "", + cainfo = "", + signtype = "SM3", + infver = "V1.0", + opter_type = "2", + opter = GdsiConfig.opter, + opter_name = GdsiConfig.opter_name, + inf_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + fixmedins_code = GdsiConfig.fixmedins_code, + fixmedins_name = GdsiConfig.fixmedins_name, + sign_no = "", + app_id = "", + enc_type = "", + input = new + { + data = new + { + mdtrt_cert_type = "01", + mdtrt_cert_no = qrCode, + card_sn = "", + begntime = "", + psn_cert_type = "", + certno = "", + psn_name = "" + } + } + }; + string strReq = JsonConvert.SerializeObject(req); + string strRes = Http.HttpPostByHeader(GdsiConfig.server_url + "1101", strReq); + + try + { + JObject jObject = JsonConvert.DeserializeObject(strRes) as JObject; + if (jObject["infcode"].ToString() == "0") + { + info.Code = 0; + info.Msg = "SUCCESS"; + info.Data = new Info.BaseInfo(); + info.Data.Name = jObject["output"]["baseinfo"]["psn_name"].ToString(); + info.Data.IDNo = jObject["output"]["baseinfo"]["certno"].ToString(); + } + else + { + info.Msg = jObject["err_msg"].ToString(); + } + } + catch (Exception ex) + { + info.Msg = ex.Message; + } + return info; + } + } +} diff --git a/Gdsi/Gdsi.csproj b/Gdsi/Gdsi.csproj new file mode 100644 index 0000000..cb2d200 --- /dev/null +++ b/Gdsi/Gdsi.csproj @@ -0,0 +1,57 @@ + + + + + Debug + AnyCPU + {3EF3A083-5F36-436A-B87E-2D0964CAAD7C} + Library + Properties + Gdsi + Gdsi + v4.5 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Gdsi/Helper/Http.cs b/Gdsi/Helper/Http.cs new file mode 100644 index 0000000..d3ab8f8 --- /dev/null +++ b/Gdsi/Helper/Http.cs @@ -0,0 +1,111 @@ +using Gdsi.Config; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace Gdsi.Helper +{ + public class Http + { + private static string smethod_0(string string_0) + { + byte[] bytes = Encoding.UTF8.GetBytes(string_0); + byte[] array = SHA256.Create().ComputeHash(bytes); + StringBuilder stringBuilder = new StringBuilder(); + for (int i = 0; i < array.Length; i++) + { + stringBuilder.Append(array[i].ToString("x2")); + } + return stringBuilder.ToString(); + } + + private static string smethod_1() + { + return Convert.ToInt64((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds).ToString(); + } + + private static string smethod_2(int int_0, bool bool_0, bool bool_1, bool bool_2, bool bool_3, string string_0 = "") + { + byte[] array = new byte[4]; + new RNGCryptoServiceProvider().GetBytes(array); + Random random = new Random(BitConverter.ToInt32(array, 0)); + string text = null; + string text2 = string_0; + if (bool_0) + { + text2 += "0123456789"; + } + if (bool_1) + { + text2 += "abcdefghijklmnopqrstuvwxyz"; + } + if (bool_2) + { + text2 += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + } + if (bool_3) + { + text2 += "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"; + } + for (int i = 0; i < int_0; i++) + { + text += text2.Substring(random.Next(0, text2.Length - 1), 1); + } + return text; + } + + public static string HttpPostByHeader(string url, string param, Dictionary dicHeader = null) + { + HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); + httpWebRequest.Method = "POST"; + httpWebRequest.ContentType = "application/json;charset=UTF-8"; + if (dicHeader == null) + { + dicHeader = new Dictionary(); + string text = smethod_1(); + string text2 = smethod_2(32, bool_0: true, bool_1: true, bool_2: false, bool_3: false); + string value = GdsiConfig.paasid; + string text3 = GdsiConfig.key; + string value2 = smethod_0(text + text3 + text2 + text); + dicHeader.Add("x-tif-paasid", value); + dicHeader.Add("x-tif-signature", value2); + dicHeader.Add("x-tif-timestamp", text); + dicHeader.Add("x-tif-nonce", text2); + } + if (dicHeader != null && dicHeader.Count != 0) + { + foreach (KeyValuePair item in dicHeader) + { + httpWebRequest.Headers.Add(item.Key, item.Value); + } + } + byte[] bytes = Encoding.UTF8.GetBytes(param); + httpWebRequest.ContentLength = bytes.Length; + string text4 = ""; + try + { + Stream requestStream = httpWebRequest.GetRequestStream(); + requestStream.Write(bytes, 0, bytes.Length); + requestStream.Close(); + HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); + Stream responseStream = httpWebResponse.GetResponseStream(); + string text5 = ""; + StreamReader streamReader = new StreamReader(responseStream, Encoding.UTF8); + while ((text5 = streamReader.ReadLine()) != null) + { + text4 += text5; + } + return text4; + } + catch (Exception ex) + { + return ex.Message; + } + } + } +} diff --git a/Gdsi/Model/Info.cs b/Gdsi/Model/Info.cs new file mode 100644 index 0000000..01cb5c1 --- /dev/null +++ b/Gdsi/Model/Info.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Gdsi.Model +{ + public class Info + { + public class BaseInfo + { + public string Name { get; set; } = string.Empty; + public string IDNo { get; set; } = string.Empty; + } + + public int Code { get; set; } = -1; + public string Msg { get; set; } = string.Empty; + public BaseInfo Data { get; set; } = null; + } +} diff --git a/Gdsi/Properties/AssemblyInfo.cs b/Gdsi/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ef95fd2 --- /dev/null +++ b/Gdsi/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("Gdsi")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Gdsi")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("3ef3a083-5f36-436a-b87e-2d0964caad7c")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Gdsi/packages.config b/Gdsi/packages.config new file mode 100644 index 0000000..93b0be8 --- /dev/null +++ b/Gdsi/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file