This commit is contained in:
2025-08-06 22:19:09 +08:00
parent d34e2d17f4
commit 2074215180

View File

@@ -191,9 +191,11 @@ func (w *WestDexService) Encrypt(data string) string {
return encryptedValue
}
// GetDateRange 返回今天到明天的日期范围,格式为 "yyyyMMdd-yyyyMMdd"
// GetDateRange 返回前后五天的日期范围,格式为 "yyyyMMdd-yyyyMMdd"
func (w *WestDexService) GetDateRange() string {
today := time.Now().Format("20060102") // 获取今天的日期
tomorrow := time.Now().Add(24 * time.Hour).Format("20060102") // 获取明天的日期
return fmt.Sprintf("%s-%s", today, tomorrow) // 拼接日期范围并返回
// 获取前五天
beforeFiveDays := time.Now().Add(-120 * time.Hour).Format("20060102")
// 获取后五天
afterFiveDays := time.Now().Add(120 * time.Hour).Format("20060102")
return fmt.Sprintf("%s-%s", beforeFiveDays, afterFiveDays) // 拼接日期范围并返回
}