ziwen 3 years ago
parent
commit
d0d218d94b
1 changed files with 43 additions and 42 deletions
  1. 43 42
      services/commodity_coal_firm.go

+ 43 - 42
services/commodity_coal_firm.go

@@ -21,49 +21,50 @@ func FileCoalFirm() () {
 		}
 	}()
 	var xlFile *xlsx.File
-	syear := time.Now().Year()
-	nyear := strconv.Itoa(syear)
-	var smonth string
-	dateMonth := int(time.Now().Month())
-	smonth = strconv.Itoa(dateMonth)
+	//syear := time.Now().Year()
+	//nyear := strconv.Itoa(syear)
+	//var smonth string
+	//dateMonth := int(time.Now().Month())
+	//smonth = strconv.Itoa(dateMonth)
 	//path := "static/file/firm.xlsx"
-	path := "/home/code/python/coal_mail/emailFile/全国分企业煤炭产量旬度数据(%s年%s月).xlsx"
-	path = fmt.Sprintf(path,nyear,smonth)
-	exist,err := PathExists(path)
-	if err != nil {
-		fmt.Println(err)
-		return
-	}
-	if !exist {
-		path = "/home/code/python/coal_mail/emailFile/全国分企业煤炭产量旬度数据(%s年%s月中旬).xlsx"
-		path = fmt.Sprintf(path,nyear,smonth)
-		exist,err = PathExists(path)
-		if err != nil {
-			fmt.Println(err)
-			return
-		}
-	}
-	if !exist {
-		path = "/home/code/python/coal_mail/emailFile/全国分企业煤炭产量旬度数据(%s年%s月上旬).xlsx"
-		path = fmt.Sprintf(path,nyear,smonth)
-		exist,err = PathExists(path)
-		if err != nil {
-			fmt.Println(err)
-			return
-		}
-	}
-	if !exist {
-		//本月三个文件都没有,去取上一个月的
-		dateMonth = dateMonth - 1
-		smonth = strconv.Itoa(dateMonth)
-		path = "/home/code/python/coal_mail/emailFile/全国分企业煤炭产量旬度数据(%s年%s月).xlsx"
-		path = fmt.Sprintf(path,nyear,smonth)
-		exist,err = PathExists(path)
-		if err != nil {
-			fmt.Println(err)
-			return
-		}
-	}
+	//path := "/home/code/python/coal_mail/emailFile/全国分企业煤炭产量旬度数据(%s年%s月).xlsx"
+	path := "/home/code/python/coal_mail/emailFile/全国分企业煤炭产量旬度数据(2022年3月).xlsx"
+	//path = fmt.Sprintf(path,nyear,smonth)
+	//exist,err := PathExists(path)
+	//if err != nil {
+	//	fmt.Println(err)
+	//	return
+	//}
+	//if !exist {
+	//	path = "/home/code/python/coal_mail/emailFile/全国分企业煤炭产量旬度数据(%s年%s月中旬).xlsx"
+	//	path = fmt.Sprintf(path,nyear,smonth)
+	//	exist,err = PathExists(path)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//		return
+	//	}
+	//}
+	//if !exist {
+	//	path = "/home/code/python/coal_mail/emailFile/全国分企业煤炭产量旬度数据(%s年%s月上旬).xlsx"
+	//	path = fmt.Sprintf(path,nyear,smonth)
+	//	exist,err = PathExists(path)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//		return
+	//	}
+	//}
+	//if !exist {
+	//	//本月三个文件都没有,去取上一个月的
+	//	dateMonth = dateMonth - 1
+	//	smonth = strconv.Itoa(dateMonth)
+	//	path = "/home/code/python/coal_mail/emailFile/全国分企业煤炭产量旬度数据(%s年%s月).xlsx"
+	//	path = fmt.Sprintf(path,nyear,smonth)
+	//	exist,err = PathExists(path)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//		return
+	//	}
+	//}
 
 
 	//path = fmt.Sprintf(path,nyear,smonth)