Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
93f7fd8c12
@ -24195,7 +24195,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_852",
|
||||
"text": "本周累计经验副本消耗300体力"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 201,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
@ -24217,7 +24217,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_853",
|
||||
"text": "本周累计经验副本消耗600体力"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 201,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
@ -24239,7 +24239,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_854",
|
||||
"text": "本周累计经验副本消耗1000体力"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 201,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
@ -24261,7 +24261,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_855",
|
||||
"text": "本周累计消耗3000000点金币"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 68,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
@ -24283,7 +24283,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_856",
|
||||
"text": "本周累计消耗6000000点金币"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 68,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
@ -24305,7 +24305,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_857",
|
||||
"text": "本周累计消耗10000000点金币"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 68,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
@ -24327,7 +24327,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_858",
|
||||
"text": "本周累计装备副本消耗300体力"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 201,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
@ -24349,7 +24349,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_859",
|
||||
"text": "本周累计装备副本消耗600体力"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 201,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
@ -24371,7 +24371,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_860",
|
||||
"text": "本周累计装备副本消耗1000体力"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 201,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
@ -24393,7 +24393,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_861",
|
||||
"text": "本周累计回响副本消耗300体力"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 202,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
@ -24415,7 +24415,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_862",
|
||||
"text": "本周累计回响副本消耗600体力"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 202,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
@ -24437,7 +24437,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_863",
|
||||
"text": "本周累计回响副本消耗1000体力"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 202,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
@ -24459,7 +24459,7 @@
|
||||
"key": "buried_buried_condi_tasktxt_864",
|
||||
"text": "备用埋点"
|
||||
},
|
||||
"type": 130,
|
||||
"type": 43,
|
||||
"valid": 0,
|
||||
"head": {
|
||||
"a": "attr",
|
||||
|
@ -18,15 +18,20 @@ 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周
|
||||
|
@ -100,6 +100,24 @@ func BenchmarkRandNumbers(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsSameWeek(t *testing.T) {
|
||||
|
||||
// 将时间戳转换为 time.Time 类型
|
||||
time1 := time.Now()
|
||||
time2 := time.Now()
|
||||
|
||||
// 获取时间戳所属的年份和周数
|
||||
year1, week1 := time1.ISOWeek()
|
||||
year2, week2 := time2.ISOWeek()
|
||||
|
||||
// 判断是否同一年同一周
|
||||
if year1 == year2 && week1 == week2 {
|
||||
fmt.Println("两个时间戳属于同一周")
|
||||
} else {
|
||||
fmt.Println("两个时间戳不属于同一周")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWeekIntervalTime(t *testing.T) {
|
||||
ti := utils.WeekIntervalTime(0)
|
||||
format := "2006-01-02 15:04:05"
|
||||
|
Loading…
Reference in New Issue
Block a user