上传周长任务bug
This commit is contained in:
parent
70d9a32a14
commit
3eccd42cdf
@ -18,18 +18,23 @@ func IsToday(d int64) bool {
|
||||
|
||||
// 判断是否是出于同一周
|
||||
func IsSameWeek(d int64) bool {
|
||||
// 将时间戳转换成一个 time.Time 对象
|
||||
t1 := time.Unix(d, 0)
|
||||
t2 := configure.Now()
|
||||
// 将时间戳转换为 time.Time 类型
|
||||
time1 := time.Unix(d, 0)
|
||||
time2 := configure.Now()
|
||||
|
||||
// 获取 t1 所在的周的第一天和 t2 所在的周的第一天
|
||||
t1FirstDay := t1.AddDate(0, 0, -int(t1.Weekday())+1)
|
||||
t2FirstDay := t2.AddDate(0, 0, -int(t2.Weekday())+1)
|
||||
// 判断两个时间所在的周的第一天是否相同
|
||||
return t1FirstDay.Equal(t2FirstDay)
|
||||
// 获取时间戳所属的年份和周数
|
||||
year1, week1 := time1.ISOWeek()
|
||||
year2, week2 := time2.ISOWeek()
|
||||
|
||||
// 判断是否同一年同一周
|
||||
if year1 == year2 && week1 == week2 {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
//判断是否大于1周
|
||||
// 判断是否大于1周
|
||||
func IsAfterWeek(d int64) bool {
|
||||
tt := time.Unix(d, 0)
|
||||
nowt := configure.Now()
|
||||
@ -138,7 +143,7 @@ func GetTodayZeroTime(curTime int64) int64 {
|
||||
return startTime.Unix()
|
||||
}
|
||||
|
||||
// 计算自然天数
|
||||
// 计算自然天数
|
||||
func DiffDays(t1, t2 int64) int {
|
||||
if t1 == t2 {
|
||||
return -1
|
||||
|
Loading…
Reference in New Issue
Block a user