Browse Source

内陆日期读取再修改

ziwen 2 years ago
parent
commit
3fa5c1fb8c
1 changed files with 10 additions and 5 deletions
  1. 10 5
      services/commodity_coal_inland.go

+ 10 - 5
services/commodity_coal_inland.go

@@ -21,8 +21,8 @@ func FileCoalInland() () {
 			//go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "RefreshDataFromCoalInland ErrMsg:"+err.Error(), utils.EmailSendToUsers)
 		}
 	}()
-	path := "/Users/xi/Desktop/内陆17省动力煤终端用户供耗存%s.xlsx"
-	//path := "/home/code/python/coal_mail/emailFile/内陆17省动力煤终端用户供耗存%s.xlsx"
+	//path := "/Users/xi/Desktop/内陆17省动力煤终端用户供耗存%s.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))
 		fmt.Println(npath)
@@ -37,6 +37,7 @@ func FileCoalInland() () {
 		}
 		if i < 3 && !exist{
 			npath := "/home/code/python/coal_mail/emailFile/内陆17省动力煤终端用户供耗存.xlsx"
+			//npath := "/Users/xi/Desktop/内陆17省动力煤终端用户供耗存.xlsx"
 			fmt.Println(npath)
 			exist,err := PathExists(npath)
 			if err != nil {
@@ -170,13 +171,17 @@ func FileCoalInland() () {
 						if k == 0 {
 							if s == 0 {
 								text := cell.String()
+								//fmt.Println(text)
 								t, _ := time.ParseInLocation("01-02-06", text, time.Local)
 								dataTime = t.Format(utils.FormatDate)
+								//fmt.Println(dataTime)
 							} else {
 								text := cell.String()
-								t, _ := time.ParseInLocation("01-02-06", text, time.Local)
-								dataTime = t.Format(utils.FormatDate)
-								//dataTime = ExcelDateToDate(text).Format(utils.FormatDate)
+								//fmt.Println(text)
+								//t, _ := time.ParseInLocation("01-02-06", text, time.Local)
+								//dataTime = t.Format(utils.FormatDate)
+								dataTime = ExcelDateToDate(text).Format(utils.FormatDate)
+								//fmt.Println(dataTime)
 							}
 						}
 						if k > 0 {