初步完成用户电子邮箱绑定(激活)

This commit is contained in:
GoEdgeLab
2022-12-08 20:25:46 +08:00
parent 275d7f1622
commit b402bed15c
23 changed files with 302 additions and 161 deletions

View File

@@ -48,7 +48,7 @@ func (this *DNSTaskExecutor) Start() {
}
func (this *DNSTaskExecutor) Loop() error {
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
if !this.IsPrimaryNode() {
return nil
}

View File

@@ -38,7 +38,7 @@ func (this *EventLooper) Start() {
}
func (this *EventLooper) Loop() error {
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
if !this.IsPrimaryNode() {
return nil
}

View File

@@ -92,7 +92,7 @@ func (this *HealthCheckClusterTask) Stop() {
// Loop 单个循环任务
func (this *HealthCheckClusterTask) Loop() error {
// 检查是否为主节点
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
if !this.IsPrimaryNode() {
return nil
}

View File

@@ -86,7 +86,7 @@ func (this *LogTask) RunMonitor() {
func (this *LogTask) LoopMonitor() error {
// 检查是否为主节点
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
if !this.IsPrimaryNode() {
return nil
}

View File

@@ -57,7 +57,7 @@ func (this *NodeMonitorTask) Start() {
func (this *NodeMonitorTask) Loop() error {
// 检查是否为主节点
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
if !this.IsPrimaryNode() {
return nil
}

View File

@@ -40,7 +40,7 @@ func (this *NodeTaskExtractor) Start() {
func (this *NodeTaskExtractor) Loop() error {
// 检查是否为主节点
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
if !this.IsPrimaryNode() {
return nil
}

View File

@@ -45,7 +45,7 @@ func (this *SSLCertExpireCheckExecutor) Start() {
// Loop 单次执行
func (this *SSLCertExpireCheckExecutor) Loop() error {
// 检查是否为主节点
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
if !this.IsPrimaryNode() {
return nil
}

View File

@@ -53,7 +53,7 @@ func (this *SSLCertUpdateOCSPTask) Start() {
func (this *SSLCertUpdateOCSPTask) Loop() error {
// 检查是否为主节点
if !models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr() {
if !this.IsPrimaryNode() {
return nil
}

View File

@@ -2,7 +2,10 @@
package tasks
import "github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
import (
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
)
type BaseTask struct {
}
@@ -10,3 +13,7 @@ type BaseTask struct {
func (this *BaseTask) logErr(taskType string, errString string) {
remotelogs.Error("TASK", "run '"+taskType+"' failed: "+errString)
}
func (this *BaseTask) IsPrimaryNode() bool {
return models.SharedAPINodeDAO.CheckAPINodeIsPrimaryWithoutErr()
}