|
@@ -164,7 +164,20 @@ const (
|
|
|
// @datetime 2023-12-19 09:39:05
|
|
|
func YongyiDownloadDaily(cont context.Context) (err error) {
|
|
|
// 2023年12月19日涌益咨询日度数据
|
|
|
- filePath := fmt.Sprintf("%s/%s%s", utils.YongyiReadFilePath, time.Now().Format("2006年1月2日"), "涌益咨询日度数据.xlsx")
|
|
|
+ now := time.Now()
|
|
|
+ weekday := int(now.Weekday())
|
|
|
+ if weekday == 0 {
|
|
|
+ weekday = 7
|
|
|
+ }
|
|
|
+ // 计算与周一的天数差
|
|
|
+ // 如果当天是周五,差值为0;周六为1,以此类推,直到下个周四为6
|
|
|
+ offset := (weekday - 5) % 7 // 加7是为了处理weekday为0(周日)的情况
|
|
|
+ if offset == 1 || offset == 2 {
|
|
|
+ // 获取周一的日期
|
|
|
+ now = now.AddDate(0, 0, -offset)
|
|
|
+ }
|
|
|
+
|
|
|
+ filePath := fmt.Sprintf("%s/%s%s", utils.YongyiReadFilePath, now.Format("2006年1月2日"), "涌益咨询日度数据.xlsx")
|
|
|
|
|
|
fmt.Println("YongyiDownloadDaily: " + filePath)
|
|
|
_, e := os.Stat(filePath)
|
|
@@ -204,7 +217,7 @@ func YongyiDownloadWeekyly(cont context.Context) (err error) {
|
|
|
fmt.Printf("endDate: %s\n", endDate)
|
|
|
dataFileExsit := false
|
|
|
chartFileExist := false
|
|
|
- filePath := fmt.Sprintf("%s/%s-%s%s", utils.YongyiReadFilePath, startDate, endDate, "涌益咨询周度数据.xlsx")
|
|
|
+ filePath := fmt.Sprintf("%s/%s-%s%s", utils.YongyiReadFilePath, startDate, endDate, "涌益咨询 周度数据.xlsx")
|
|
|
fmt.Println("YongyiDownloadWeekyly: " + filePath)
|
|
|
|
|
|
// 从已处理的表格中查询是否已存在,如果已存在,也无需下载
|