feat(filter): 实现发件人黑白名单数据库迁移、控制器与API路由及收件列表联动

This commit is contained in:
xuans committed 2026-09-13 04:33:42 +08:00
1 parent b107090168
commit 48eaba57c1
9 files changed
+498 -38

No files matched your search

+13 -6
View File
@@ -2,7 +2,7 @@ package models
import "time"
// UserContact 保存单个用户的历史写信收件人,用于写信页自动补全与联系人管理
// UserContact 保存单个用户的厇史写信收仴人,用于写信页自动补全与遗系人管理
type UserContact struct {
ID int `xorm:"id bigint unsigned not null pk autoincr" json:"id"`
UserID int `xorm:"user_id bigint not null" json:"-"`
@@ -13,12 +13,19 @@ type UserContact struct {
func (UserContact) TableName() string { return "user_contact" }
// UserTrustedSender 保存单个用户手动标记信任的发件人白名单,免除安全警告
const (
FilterTypeWhitelist = "whitelist"
FilterTypeBlacklist = "blacklist"
)
// UserTrustedSender 保存单个用户标记的白名单(信任)与黑名单发件人,控制收信安全警告与拒信/风险标议
type UserTrustedSender struct {
ID int `xorm:"id bigint unsigned not null pk autoincr" json:"id"`
UserID int `xorm:"user_id bigint not null" json:"-"`
Email string `xorm:"email varchar(255) notnull" json:"email"`
CreatedAt time.Time `xorm:"created_at datetime created notnull" json:"created_at"`
ID int `xorm:"id bigint unsigned not null pk autoincr" json:"id"`
UserID int `xorm:"user_id bigint not null" json:"-"`
Email string `xorm:"email varchar(255) notnull" json:"email"`
FilterType string `xorm:"filter_type varchar(20) notnull default('whitelist')" json:"filter_type"`
CreatedAt time.Time `xorm:"created_at datetime created notnull" json:"created_at"`
UpdatedAt *time.Time `xorm:"updated_at datetime updated null" json:"updated_at,omitempty"`
}
func (UserTrustedSender) TableName() string { return "user_trusted_sender" }