Selaa lähdekoodia

Merge branch 'hotfix/ths_hf_0526' into debug

hsun 3 päivää sitten
vanhempi
commit
daf9278929
2 muutettua tiedostoa jossa 6 lisäystä ja 4 poistoa
  1. 2 2
      controllers/base_from_ths_hf.go
  2. 4 2
      services/edb_data_calculate_stl.go

+ 2 - 2
controllers/base_from_ths_hf.go

@@ -235,12 +235,12 @@ func (this *ThsHfController) BaseAdd() {
 		pars := make([]interface{}, 0)
 		pars = append(pars, params.StockCode, params.EdbCode)
 		item, e := indexOb.GetItemByCondition(cond, pars, "")
-		if e != nil && e.Error() != utils.ErrNoRow() {
+		if e != nil && !utils.IsErrNoRow(e) {
 			br.Msg = "操作失败"
 			br.ErrMsg = fmt.Sprintf("获取原始指标失败, %v", e)
 			return
 		}
-		if item != nil {
+		if item != nil && item.BaseFromThsHfIndexId > 0 {
 			br.Ret = 200
 			br.Success = true
 			br.Msg = "操作成功"

+ 4 - 2
services/edb_data_calculate_stl.go

@@ -160,7 +160,7 @@ func RefreshStlData(edbInfoId int) (msg string, err error) {
 		msg = "保存数据到Excel失败"
 		return
 	}
-	defer os.Remove(loadFilePath)
+	//defer os.Remove(loadFilePath)
 	saveFilePath := exPath + "/" + strconv.Itoa(fromEdbInfo.SysUserId) + "_" + time.Now().Format(utils.FormatDateTimeUnSpace) + "_res" + ".xlsx"
 	err = execStlPythonCode(loadFilePath, saveFilePath, stlConfig.Period, stlConfig.Seasonal, stlConfig.Trend, stlConfig.TrendDeg, stlConfig.SeasonalDeg, stlConfig.LowPassDeg, stlConfig.Fraction, stlConfig.Robust)
 	if err != nil {
@@ -173,7 +173,7 @@ func RefreshStlData(edbInfoId int) (msg string, err error) {
 		msg = "解析Excel失败"
 		return
 	}
-	defer os.Remove(saveFilePath)
+	//defer os.Remove(saveFilePath)
 	edbInfo, err := models.GetEdbInfoById(edbInfoId)
 	if err != nil {
 		msg = "获取指标信息失败"
@@ -552,6 +552,8 @@ print(output)
 	}
 
 	pythonCode = fmt.Sprintf(pythonCode, path, period, seasonal, trend, fraction, seasonalDeg, trendDeg, lowPassDeg, robustStr, toPath)
+	utils.FileLog.Info("stlpythoncode")
+	utils.FileLog.Info(pythonCode)
 	cmd := exec.Command(utils.PYTHON_PATH, "-c", pythonCode)
 	_, err = cmd.CombinedOutput()
 	if err != nil {