Browse Source

更新服务器配置

dukuisong 4 weeks ago
parent
commit
e48e958394
3 changed files with 12 additions and 11 deletions
  1. 1 1
      config.json
  2. 6 6
      office_helper.py
  3. 5 4
      tools/serve_client.py

+ 1 - 1
config.json

@@ -1 +1 @@
-{"username": "admin", "password": "jxkj123456", "worker_path": "E:\\\\PycharmProjects\\\\office_plugin\\\\tools\\\\storage", "server": "http://120.195.49.22:7215"}
+{"username": "admin", "password": "jxkj123456", "worker_path": "E:\\\\PycharmProjects\\\\office_plugin\\\\tools\\\\storage", "server": "http://221.226.175.250:7215"}

+ 6 - 6
office_helper.py

@@ -51,12 +51,12 @@ def start_all_services(serve_client, work_path):
 
 if __name__ == "__main__":
 
-    if not os.path.exists(f'{dl_code}:\\ProgramData\\OfficeAssistant\\config.json'):
-        logger.error('"config.json" is not find')
-        sys.exit(0)
-
-    with open(f'{dl_code}:\\ProgramData\\OfficeAssistant\\config.json', 'r', encoding='utf-8') as f:
-        # with open(f'config.json', 'r', encoding='utf-8') as f:
+    # if not os.path.exists(f'{dl_code}:\\ProgramData\\OfficeAssistant\\config.json'):
+    #     logger.error('"config.json" is not find')
+    #     sys.exit(0)
+    #
+    # with open(f'{dl_code}:\\ProgramData\\OfficeAssistant\\config.json', 'r', encoding='utf-8') as f:
+    with open(f'config.json', 'r', encoding='utf-8') as f:
         args = json.load(f)
     args['worker_path'] = args['worker_path'].replace('\\\\', '\\')
     if not (args.get('username') and args.get('password')):

+ 5 - 4
tools/serve_client.py

@@ -7,6 +7,7 @@ import re
 import requests
 from Crypto.Cipher import AES
 
+from config import TARGET_URL
 from tools.logger_handle import logger
 
 
@@ -170,7 +171,7 @@ class ServerClient:
         files = [
             ('file', (os.path.basename(local_file), open(local_file, 'rb'),
                       'application/vnd.openxmlformats-officedocument.wordprocessingml.document'))]
-        resp = requests.post(f'http://120.195.49.22:7215/mgr/document/dcLibrary/upload/{folder_id}',
+        resp = requests.post(f'{TARGET_URL}/mgr/document/dcLibrary/upload/{folder_id}',
                              headers=self.headers, data=payload, files=files)
         if resp.json().get('code') == 0:
             return True
@@ -178,7 +179,7 @@ class ServerClient:
             return False
 
     def get_folder_tree(self):
-        resp = requests.get('http://120.195.49.22:7215/mgr/document/dcLibrary/tree/myFolder', headers=self.headers)
+        resp = requests.get(f'{TARGET_URL}/mgr/document/dcLibrary/tree/myFolder', headers=self.headers)
         if resp.json().get('code') == 0:
             return self.decryption(resp.json()['data'])
         else:
@@ -186,7 +187,7 @@ class ServerClient:
 
     def get_template_file_info(self, file_id):
         try:
-            resp = requests.get(f'http://120.195.49.22:7215/mgr/document/dcLibrary/template/get/{file_id}',
+            resp = requests.get(f'{TARGET_URL}/mgr/document/dcLibrary/template/get/{file_id}',
                                 headers=self.headers)
             if resp.json().get('code') == 0:
                 return self.decryption(resp.json()['data'])
@@ -230,7 +231,7 @@ class ServerClient:
 
 
 if __name__ == '__main__':
-    client = ServerClient('http://120.195.49.22:7215', 'admin', 'jxkj123456')
+    client = ServerClient(f'{TARGET_URL}', 'admin', 'jxkj123456')
     res = client.decryption(
         "")
     print(res)