فهرست منبع

fix:stl预览时使用配置文件参数

zqbao 1 روز پیش
والد
کامیت
d33de8f35c
1فایلهای تغییر یافته به همراه7 افزوده شده و 2 حذف شده
  1. 7 2
      services/data/stl/stl.go

+ 7 - 2
services/data/stl/stl.go

@@ -67,7 +67,7 @@ func GenerateStlEdbData(req *request.StlConfigReq, adminId int) (resp *response.
 	case LAST_N_YEARS:
 		condition += " AND data_time >=?"
 		year := time.Now().Year()
-		lastNyear, er := strconv.Atoi(req.LastNYear)
+		lastNyear, er := strconv.Atoi(confReq.LastNYear)
 		if er != nil {
 			msg = "最近N年输入不合法"
 			err = er
@@ -513,7 +513,12 @@ print(output)
 
 	pythonCode = fmt.Sprintf(pythonCode, path, period, seasonal, trend, fraction, seasonalDeg, trendDeg, lowPassDeg, robustStr, toPath)
 	utils.FileLog.Info("stl exec python code:%s", pythonCode)
-	cmd := exec.Command(`python3`, "-c", pythonCode)
+	var cmd *exec.Cmd
+	if utils.RunMode == "debug" {
+		cmd = exec.Command(`D:\conda\envs\py36\python`, "-c", pythonCode)
+	} else {
+		cmd = exec.Command(`python3`, "-c", pythonCode)
+	}
 	output, err := cmd.CombinedOutput()
 	if err != nil {
 		utils.FileLog.Info(`execStlPythonCode error:%s, input: path:%s, toPath:%s, period:%d, seasonal:%d, trend:%d, trendDeg:%d, seasonalDeg:%d, lowPassDeg:%d, fraction:%g, robust:%s, output:%s`, err.Error(), path, toPath, period, seasonal, trend, trendDeg, seasonalDeg, lowPassDeg, fraction, robustStr, string(output))