完善一部分websocket的代码
This commit is contained in:
@@ -54,7 +54,7 @@ func (m *EmailSender) ProcessEmailTasks() {
|
||||
|
||||
m.emailSending[emailformat.TargetEmail] = &EmailTask{
|
||||
Email: emailformat,
|
||||
SendTime: time.Now(),
|
||||
SendTime: time.Now().UTC(),
|
||||
}
|
||||
m.lock.Unlock()
|
||||
|
||||
@@ -82,7 +82,7 @@ func (m *EmailSender) Resend(emailTarget string, content []byte) {
|
||||
defer m.lock.Unlock()
|
||||
|
||||
// Check if the email task still exists and has not been sent successfully
|
||||
if task, ok := m.emailSending[emailTarget]; ok && task.SendTime.Add(m.ResendTimeLimit).After(time.Now()) {
|
||||
if task, ok := m.emailSending[emailTarget]; ok && task.SendTime.Add(m.ResendTimeLimit).After(time.Now().UTC()) {
|
||||
err := smtp.SendMail(emailTarget, m.Auth, m.FromEmail, []string{emailTarget}, content)
|
||||
if err != nil {
|
||||
log.Printf("Failed to resend email to %s: %v\n", emailTarget, err)
|
||||
@@ -102,7 +102,7 @@ func (m *EmailSender) ClearExpiredTasks() {
|
||||
|
||||
m.lock.Lock()
|
||||
for email, task := range m.emailSending {
|
||||
if task.SendTime.Add(m.ResendTimeLimit).Before(time.Now()) {
|
||||
if task.SendTime.Add(m.ResendTimeLimit).Before(time.Now().UTC()) {
|
||||
delete(m.emailSending, email)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,28 @@ func (l *UserEmailConfirmationLogic) UserEmailConfirmation(req *types.RequestEma
|
||||
case "facebook":
|
||||
case "fusen":
|
||||
|
||||
user, err := l.svcCtx.AllModels.FsUser.RegisterByFusen(l.ctx, token)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatus(basic.CodeDbSqlErr)
|
||||
}
|
||||
|
||||
// 创建签证
|
||||
jwtToken, err := auth.GenerateJwtTokenUint64(
|
||||
auth.StringToHash(*user.PasswordHash),
|
||||
l.svcCtx.Config.Auth.AccessExpire,
|
||||
time.Now().Unix(),
|
||||
user.Id,
|
||||
0,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
log.Println(jwtToken)
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user