فهرست منبع

Merge branch 'pool_mt'

ziwen 3 سال پیش
والد
کامیت
ee4ee1986f
2فایلهای تغییر یافته به همراه10 افزوده شده و 3 حذف شده
  1. 9 2
      services/commodity_coal_inland.go
  2. 1 1
      services/task.go

+ 9 - 2
services/commodity_coal_inland.go

@@ -18,7 +18,7 @@ func FileCoalInland() () {
 			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "RefreshDataFromCoalInland ErrMsg:"+err.Error(), utils.EmailSendToUsers)
 		}
 	}()
-	//path := "static/file/内陆17省动力煤终端用户供耗存20220322.xlsx"
+	//path := "static/file/内陆17省动力煤终端用户供耗存20220408.xlsx"
 	path := "/home/code/python/coal_mail/emailFile/内陆17省动力煤终端用户供耗存%s.xlsx"
 	for i := 0;i < 7;i++{
 		npath := fmt.Sprintf(path,time.Now().AddDate(0,0,-i).Format(utils.FormatDateUnSpace))
@@ -70,6 +70,13 @@ func FileCoalInland() () {
 
 	for s, sheet := range xlFile.Sheets {
 		sheetName = sheet.Name
+		fmt.Println("sheetName:",sheetName)
+		var unit string
+		if sheetName == "可用天数" {
+			unit = "天"
+		}else {
+			unit = "万吨"
+		}
 		//遍历行读取
 		maxCol := sheet.MaxCol
 		for i := 0; i < maxCol; i++ {
@@ -144,7 +151,7 @@ func FileCoalInland() () {
 							item.GroupName = groupMap[k]
 							item.Source = "内陆十七省"
 							item.DataTime = dataTime
-							item.Unit = "万吨"
+							item.Unit = unit
 							item.Frequency = "日度"
 							item.ModifyTime = time.Now()
 							item.CreateTime = time.Now()

+ 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 16 17 * * *", RefreshCoal)
+	refreshCoal := task.NewTask("refreshData", "0 0 18-23 * * *", RefreshCoal)
 	task.AddTask("数据爬取", refreshData)
 	task.AddTask("欧洲天然气爬取", refreshEic)
 	task.AddTask("中国煤炭网爬取", refreshCoal)