瀏覽代碼

数据修复

ziwen 2 年之前
父節點
當前提交
f437236c38
共有 2 個文件被更改,包括 14 次插入14 次删除
  1. 13 13
      services/commodity_coal_inland.go
  2. 1 1
      services/task.go

+ 13 - 13
services/commodity_coal_inland.go

@@ -24,19 +24,19 @@ func FileCoalInland() () {
 	//path := "static/file/内陆17省动力煤终端用户供耗存20220408.xlsx"
 	//path := "/home/code/python/coal_mail/emailFile/内陆17省动力煤终端用户供耗存%s.xlsx"
 	path := "/home/code/python/coal_mail/emailFile/内陆17省动力煤终端用户供耗存20220525.xlsx"
-	for i := 0;i < 7;i++{
-		npath := fmt.Sprintf(path,time.Now().AddDate(0,0,-i).Format(utils.FormatDateUnSpace))
-		fmt.Println(npath)
-		exist,err := PathExists(npath)
-		if err != nil {
-			fmt.Println(err)
-			return
-		}
-		if exist{
-			path = npath
-			break
-		}
-	}
+	//for i := 0;i < 7;i++{
+	//	npath := fmt.Sprintf(path,time.Now().AddDate(0,0,-i).Format(utils.FormatDateUnSpace))
+	//	fmt.Println(npath)
+	//	exist,err := PathExists(npath)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//		return
+	//	}
+	//	if exist{
+	//		path = npath
+	//		break
+	//	}
+	//}
 	xlFile, err := xlsx.OpenFile(path)
 	if err != nil {
 		fmt.Println(err)

+ 1 - 1
services/task.go

@@ -10,7 +10,7 @@ func Task() {
 	fmt.Println("start crawler")
 	refreshData := task.NewTask("refreshData", "0 0,30 16-20 * * *", RefreshData)
 	refreshEic := task.NewTask("refreshData", "0 0 1,6 * * *", RefreshEic)
-	refreshCoal := task.NewTask("refreshData", "0 27 16 * * *", RefreshCoal)
+	refreshCoal := task.NewTask("refreshData", "0 */5 16 * * *", RefreshCoal)
 	task.AddTask("数据爬取", refreshData)
 	task.AddTask("欧洲天然气爬取", refreshEic)
 	task.AddTask("中国煤炭网爬取", refreshCoal)