mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	增加基础的用户邮件通知
This commit is contained in:
		@@ -21,5 +21,5 @@ const (
 | 
			
		||||
	NodeVersion = "0.6.0"
 | 
			
		||||
 | 
			
		||||
	// SQLVersion SQL版本号
 | 
			
		||||
	SQLVersion = "4"
 | 
			
		||||
	SQLVersion = "6"
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								internal/db/models/user_email_notification_dao.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								internal/db/models/user_email_notification_dao.go
									
									
									
									
									
										Normal 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()
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										6
									
								
								internal/db/models/user_email_notification_dao_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								internal/db/models/user_email_notification_dao_test.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
package models_test
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	_ "github.com/go-sql-driver/mysql"
 | 
			
		||||
	_ "github.com/iwind/TeaGo/bootstrap"
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										24
									
								
								internal/db/models/user_email_notification_model.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								internal/db/models/user_email_notification_model.go
									
									
									
									
									
										Normal 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{}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1
									
								
								internal/db/models/user_email_notification_model_ext.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								internal/db/models/user_email_notification_model_ext.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
package models
 | 
			
		||||
@@ -33,6 +33,7 @@ type User struct {
 | 
			
		||||
	PriceType       string   `field:"priceType"`       // 计费类型:traffic|bandwidth
 | 
			
		||||
	PricePeriod     string   `field:"pricePeriod"`     // 结算周期
 | 
			
		||||
	ServersEnabled  uint8    `field:"serversEnabled"`  // 是否禁用所有服务
 | 
			
		||||
	Notification    dbs.JSON `field:"notification"`    // 通知设置
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type UserOperator struct {
 | 
			
		||||
@@ -65,6 +66,7 @@ type UserOperator struct {
 | 
			
		||||
	PriceType       any // 计费类型:traffic|bandwidth
 | 
			
		||||
	PricePeriod     any // 结算周期
 | 
			
		||||
	ServersEnabled  any // 是否禁用所有服务
 | 
			
		||||
	Notification    any // 通知设置
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewUserOperator() *UserOperator {
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -434,7 +434,7 @@ func (this *SQLDump) applyQueue(db *dbs.DB, newResult *SQLDumpResult, showLog bo
 | 
			
		||||
						continue
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					args = append(args, k+"=?")
 | 
			
		||||
					args = append(args, "`"+k+"`"+"=?")
 | 
			
		||||
					values = append(values, v)
 | 
			
		||||
				}
 | 
			
		||||
				values = append(values, one.GetInt("id"))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user