Browse Source

Merge branch 'master' of http://git.ius.plus:88/Project-Wing/WingCloudServer

Conflicts:
	src/appsettings.json
denny 8 months ago
parent
commit
4cef0c1034
3 changed files with 76 additions and 50 deletions
  1. 36 28
      src/Dongle/DongleValidService.cs
  2. 18 1
      src/WingServer.cs
  3. 22 21
      src/appsettings.json

+ 36 - 28
src/Dongle/DongleValidService.cs

@@ -35,42 +35,50 @@ namespace WingCloudServer.Dongle
                 Console.WriteLine("serialNum:" + serialNum.Count());
                 foreach (var nSerial in serialNum)
                 {
-                    if (nSerial > 0)
+                    try
                     {
-                        var usbKeyReader = new UsbKeyReader(17425, 9811, 23004, 1289, nSerial);
-                        if (usbKeyReader.Initialize(_password) || usbKeyReader.Initialize(_passwordOld))
+                        if (nSerial > 0)
                         {
-                            lock (_locker)
+                            var usbKeyReader = new UsbKeyReader(17425, 9811, 23004, 1289, nSerial);
+                            if (usbKeyReader.Initialize(_password) || usbKeyReader.Initialize(_passwordOld))
                             {
-                                //验证合法性
-                                var licenseData = usbKeyReader.ReadString(1000);
-                                if (string.IsNullOrEmpty(licenseData))
+                                lock (_locker)
                                 {
-                                    return result;
+                                    //验证合法性
+                                    var licenseData = usbKeyReader.ReadString(1000);
+                                    if (string.IsNullOrEmpty(licenseData))
+                                    {
+                                        return result;
+                                    }
+                                    Console.WriteLine("licenseData:" + licenseData);
+                                    licenseData = licenseData.Substring(0, licenseData.IndexOf("}") + 1);
+                                    licenseData = EncryptHelper.Decrypt(licenseData);
+                                    var splitItems = licenseData.Split(';');
+                                    if (splitItems.Length < 5)
+                                    {
+                                        Logger.WriteLineWarn($"splitItems.Length error");
+                                        return result;
+                                    }
+                                    var authorizer = splitItems[0];
+                                    var productName = splitItems[1];
+                                    if (authorizer != "Vinno" || productName != "vLabServer")
+                                    {
+                                        Logger.WriteLineWarn($"authorizer vLabServer error");
+                                        return result;
+                                    }
+                                    var licenseKey = splitItems[4];
+                                    var license = ServerLicense.Instance.GetLicense(licenseKey);
+                                    license.IsDongleOn = true;
+                                    return Tuple.Create<bool, License>(true, license);
                                 }
-                                Console.WriteLine("licenseData:" + licenseData);
-                                licenseData = licenseData.Substring(0, licenseData.IndexOf("}") + 1);
-                                licenseData = EncryptHelper.Decrypt(licenseData);
-                                var splitItems = licenseData.Split(';');
-                                if (splitItems.Length < 5)
-                                {
-                                    Logger.WriteLineWarn($"splitItems.Length error");
-                                    return result;
-                                }
-                                var authorizer = splitItems[0];
-                                var productName = splitItems[1];
-                                if (authorizer != "Vinno" || productName != "vLabServer")
-                                {
-                                    Logger.WriteLineWarn($"authorizer vLabServer error");
-                                    return result;
-                                }
-                                var licenseKey = splitItems[4];
-                                var license = ServerLicense.Instance.GetLicense(licenseKey);
-                                license.IsDongleOn = true;
-                                return Tuple.Create<bool, License>(true, license);
                             }
                         }
                     }
+                    catch (Exception ex)
+                    {
+                        Logger.WriteLineError($"Application shutdown due to license missing,{nSerial},ex:{ex}");
+                        Console.WriteLine($"Application shutdown due to license missing,{nSerial},ex:{ex}");
+                    }
                 }
                 return result;
             }

+ 18 - 1
src/WingServer.cs

@@ -34,6 +34,8 @@ namespace WingCloudServer
         private static JsonRpcClientPool _rpcClientPool;
         private static Dictionary<string, IDynamicSlaveService> _remoteServices = new Dictionary<string, IDynamicSlaveService>();
 
