This commit is contained in:
Mr Chen
2024-10-23 14:49:03 +08:00
parent 13a7c20764
commit e1dd781b73
3 changed files with 148 additions and 4 deletions
+16
View File
@@ -115,6 +115,14 @@ def getUniqueId():
unique_id = "{0}".format(str_time)
return unique_id
def returnData(status, msg, data=None):
return {'status': status, 'msg': msg, 'data': data}
def returnJson(status, msg, data=None):
if data == None:
return getJson({'status': status, 'msg': msg})
return getJson({'status': status, 'msg': msg, 'data': data})
def readFile(filename):
# 读文件内容
try:
@@ -155,6 +163,14 @@ def systemdCfgDir():
# local test
return "/tmp"
def getJson(data):
import json
return json.dumps(data)
def getObjectByJson(data):
import json
return json.loads(data)
def getSslCrt():
if os.path.exists('/etc/ssl/certs/ca-certificates.crt'):