完善一部分websocket的代码

This commit is contained in:
eson
2023-08-24 18:28:01 +08:00
parent 190010a6fe
commit 6919d61ef5
10 changed files with 182 additions and 13 deletions

View File

@@ -25,7 +25,7 @@ func BenchmarkConfirmationLink(b *testing.B) {
cl := NewConfirmationLink[Register](key, "http://localhost:9900/api/auth/oauth2/register")
for i := 0; i < b.N; i++ {
uri, _ := cl.Generate(&Register{Id: 39, Password: "21dsadsad", platform: "google", Expired: time.Now()})
uri, _ := cl.Generate(&Register{Id: 39, Password: "21dsadsad", platform: "google", Expired: time.Now().UTC()})
u, _ := url.Parse(uri)
token := u.Query()["token"]
cl.Decrypt(token[0])
@@ -125,7 +125,7 @@ func TestConfirmationLink(t *testing.T) {
key := "21321321"
cl := NewConfirmationLink[Register](key, "http://localhost:9900/api/auth/oauth2/register")
uri, _ := cl.Generate(&Register{Id: 39, Password: "21dsadsad", platform: "google", Expired: time.Now()})
uri, _ := cl.Generate(&Register{Id: 39, Password: "21dsadsad", platform: "google", Expired: time.Now().UTC()})
log.Println(uri)
u, _ := url.Parse(uri)

View File

@@ -11,7 +11,7 @@ import (
// TestGenJwt 测试jwt序列化
func TestGenJwt(t *testing.T) {
now := time.Now().Unix()
now := time.Now().UTC().Unix()
secret := "fusen123"
a, err := GenerateJwtToken(&secret, 3600, now, 123, 1234)
if err != nil {
@@ -34,7 +34,7 @@ func TestGenJwt(t *testing.T) {
}
func TestGenBackendJwt(t *testing.T) {
now := time.Now().Unix()
now := time.Now().UTC().Unix()
secret := "fusen_backend_2023"
a, err := GenerateBackendJwtToken(&secret, 3600*24*7, now, 1, 1)
if err != nil {