feat: update random name generator

This commit is contained in:
Rogee
2025-05-12 10:47:07 +08:00
parent bd9ab160c7
commit f8678c1197
3 changed files with 38 additions and 4 deletions

View File

@@ -1,8 +1,6 @@
package http
import (
"fmt"
"math/rand"
"net/url"
"time"
@@ -55,8 +53,8 @@ func (ctl *auth) Login(ctx fiber.Ctx, code, state, redirect string) error {
authUserInfo = &wechat.AuthorizeUserInfo{
City: "",
Country: "",
Headimgurl: fmt.Sprintf("/avatar/%d.jpeg", 1+rand.Intn(79)),
Nickname: "暂未设置昵称",
Headimgurl: utils.RandomAvatar(),
Nickname: utils.RandomNickname(),
Openid: token.Openid,
Privilege: []string{},
Province: "",

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
package utils
import "testing"
func TestNames_Random(t *testing.T) {
for i := 0; i < 10; i++ {
name := RandomNickname()
t.Logf("name: %s", name)
}
}