feat: 支持每周任务重置和查询
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-05 14:56:28 +08:00
committed by cnb
parent 10e1126cd7
commit 2259093790
4 changed files with 61 additions and 19 deletions

View File

@@ -51,6 +51,21 @@ func IsToday(t1 *gtime.Time) bool {
t.Month() == now.Month() &&
t.Day() == now.Day()
}
func IsWEEK(t1 *gtime.Time) bool {
if t1 == nil {
return false
}
t := t1.Time
// 获取当前时间
now := time.Now()
_, nweek := now.ISOWeek()
_, tweek := now.ISOWeek()
// 比较年、月、日是否相同
return t.Year() == now.Year() &&
tweek == nweek
}
type TaskService struct {
BaseService