Browse Source

新增PC获取序列号接口3

chenshibin 4 years ago
parent
commit
28ae3ff3be
1 changed files with 23 additions and 0 deletions
  1. 23 0
      Service/CommonService.py

+ 23 - 0
Service/CommonService.py

@@ -1,4 +1,5 @@
 # -*- coding: utf-8 -*-
+import base64
 import datetime
 import time
 from pathlib import Path
@@ -260,3 +261,25 @@ class CommonService:
         tmp = ':'.join(map(lambda x: "%02x" % x, macArray))
         # print(tmp)
         return tmp.upper()
+
+    @staticmethod
+    def decode_data(content, start=1, end=4):
+        try:
+            for i in range(start, end):
+                if i == 1:
+                    content = base64.b64decode(content)
+                    content = content.decode('utf-8')
+                    content = content[1:-1]
+                if i == 2:
+                    content = base64.b64decode(content)
+                    content = content.decode('utf-8')
+                    content = content[2:-2]
+                if i == 3:
+                    content = base64.b64decode(content)
+                    content = content.decode('utf-8')
+                    content = content[3:-3]
+
+            return content
+        except Exception as e:
+            print(e)
+            return None