+        private int _dongleValidinterval = 480;
+
         public WingServer(string host)
         {
             _rpcInProcessServer = new JsonRpcServer();
@@ -42,6 +44,7 @@ namespace WingCloudServer
             _rpcHttpServer = new JsonRpcServer();
             _jsonRpcHttpServerEngine = new JsonRpcHttpServerEngine(host);
             _rpcHttpServer.UseEngine(_jsonRpcHttpServerEngine);
+            _dongleValidinterval = GetDongleValidinterval();
             WatchingUSB();
             WatchingDongle();
         }
@@ -720,7 +723,7 @@ namespace WingCloudServer
                 {
                     while (true)
                     {
-                        await Task.Delay(TimeSpan.FromMinutes(10));
+                        await Task.Delay(TimeSpan.FromMinutes(_dongleValidinterval));
                         try
                         {
                             new DongleValidService().CheckAndVerifyLicense();
@@ -738,5 +741,19 @@ namespace WingCloudServer
             });
         }
 
+        private int GetDongleValidinterval()
+        {
+            var dongleValidinterval = 480;
+            try
+            {
+                dongleValidinterval = ConfigurationManager.GetParammeter<IntParameter>("General", "DongleValidinterval").Value;
+            }
+            catch (Exception ex)
+            {
+                Logger.WriteLineError($"GetDongleValidinterval error:{ex}");
+            }
+            return dongleValidinterval;
+        }
+
     }
 }

+ 22 - 21
src/appsettings.json

@@ -5,25 +5,26 @@
     "IsMaster": false,
     "MasterUrl": "",
     "ServerID":"1",
-    "NotValidateLicense":false,
+    "NotValidateLicense":true,
     "QualityControlSwitch": false,
     "IsScreenshot": false,
     "NotVinnoServerService":false,
 	  "ApiAccessSwitch":false,
