Roc 2 лет назад
Родитель
Сommit
61e2fa79d6
1 измененных файлов с 14 добавлено и 1 удалено
  1. 14 1
      services/base_from_python.go

+ 14 - 1
services/base_from_python.go

@@ -73,6 +73,8 @@ func ExecPythonCode(edbCode, reqCode string) (dataMap EdbDataFromPython, err err
 		}
 	}()
 
+	AnalysisPythonCode(reqCode)
+
 	//获取python文件的绝对地址
 	pythonFile, err := getPythonFileAbsolutePath(edbCode)
 	if err != nil {
@@ -147,7 +149,7 @@ func ExecPythonCode(edbCode, reqCode string) (dataMap EdbDataFromPython, err err
 	}
 
 	//err = json.Unmarshal([]byte(resultStr), &dataMap)
-	fmt.Println(dataMap)
+	//fmt.Println(dataMap)
 	return
 }
 
@@ -181,3 +183,14 @@ func getPythonFrontStr() string {
 func getPythonLaterStr() string {
 	return "\nprint(\"result=\", result.to_json())\ndb.close()"
 }
+
+// AnalysisPythonCode 解析Python代码,获取关联code
+func AnalysisPythonCode(pythonCode string) (dataMap EdbDataFromPython, err error, errMsg string) {
+	//edbCodeList := make([]string, 0)
+
+	tmpList := strings.Split(pythonCode, "\n")
+	for _, v := range tmpList {
+		fmt.Println(v)
+	}
+	return
+}