feat: 支持每周任务重置和查询
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user