|
@@ -14,6 +14,11 @@ import (
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
+const (
|
|
|
+ FormatTime = "15:04:05" //时间格式
|
|
|
+ FormatTimeStr = "15:04" //时间格式
|
|
|
+)
|
|
|
+
|
|
|
func IndexCreateCheck() (err error) {
|
|
|
fmt.Println("IndexCreateCheck")
|
|
|
indexObj := new(index.BaseFromMysteelChemicalIndex)
|
|
@@ -119,20 +124,28 @@ func IndexRefreshAll() {
|
|
|
MysteelChemicalRefresh(v.FilePath)
|
|
|
} else if v.Frequency == "年度" && nowDate == yearLast {
|
|
|
MysteelChemicalRefresh(v.FilePath)
|
|
|
- } else {
|
|
|
+ } else if v.Frequency == "日度" {
|
|
|
MysteelChemicalRefresh(v.FilePath)
|
|
|
+ } else {
|
|
|
+ global.LOG.Info("无效频度:" + v.IndexCode + ";" + v.Frequency)
|
|
|
}
|
|
|
+ time.Sleep(1 * time.Second)
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+//刷新周度指标数据
|
|
|
func IndexRefreshWeek() {
|
|
|
nowWeek := time.Now().Weekday().String()
|
|
|
nowWeekZn := utils.GetWeekZn(nowWeek)
|
|
|
+ fmt.Println("nowWeekZn:" + nowWeekZn)
|
|
|
|
|
|
indexObj := new(index.BaseFromMysteelChemicalIndex)
|
|
|
- list, err := indexObj.GetIndexRefreshWeek(nowWeek)
|
|
|
+
|
|
|
+ startTime := time.Now().Add(-1 * time.Minute).Format(FormatTimeStr)
|
|
|
+ endTime := time.Now().Add(1 * time.Minute).Format(FormatTimeStr)
|
|
|
+
|
|
|
+ list, err := indexObj.GetIndexRefreshWeek(nowWeekZn, startTime, endTime)
|
|
|
if err != nil {
|
|
|
fmt.Println("GetIndexRefreshWeek Err:" + err.Error())
|
|
|
return
|
|
@@ -153,9 +166,11 @@ func IndexRefreshWeek() {
|
|
|
MysteelChemicalRefresh(v.FilePath)
|
|
|
} else if v.Frequency == "年度" && nowDate == yearLast {
|
|
|
MysteelChemicalRefresh(v.FilePath)
|
|
|
- } else {
|
|
|
+ } else if v.Frequency == "日度" {
|
|
|
MysteelChemicalRefresh(v.FilePath)
|
|
|
+ } else {
|
|
|
+ global.LOG.Info("无效频度:" + v.IndexCode + ";" + v.Frequency)
|
|
|
}
|
|
|
}
|
|
|
return
|
|
|
-}
|
|
|
+}
|