基础架构
This commit is contained in:
@@ -3,6 +3,7 @@ package entities
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -49,6 +50,14 @@ func (NotificationRecord) TableName() string {
|
||||
return "notification_records"
|
||||
}
|
||||
|
||||
// BeforeCreate GORM钩子:创建前自动生成UUID
|
||||
func (n *NotificationRecord) BeforeCreate(tx *gorm.DB) error {
|
||||
if n.ID == "" {
|
||||
n.ID = uuid.New().String()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsPending 检查通知是否待发送
|
||||
// 判断通知是否处于等待发送的状态
|
||||
func (n *NotificationRecord) IsPending() bool {
|
||||
|
||||
Reference in New Issue
Block a user