浏览代码

Merge branch 'feature/jiayue' into debug

hsun 1 年之前
父节点
当前提交
26b1902b57
共有 1 个文件被更改,包括 12 次插入10 次删除
  1. 12 10
      services/index_data/jiayue_platform.go

+ 12 - 10
services/index_data/jiayue_platform.go

@@ -9,6 +9,7 @@ import (
 	"fmt"
 	"strconv"
 	"strings"
+	"time"
 )
 
 // GetIndexFromJiaYue 获取嘉悦指标信息
@@ -200,20 +201,20 @@ func GetPageIndexesFromJiaYue(pageIndex, pageSize int, sourceArr []string, keywo
 func GetNewIndexAndDataFromJiaYue() (indexList []*response.IndexResp, err error) {
 	defer func() {
 		if err != nil {
-			global.LOG.Info("GetIndexAndDataFromJiaYue Err: " + err.Error())
-			go alarm_msg.SendAlarmMsg("GetIndexAndDataFromJiaYue Err: "+err.Error(), 3)
+			global.LOG.Info("GetNewIndexAndDataFromJiaYue Err: " + err.Error())
+			go alarm_msg.SendAlarmMsg("GetNewIndexAndDataFromJiaYue Err: "+err.Error(), 3)
 			return
 		}
 	}()
 
-	indexCond := ``
+	indexCond := ` 1=1`
 	indexPars := make([]interface{}, 0)
-	// TODO:查询两个小时之前的数据(待定)
-	//timeBefore := time.Now().Local().Add(-2 * time.Hour).Format(utils.FormatDateTime)
-	//indexCond += ` CREATE_TIME <= TO_DATE (:1, 'yyyy-mm-dd hh24:mi:ss') `
-	//indexPars = append(indexPars, timeBefore.Format(utils.FormatDateTime))
+	// TODO:查询两个小时之前的数据(待定)
+	timeBefore := time.Now().Local().Add(-2 * time.Hour).Format(utils.FormatDateTime)
+	indexCond += ` AND CREATE_TIME <= TO_DATE (:1, 'yyyy-mm-dd hh24:mi:ss') `
+	indexPars = append(indexPars, timeBefore)
 
-	// TODO:测试
+	// 测试
 	//endTime := time.Date(2023, 6, 8, 0, 0, 0, 0, time.Local).Format(utils.FormatDateTime)
 	//indexCond += fmt.Sprintf(`CREATE_TIME <= TO_DATE ('%s', 'yyyy-mm-dd hh24:mi:ss')`, endTime)
 	//sourceArr := []string{"bloomberg", "bloomberg_tmp"}
@@ -225,8 +226,9 @@ func GetNewIndexAndDataFromJiaYue() (indexList []*response.IndexResp, err error)
 	//	str = strings.TrimRight(str, ",")
 	//	indexCond += fmt.Sprintf(` AND SOURCE_TYPE IN (%s)`, str)
 	//}
-	indexCond = ` ID = :1`
-	indexPars = append(indexPars, 180399)
+
+	//indexCond = ` ID = :1`
+	//indexPars = append(indexPars, 180399)
 
 	indexes, e := jiayue.GetDictIndex(indexCond, indexPars, "CREATE_TIME ASC")
 	if e != nil {