From 0e7ca59b81875ab28fd0fb3012565a7ee042bf67 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Sat, 25 May 2019 16:47:49 +0800 Subject: [PATCH] update Former-commit-id: f954a3dccbf5db6646f6b8b9fd4ba1777cf70ba6 --- projects/IoT/IdGen/.gitignore | 16 ++++++++++++++++ projects/IoT/IdGen/IdGen.csproj | 12 ++++++++++++ projects/IoT/IdGen/Program.cs | 28 ++++++++++++++++++++++++++++ projects/IoT/IoTNode/Startup.cs | 2 +- projects/projects.sln | 7 +++++++ 5 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 projects/IoT/IdGen/.gitignore create mode 100644 projects/IoT/IdGen/IdGen.csproj create mode 100644 projects/IoT/IdGen/Program.cs diff --git a/projects/IoT/IdGen/.gitignore b/projects/IoT/IdGen/.gitignore new file mode 100644 index 00000000..988994ff --- /dev/null +++ b/projects/IoT/IdGen/.gitignore @@ -0,0 +1,16 @@ +*.bak +*.suo +*.db +*.user +.vs +obj +Obj +bin +Bin +debug +Debug +release +Release +Logs +logs +node_modules \ No newline at end of file diff --git a/projects/IoT/IdGen/IdGen.csproj b/projects/IoT/IdGen/IdGen.csproj new file mode 100644 index 00000000..28027cb9 --- /dev/null +++ b/projects/IoT/IdGen/IdGen.csproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp2.2 + + + + + + + diff --git a/projects/IoT/IdGen/Program.cs b/projects/IoT/IdGen/Program.cs new file mode 100644 index 00000000..d2a69bd8 --- /dev/null +++ b/projects/IoT/IdGen/Program.cs @@ -0,0 +1,28 @@ +using Infrastructure.Extensions; +using System; + +namespace IdGen +{ + internal class Program + { + private static void Main(string[] args) + { + if (args.Length > 0) + { + Console.WriteLine(args[0].Md5().Base64UrlEncode().Md5()); + } + while (true) + { + var input = Console.ReadLine(); + if (input == "q") + { + break; + } + else + { + Console.WriteLine(input.Md5().Base64UrlEncode().Md5()); + } + } + } + } +} \ No newline at end of file diff --git a/projects/IoT/IoTNode/Startup.cs b/projects/IoT/IoTNode/Startup.cs index bdbbc4bf..ccbf6484 100644 --- a/projects/IoT/IoTNode/Startup.cs +++ b/projects/IoT/IoTNode/Startup.cs @@ -32,7 +32,7 @@ namespace IoTNode public Startup(IConfiguration configuration, IHostingEnvironment env) : base(configuration, env) { - if (configuration["id"].Md5().Md5() != Helper.Instance.GetCPUNumber().Md5().Md5()) + if (configuration["id"] != Helper.Instance.GetCPUNumber().Md5().Base64UrlEncode().Md5()) { throw new Exception("设备id无效"); } diff --git a/projects/projects.sln b/projects/projects.sln index f0ef3d51..46b2cc49 100644 --- a/projects/projects.sln +++ b/projects/projects.sln @@ -37,6 +37,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoT.UI.Shard", "IoT\IoT.UI. EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{AF2F6203-A338-4B48-8FED-5D6385663665}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IdGen", "IoT\IdGen\IdGen.csproj", "{775041E3-9B61-4B22-ABED-EAB48F54C900}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -99,6 +101,10 @@ Global {1F466C72-FD35-483E-A199-2C143CB813C1}.Debug|Any CPU.Build.0 = Debug|Any CPU {1F466C72-FD35-483E-A199-2C143CB813C1}.Release|Any CPU.ActiveCfg = Release|Any CPU {1F466C72-FD35-483E-A199-2C143CB813C1}.Release|Any CPU.Build.0 = Release|Any CPU + {775041E3-9B61-4B22-ABED-EAB48F54C900}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {775041E3-9B61-4B22-ABED-EAB48F54C900}.Debug|Any CPU.Build.0 = Debug|Any CPU + {775041E3-9B61-4B22-ABED-EAB48F54C900}.Release|Any CPU.ActiveCfg = Release|Any CPU + {775041E3-9B61-4B22-ABED-EAB48F54C900}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -116,6 +122,7 @@ Global {871CD7E8-19F4-48F9-8124-66F69398C694} = {2A80F0AD-9ADB-464C-BF31-06E505D1793B} {BE6DEBC5-004F-4811-8BDC-67C74D9E8C2F} = {B39CEABB-9A42-4BA2-A167-665349113986} {1F466C72-FD35-483E-A199-2C143CB813C1} = {B39CEABB-9A42-4BA2-A167-665349113986} + {775041E3-9B61-4B22-ABED-EAB48F54C900} = {B39CEABB-9A42-4BA2-A167-665349113986} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0B7095FB-5E70-4EF8-805A-CB4A91AE4B0A}