pop3收件箱出现已删除邮件bug
从sqlx切换到xorm
第三方客户端发信出现在草稿箱bug
This commit is contained in:
jinnrry committed 2024-04-13 09:26:34 +08:00
1 parent 096b4b8fed
commit cc4aa851bc
43 files changed
+256 -396

No files matched your search

-38
View File
@@ -1,11 +1,8 @@
package config
import (
"embed"
"encoding/json"
"io/fs"
"os"
"strings"
)
var IsInit bool
@@ -38,9 +35,6 @@ type Config struct {
TablesInitData map[string]string `json:"-"`
}
//go:embed tables/*
var tableConfig embed.FS
const DBTypeMySQL = "mysql"
const DBTypeSQLite = "sqlite"
const SSLTypeAuto = "0" //自动生成证书
@@ -76,38 +70,6 @@ func Init() {
Instance.Domains = []string{Instance.Domain}
}
// 读取表设置
Instance.Tables = map[string]string{}
Instance.TablesInitData = map[string]string{}
root := "tables/mysql"
if Instance.DbType == DBTypeSQLite {
root = "tables/sqlite"
}
err = fs.WalkDir(tableConfig, root, func(path string, info fs.DirEntry, err error) error {
if !info.IsDir() && strings.HasSuffix(info.Name(), ".sql") {
tableName := strings.ReplaceAll(info.Name(), ".sql", "")
i, e := tableConfig.ReadFile(path)
if e != nil {
panic(e)
}
if len(i) == 0 || strings.TrimSpace(string(i)) == "" {
return nil
}
if strings.Contains(path, "data") {
Instance.TablesInitData[tableName] = string(i)
} else {
Instance.Tables[tableName] = string(i)
}
}
return nil
})
if err != nil {
panic(err)
}
if Instance.Domain != "" && Instance.IsInit {
IsInit = true
}
Whitespace-only changes.
Whitespace-only changes.
-27
View File
@@ -1,27 +0,0 @@
CREATE table email
(
id INT unsigned AUTO_INCREMENT PRIMARY KEY COMMENT '自增id',
type tinyint(4) NOT NULL DEFAULT 0 COMMENT '邮件类型,0:收到的邮件,1:发送的邮件',
group_id int unsigned NOT NULL DEFAULT 0 COMMENT '分组id',
subject varchar(1000) NOT NULL DEFAULT '' COMMENT '邮件标题',
reply_to json COMMENT '回复人',
from_name varchar(50) NOT NULL DEFAULT '' COMMENT '发件人名称',
from_address varchar(150) NOT NULL DEFAULT '' COMMENT '发件人邮件地址',
`to` json COMMENT '收件人信息',
bcc json COMMENT '抄送',
cc json COMMENT '抄送',
`text` text COMMENT '邮件文本内容',
html mediumtext COMMENT 'html格式内容',
sender json COMMENT '发件人',
attachments json COMMENT '附件内容',
spf_check tinyint(1) DEFAULT 0 COMMENT '0未校验,1校验通过,2校验未通过',
dkim_check tinyint(1) DEFAULT 0 COMMENT '0未校验,1校验通过,2校验未通过',
status tinyint(4) NOT NULL DEFAULT 0 COMMENT '0未发送,1已发送,2发送失败,3删除',
send_user_id int unsigned NOT NULL DEFAULT 0 COMMENT '发件人用户id',
is_read tinyint(1) NOT NULL DEFAULT 0 COMMENT '未读0,已读1',
error text COMMENT '错误信息记录',
cron_send_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '定时发送邮件的发送时间',
send_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '发件日期',
create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
)COMMENT='邮件内容表'
-7
View File
@@ -1,7 +0,0 @@
CREATE TABLE `group`
(
id INT unsigned AUTO_INCREMENT PRIMARY KEY COMMENT '自增id',
name varchar(10) NOT NULL DEFAULT '' COMMENT '分组名称',
user_id INT unsigned NOT NULL DEFAULT 0 COMMENT '用户id',
parent_id INT unsigned COMMENT '父级组ID'
)COMMENT='分组信息表'
-10
View File
@@ -1,10 +0,0 @@
CREATE TABLE `rule`
(
id INT unsigned AUTO_INCREMENT PRIMARY KEY COMMENT '自增id',
user_id int NOT NULL DEFAULT 0 COMMENT '用户id',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '规则名称',
`value` json NOT NULL COMMENT '规则内容',
action int not null default 0 comment '执行动作,1已读,2转发,3删除',
params varchar(255) not null default '' comment '执行参数',
sort int not null default 0 COMMENT '排序,越大约优先'
) COMMENT '收信规则表'
-7
View File
@@ -1,7 +0,0 @@
CREATE TABLE sessions
(
token CHAR(43) PRIMARY KEY,
data BLOB NOT NULL,
expiry TIMESTAMP(6) NOT NULL,
KEY `sessions_expiry_idx` (`expiry`)
)COMMENT='系统session数据表';
-8
View File
@@ -1,8 +0,0 @@
CREATE TABLE user
(
id INT unsigned AUTO_INCREMENT PRIMARY KEY COMMENT '自增id',
account varchar(20) COMMENT '账号登陆名',
name varchar(10) COMMENT '用户名',
password char(32) COMMENT '登陆密码,两次md5加盐,md5(md5(password+"pmail") +"pmail2023")',
UNIQUE INDEX udx_account ( account )
)COMMENT='登陆信息表'
-8
View File
@@ -1,8 +0,0 @@
CREATE TABLE user_auth
(
id INT unsigned AUTO_INCREMENT PRIMARY KEY COMMENT '自增id',
user_id int COMMENT '用户id',
email_account varchar(30) COMMENT '收件人前缀',
UNIQUE INDEX udx_uid_ename ( user_id, email_account),
UNIQUE INDEX udx_ename_uid ( email_account,user_id )
)COMMENT='登陆信息表'
Whitespace-only changes.
Whitespace-only changes.
-27
View File
@@ -1,27 +0,0 @@
CREATE table email
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
type tinyint(4) NOT NULL DEFAULT 0,
group_id INTEGER NOT NULL DEFAULT 0,
subject varchar(1000) NOT NULL DEFAULT '',
reply_to json,
from_name varchar(50) NOT NULL DEFAULT '',
from_address varchar(150) NOT NULL DEFAULT '',
`to` json,
bcc json,
cc json,
`text` text,
html text,
sender json,
attachments json ,
spf_check tinyint(1) DEFAULT 0 ,
dkim_check tinyint(1) DEFAULT 0 ,
status tinyint(4) NOT NULL DEFAULT 0 ,
send_user_id int unsigned NOT NULL DEFAULT 0 ,
is_read tinyint(1) NOT NULL DEFAULT 0 ,
error text ,
cron_send_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
send_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
)
-7
View File
@@ -1,7 +0,0 @@
CREATE TABLE `group`
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
name varchar(10) NOT NULL DEFAULT '',
parent_id INTEGER NOT NULL DEFAULT 0,
user_id INTEGER NOT NULL DEFAULT 0
)
-10
View File
@@ -1,10 +0,0 @@
create table rule
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id int,
name varchar(255) default '' not null,
value json not null,
action int default 0 not null,
params varchar(255) default '' not null,
sort int default 0 not null
)
-8
View File
@@ -1,8 +0,0 @@
CREATE TABLE sessions
(
token TEXT PRIMARY KEY,
data BLOB NOT NULL,
expiry REAL NOT NULL
);
CREATE INDEX sessions_expiry_idx ON sessions (expiry);
-8
View File
@@ -1,8 +0,0 @@
CREATE TABLE user
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
account varchar(20),
name varchar(10),
password char(32)
);
CREATE UNIQUE INDEX udx_account on user (account);
@@ -1,9 +0,0 @@
CREATE TABLE user_auth
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id int ,
email_account varchar(30)
);
CREATE UNIQUE INDEX udx_uid_ename on user_auth ( user_id, email_account);
CREATE UNIQUE INDEX udx_ename_uid on user_auth ( email_account,user_id );