代码调整

This commit is contained in:
ziming 2025-05-28 20:40:53 +08:00
parent a7e9fc653b
commit 84451f8aaa
1 changed files with 16 additions and 0 deletions

View File

@ -3,9 +3,25 @@ package helper
import ( import (
"fmt" "fmt"
"testing" "testing"
"time"
) )
func TestHashMod(t *testing.T) { func TestHashMod(t *testing.T) {
serverId := HashMod("1dfsfdsfsddf12dddd5451212iodewnsanf2") serverId := HashMod("1dfsfdsfsddf12dddd5451212iodewnsanf2")
fmt.Println(serverId) fmt.Println(serverId)
} }
func TestNoticeTime(t *testing.T) {
now := time.Now()
// 获取七天前的日期
noticeStartDay := now.AddDate(0, 0, -29)
// 获取七天前 00:00:00 的时间
startTime := time.Date(noticeStartDay.Year(), noticeStartDay.Month(), noticeStartDay.Day(), 0, 0, 0, 0, noticeStartDay.Location())
noticeEndDay := now.AddDate(0, 0, -28)
// 获取昨天 23:59:59 的时间
endTime := time.Date(noticeEndDay.Year(), noticeEndDay.Month(), noticeEndDay.Day(), 23, 59, 59, 0, noticeEndDay.Location())
t.Logf("startTime:%s,endTime:%s", startTime, endTime)
}