From 2dacf8188d8bfb223092ac386768b19cf8f4ab64 Mon Sep 17 00:00:00 2001
From: lixin <lixinb@uniontech.com>
Date: Fri, 10 Nov 2023 10:23:53 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E5=AF=BC=E5=85=A5=E4=B8=BB?=
 =?UTF-8?q?=E6=9C=BA=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 index.py           | 28 ++++++++++++++++++++--------
 views/migration.py | 13 +++++++++++++
 2 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/index.py b/index.py
index c51a24c..edd4440 100644
--- a/index.py
+++ b/index.py
@@ -29,9 +29,20 @@ mods = {
         'host_info_display': server.host_info_display,
         'sql_task': server.modify_task_stream,
         'delete_host_info': server.delete_host_info,
+        'check_info': migration.check_info,
         }
 
 
+def check_methods():
+    if request.method == 'POST':
+        data = request.get_data()
+        json_data = json.loads(data)
+        mod = mods.get(json_data['mod'])
+        if mod:
+            response_str = mod(data)
+            return response_str
+        
+
 @app.route('/import_host_info', methods=['GET', 'POST'])
 def import_host_info():
     """
@@ -76,14 +87,15 @@ def delete_host_info():
         return Response(mod, content_type='application/json')
 
 
-def check_methods():
-    if request.method == 'POST':
-        data = request.get_data()
-        json_data = json.loads(data)
-        mod = mods.get(json_data['mod'])
-        if mod:
-            response_str = mod(data)
-            return response_str
+@app.route('/check_info', methods=['GET', 'POST'])
+def check_info():
+    """
+    检测系统版本和空间大小
+    :return:
+    """
+    mod = check_methods()
+    if mod:
+        return Response(mod, content_type='application/json')
 
 
 @app.route('/', methods=['GET', 'POST'])
diff --git a/views/migration.py b/views/migration.py
index f9fe01d..b359d36 100644
--- a/views/migration.py
+++ b/views/migration.py
@@ -1,11 +1,24 @@
 # SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
 # SPDX-License-Identifier:   MulanPubL-2.0-or-later
 import os
+
+from connect_sql import DBHelper
+from logger import *
+
 from flask import *
 from client_requests import *
 from sysmig_agent.utils import *
 
 
+def check_info(data):
+    """
+    检测系统版本和空间大小
+    :param data:
+    :return:
+    """
+    return 'success'
+
+
 def check_services(data, url):
     info = post_client_data(data, url)
     if info is None or info.status_code != 200:
-- 
2.20.1

