瀏覽代碼

内陆日期格式兼容

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

+ 5 - 13
services/commodity_coal_inland.go

@@ -103,7 +103,7 @@ func FileCoalInland() () {
 		}
 		}
 	}
 	}
 
 
-	for s, sheet := range xlFile.Sheets {
+	for _, sheet := range xlFile.Sheets {
 		sheetName = sheet.Name
 		sheetName = sheet.Name
 		fmt.Println("sheetName:",sheetName)
 		fmt.Println("sheetName:",sheetName)
 		var unit string
 		var unit string
@@ -169,19 +169,11 @@ func FileCoalInland() () {
 					if k < 18 {
 					if k < 18 {
 						var item models.BaseFromCoalmineInlandIndex
 						var item models.BaseFromCoalmineInlandIndex
 						if k == 0 {
 						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()
-								//fmt.Println(text)
-								//t, _ := time.ParseInLocation("01-02-06", text, time.Local)
-								//dataTime = t.Format(utils.FormatDate)
+							text := cell.String()
+							t, _ := time.ParseInLocation("01-02-06", text, time.Local)
+							dataTime = t.Format(utils.FormatDate)
+							if len(text) < 6{
 								dataTime = ExcelDateToDate(text).Format(utils.FormatDate)
 								dataTime = ExcelDateToDate(text).Format(utils.FormatDate)
-								//fmt.Println(dataTime)
 							}
 							}
 						}
 						}
 						if k > 0 {
 						if k > 0 {