-	  "IsResearchEditionService":true,
-	  "FormatterHostAddress":true,
-    "DllKey":"vinno123"
+	  "IsResearchEditionService":false,
+	  "FormatterHostAddress":false,
+    "DllKey":"vinno123",
+    "DongleValidinterval":480
   },
   "Gateway": {
-    "Host": "http://192.168.6.65:8303/",
-    "Domains": "http://192.168.6.65:8303/",
+    "Host": "http://*:8303/",
+    "Domains": "http://*:8303/",
     "ApiPort": 0,
-    "WebDomain":"http://192.168.6.65/",
-    "FISWebUrl":"http://192.168.6.65/"
+    "WebDomain":"http://127.0.0.1/",
+    "FISWebUrl":"http://127.0.0.1/"
   },
   "Log": {
     "Level": "info",
-    "Debug": true,
+    "Debug": false,
     "DBPerformance": 100,
     "DBName": "WingCloudLogs",
     "CollectionName": "logs"
@@ -34,9 +35,9 @@
     "Remote": ""
   },
   "SMS": {
-    "CheckVerifyCodeApi": "http://192.168.6.65:8302/SmsTool/SendSms/CheckVerifyCode",
-    "SendVerifyCodeApi": "http://192.168.6.65:8302/SmsTool/SendSms/SendVerifyCode",
-    "SendMessageApi": "http://192.168.6.65:8302/SmsTool/SendSms/SendMessage",
+    "CheckVerifyCodeApi": "http://127.0.0.1:8302/SmsTool/SendSms/CheckVerifyCode",
+    "SendVerifyCodeApi": "http://127.0.0.1:8302/SmsTool/SendSms/SendVerifyCode",
+    "SendMessageApi": "http://127.0.0.1:8302/SmsTool/SendSms/SendMessage",
     "TestPhoneNumbers": "15962161351,18862108573"
   },
   "Database": {
@@ -69,16 +70,16 @@
   "Notification": {
     "Host": "http://*:9301/",
     "MaxQueueCount": 10,
-    "WebSocketUrl": "ws://192.168.6.65:9301?token={0}&type={1}"
+    "WebSocketUrl": "ws://127.0.0.1:9301?token={0}&type={1}"
   },
   "Storage": {
     "ServerHost": "http://*:9303/",
-    "StorageServer": "VCS",
+    "StorageServer": "COS",
     "AppId": "AKIDMSIsADUUpvJGwJOKvsb5IDrGtGNBRzzi",
     "Sercret": "4sQhdJBl5HI7f3oLbZIlwqXOyILyLWP0",
-    "CFSServerUrl": "http://192.168.6.65:9303/vCloudStorage",
+    "CFSServerUrl": "https://flyinsono-bj-1300984704.cos.ap-beijing.myqcloud.com",
     "CDNServerUrl": "http://cdn-bj.fis.plus",
-    "VCSStorageDisk":"D:\\vCloudStorage",
+    "VCSStorageDisk":"D:\\",
     "ManualDivisionForUpload": 209715200,
 	  "AutoSliceSizeForUpload": 5242880,
 	  "ForceHttps": false
@@ -163,9 +164,9 @@
     "VCloudClientsProxyHost": "192.168.6.6:9096"
   },
   "Course": {
-    "MyCourseUrl": "http://192.168.6.65:8080/open/school/#/my_course/",
-    "CourseHomeUrl": "http://192.168.6.65:8080/open/school/#/course/",
-    "CourseAPIUrl": "http://192.168.6.65:8303",
+    "MyCourseUrl": "http://127.0.0.1:8080/open/school/#/my_course/",
+    "CourseHomeUrl": "http://127.0.0.1:8080/open/school/#/course/",
+    "CourseAPIUrl": "http://127.0.0.1:8303",
     "HeartRateSeconds": 10
   },
   "DeviceForward": {
@@ -217,7 +218,7 @@
     "IsNeedImageReport": true
   },
   "HealthExamBooking":{
-    "GroupExamWebUrl": "http://192.168.6.65:8408/#/groupExam?code={0}",
+    "GroupExamWebUrl": "http://127.0.0.1:8408/#/groupExam?code={0}",
     "SyncSeconds": 300
   },
   "DeviceListener":{
@@ -232,7 +233,7 @@
     "OldAccount":"vitalsync103",
     "OldPassword":"e99a18c428cb38d5f260853678922e03",
     "PeripheralDevice":"ECG,Temp,SpO2,NIBP,GLU,Weight,ICReader,Urine,TwelveHeart,WHB,WEIGHTHEIGHT",
-    "HomePageUrl":"http://192.168.6.65:8408/#/cmsTemplatePreview?from=management",
+    "HomePageUrl":"http://127.0.0.1:8408/#/cmsTemplatePreview?from=management",
     "EncryptSensitiveInfo":true,
     "TemplateKeys": "ZZYBZK,SHFS,ZQCT,FZJC,XCZYWT,ZYYYFMYGHYFJZS,JKPJJZD,FJHSFFW,FJHRHSF,GXB,NCZ,YZJSZASFFW,YZJSZAGRXXBC,TNB,GXY,LNRZYYJKGLFWJL,LNRSHZLNLPGB,YCF_CH42TJKJCLB,YCF_CHFSLB,YCF_2_5CCQSFLB,YCF_DYCCQJCLB,YCF_JBXX,ET_ZYYJKGLLB,ET_3_6SETJKJCLB,ET_1_2SETJKJCLB,ET_1SNETJKJCLB,ET_XSEFSLB,LNRZLNLPG,YZJSZABCXX,MaternalHealthManagement,PrenatalFollowupServiceRecord,PostnatalVisitRecord,ET_FamilyVisitRecord,ET_1MSETJKJCLB,ET_3MSETJKJCLB,ET_6MSETJKJCLB,ET_8MSETJKJCLB,ET_12MSETJKJCLB,ET_18MSETJKJCLB,ET_24MSETJKJCLB,ET_30MSETJKJCLB,ET_3SETJKJCLB,ET_4SETJKJCLB,ET_5SETJKJCLB,ET_6SETJKJCLB,PostpartumHealthCheckup42Days,FollowUpTuberculosisFirstRecord,FollowUpTuberculosisRecord,DiabetesPrescription,HypertensionPrescription,PsychiatricPrescription,TuberculosisPrescription,FollowUpTuberculosisResultRecord"
   }