增加基础的用户邮件通知

This commit is contained in:
刘祥超
2022-12-27 18:53:49 +08:00
parent 874139ea07
commit c9b666e5bc
8 changed files with 64 additions and 3 deletions

View File

@@ -21,5 +21,5 @@ const (
NodeVersion = "0.6.0" NodeVersion = "0.6.0"
// SQLVersion SQL版本号 // SQLVersion SQL版本号
SQLVersion = "4" SQLVersion = "6"
) )

View File

@@ -0,0 +1,28 @@
package models
import (
_ "github.com/go-sql-driver/mysql"
"github.com/iwind/TeaGo/Tea"
"github.com/iwind/TeaGo/dbs"
)
type UserEmailNotificationDAO dbs.DAO
func NewUserEmailNotificationDAO() *UserEmailNotificationDAO {
return dbs.NewDAO(&UserEmailNotificationDAO{
DAOObject: dbs.DAOObject{
DB: Tea.Env,
Table: "edgeUserEmailNotifications",
Model: new(UserEmailNotification),
PkName: "id",
},
}).(*UserEmailNotificationDAO)
}
var SharedUserEmailNotificationDAO *UserEmailNotificationDAO
func init() {
dbs.OnReady(func() {
SharedUserEmailNotificationDAO = NewUserEmailNotificationDAO()
})
}

View File

@@ -0,0 +1,6 @@
package models_test
import (
_ "github.com/go-sql-driver/mysql"
_ "github.com/iwind/TeaGo/bootstrap"
)

View File

@@ -0,0 +1,24 @@
package models
// UserEmailNotification 邮件通知队列
type UserEmailNotification struct {
Id uint64 `field:"id"` // ID
Email string `field:"email"` // 邮箱地址
Subject string `field:"subject"` // 标题
Body string `field:"body"` // 内容
CreatedAt uint64 `field:"createdAt"` // 创建时间
Day string `field:"day"` // YYYYMMDD
}
type UserEmailNotificationOperator struct {
Id any // ID
Email any // 邮箱地址
Subject any // 标题
Body any // 内容
CreatedAt any // 创建时间
Day any // YYYYMMDD
}
func NewUserEmailNotificationOperator() *UserEmailNotificationOperator {
return &UserEmailNotificationOperator{}
}

View File

@@ -0,0 +1 @@
package models

View File

@@ -33,6 +33,7 @@ type User struct {
PriceType string `field:"priceType"` // 计费类型traffic|bandwidth PriceType string `field:"priceType"` // 计费类型traffic|bandwidth
PricePeriod string `field:"pricePeriod"` // 结算周期 PricePeriod string `field:"pricePeriod"` // 结算周期
ServersEnabled uint8 `field:"serversEnabled"` // 是否禁用所有服务 ServersEnabled uint8 `field:"serversEnabled"` // 是否禁用所有服务
Notification dbs.JSON `field:"notification"` // 通知设置
} }
type UserOperator struct { type UserOperator struct {
@@ -65,6 +66,7 @@ type UserOperator struct {
PriceType any // 计费类型traffic|bandwidth PriceType any // 计费类型traffic|bandwidth
PricePeriod any // 结算周期 PricePeriod any // 结算周期
ServersEnabled any // 是否禁用所有服务 ServersEnabled any // 是否禁用所有服务
Notification any // 通知设置
} }
func NewUserOperator() *UserOperator { func NewUserOperator() *UserOperator {

File diff suppressed because one or more lines are too long

View File

@@ -434,7 +434,7 @@ func (this *SQLDump) applyQueue(db *dbs.DB, newResult *SQLDumpResult, showLog bo
continue continue
} }
args = append(args, k+"=?") args = append(args, "`"+k+"`"+"=?")
values = append(values, v) values = append(values, v)
} }
values = append(values, one.GetInt("id")) values = append(values, one.GetInt("id"))