保存为了 websocket
This commit is contained in:
parent
440f13bee8
commit
8c07a5f5d7
1
go.mod
1
go.mod
|
@ -61,6 +61,7 @@ require (
|
||||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
|
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
|
||||||
github.com/valyala/fastrand v1.1.0 // indirect
|
github.com/valyala/fastrand v1.1.0 // indirect
|
||||||
github.com/valyala/histogram v1.2.0 // indirect
|
github.com/valyala/histogram v1.2.0 // indirect
|
||||||
|
github.com/yhat/wsutil v0.0.0-20170731153501-1d66fa95c997 // indirect
|
||||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 // indirect
|
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 // indirect
|
||||||
golang.org/x/crypto v0.11.0 // indirect
|
golang.org/x/crypto v0.11.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691 // indirect
|
golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691 // indirect
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -550,6 +550,8 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:
|
||||||
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||||
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI=
|
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI=
|
||||||
|
github.com/yhat/wsutil v0.0.0-20170731153501-1d66fa95c997 h1:1+FQ4Ns+UZtUiQ4lP0sTCyKSQ0EXoiwAdHZB0Pd5t9Q=
|
||||||
|
github.com/yhat/wsutil v0.0.0-20170731153501-1d66fa95c997/go.mod h1:DIGbh/f5XMAessMV/uaIik81gkDVjUeQ9ApdaU7wRKE=
|
||||||
github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
|
github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
|
||||||
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
|
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
|
||||||
github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
|
github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
|
||||||
|
|
|
@ -117,11 +117,11 @@ func init() {
|
||||||
EmailTasks: make(chan *EmailFormat, 10),
|
EmailTasks: make(chan *EmailFormat, 10),
|
||||||
Auth: smtp.PlainAuth(
|
Auth: smtp.PlainAuth(
|
||||||
"",
|
"",
|
||||||
"user@example.com",
|
"support@fusenpack.com",
|
||||||
"password",
|
"Fusenpack2021",
|
||||||
"smtp.gmail.com",
|
"smtp.gmail.com",
|
||||||
),
|
),
|
||||||
FromEmail: "user@example.com",
|
FromEmail: "support@fusenpack.com",
|
||||||
emailSending: make(map[string]*EmailTask, 10),
|
emailSending: make(map[string]*EmailTask, 10),
|
||||||
ResendTimeLimit: time.Minute * 1,
|
ResendTimeLimit: time.Minute * 1,
|
||||||
semaphore: make(chan struct{}, 10), // Initialize semaphore with a capacity of 10
|
semaphore: make(chan struct{}, 10), // Initialize semaphore with a capacity of 10
|
||||||
|
|
|
@ -71,7 +71,7 @@ func (l *UserEmailConfirmationLogic) UserEmailConfirmation(req *types.RequestEma
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println(jwtToken)
|
log.Println(jwtToken) // 通过websocket去, 送回通道
|
||||||
|
|
||||||
case "facebook":
|
case "facebook":
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (l *UserEmailRegisterLogic) UserEmailRegister(req *types.RequestEmailRegist
|
||||||
|
|
||||||
// 确认email 重新序列化
|
// 确认email 重新序列化
|
||||||
token.Email = req.Email
|
token.Email = req.Email
|
||||||
token.WCId = req.WCId
|
token.WId = req.Wid
|
||||||
token.GuestId = req.GuestId
|
token.GuestId = req.GuestId
|
||||||
|
|
||||||
clurl, err := l.svcCtx.TokenManger.Generate(token)
|
clurl, err := l.svcCtx.TokenManger.Generate(token)
|
||||||
|
|
|
@ -67,7 +67,7 @@ func (l *UserGoogleLoginLogic) UserGoogleLogin(req *types.RequestGoogleLogin, us
|
||||||
ctx := context.WithValue(context.Background(), oauth2.HTTPClient, customClient)
|
ctx := context.WithValue(context.Background(), oauth2.HTTPClient, customClient)
|
||||||
|
|
||||||
var googleOauthConfig = &oauth2.Config{
|
var googleOauthConfig = &oauth2.Config{
|
||||||
RedirectURL: "http://localhost:9900/api/user/oauth2/login/google",
|
RedirectURL: fmt.Sprintf("http://%s/api/user/oauth2/login/google", l.svcCtx.Config.MainAddress),
|
||||||
ClientID: l.svcCtx.Config.OAuth.Google.Appid,
|
ClientID: l.svcCtx.Config.OAuth.Google.Appid,
|
||||||
ClientSecret: l.svcCtx.Config.OAuth.Google.Secret,
|
ClientSecret: l.svcCtx.Config.OAuth.Google.Secret,
|
||||||
Scopes: []string{"https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"},
|
Scopes: []string{"https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"},
|
||||||
|
@ -79,6 +79,7 @@ func (l *UserGoogleLoginLogic) UserGoogleLogin(req *types.RequestGoogleLogin, us
|
||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
resp.SetStatus(basic.CodeApiErr)
|
resp.SetStatus(basic.CodeApiErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
ses := requests.NewSession()
|
ses := requests.NewSession()
|
||||||
ses.Config().SetProxy("socks5://127.0.0.1:1080") // 代理 为了测试功能
|
ses.Config().SetProxy("socks5://127.0.0.1:1080") // 代理 为了测试功能
|
||||||
|
|
||||||
|
@ -91,7 +92,6 @@ func (l *UserGoogleLoginLogic) UserGoogleLogin(req *types.RequestGoogleLogin, us
|
||||||
log.Println(r.Json())
|
log.Println(r.Json())
|
||||||
|
|
||||||
googleId := r.Json().Get("id").Int()
|
googleId := r.Json().Get("id").Int()
|
||||||
|
|
||||||
user, err := l.svcCtx.AllModels.FsUser.FindUserByGoogleId(context.TODO(), googleId)
|
user, err := l.svcCtx.AllModels.FsUser.FindUserByGoogleId(context.TODO(), googleId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != gorm.ErrRecordNotFound {
|
if err != gorm.ErrRecordNotFound {
|
||||||
|
|
|
@ -23,7 +23,7 @@ type RequestEmailConfirmation struct {
|
||||||
|
|
||||||
type RequestEmailRegister struct {
|
type RequestEmailRegister struct {
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
WCId uint64 `json:"wcid"`
|
Wid uint64 `json:"wid"`
|
||||||
GuestId uint64 `json:"guest_id"`
|
GuestId uint64 `json:"guest_id"`
|
||||||
RegisterToken string `json:"register_token"`
|
RegisterToken string `json:"register_token"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ type RegisterToken struct {
|
||||||
OperateType // 操作的类型, 验证的token 必须要继承这个
|
OperateType // 操作的类型, 验证的token 必须要继承这个
|
||||||
Id int64 // 注册的 id
|
Id int64 // 注册的 id
|
||||||
GuestId uint64 // guest_id 需要继承
|
GuestId uint64 // guest_id 需要继承
|
||||||
WCId uint64 // websocket 通道id
|
WId uint64 // websocket 通道id
|
||||||
Email string // email
|
Email string // email
|
||||||
Password string // 密码
|
Password string // 密码
|
||||||
Platform string // 平台
|
Platform string // 平台
|
||||||
|
|
|
@ -11,7 +11,7 @@ func TestGCM(t *testing.T) {
|
||||||
token := &auth.RegisterToken{
|
token := &auth.RegisterToken{
|
||||||
OperateType: auth.OpTypeRegister,
|
OperateType: auth.OpTypeRegister,
|
||||||
Password: "fusen_password",
|
Password: "fusen_password",
|
||||||
WCId: 123,
|
WId: 123,
|
||||||
}
|
}
|
||||||
|
|
||||||
key := "fusen123321"
|
key := "fusen123321"
|
||||||
|
@ -31,7 +31,7 @@ func BenchmarkCRT(b *testing.B) {
|
||||||
token := &auth.RegisterToken{
|
token := &auth.RegisterToken{
|
||||||
OperateType: auth.OpTypeRegister,
|
OperateType: auth.OpTypeRegister,
|
||||||
Password: "fusen_password",
|
Password: "fusen_password",
|
||||||
WCId: 123,
|
WId: 123,
|
||||||
}
|
}
|
||||||
|
|
||||||
key := "fusen123321"
|
key := "fusen123321"
|
||||||
|
@ -52,7 +52,7 @@ func BenchmarkGCM(b *testing.B) {
|
||||||
token := &auth.RegisterToken{
|
token := &auth.RegisterToken{
|
||||||
OperateType: auth.OpTypeRegister,
|
OperateType: auth.OpTypeRegister,
|
||||||
Password: "fusen_password",
|
Password: "fusen_password",
|
||||||
WCId: 123,
|
WId: 123,
|
||||||
}
|
}
|
||||||
|
|
||||||
key := "fusen123321"
|
key := "fusen123321"
|
||||||
|
@ -72,7 +72,7 @@ func TestCRT(t *testing.T) {
|
||||||
token := &auth.RegisterToken{
|
token := &auth.RegisterToken{
|
||||||
OperateType: auth.OpTypeRegister,
|
OperateType: auth.OpTypeRegister,
|
||||||
Password: "fusen_password",
|
Password: "fusen_password",
|
||||||
WCId: 123,
|
WId: 123,
|
||||||
}
|
}
|
||||||
|
|
||||||
key := "fusen123321"
|
key := "fusen123321"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user