From f03e06276c0d5e22894de3bda560823c5aa98414 Mon Sep 17 00:00:00 2001 From: augushong Date: Mon, 12 Oct 2026 10:37:23 +0000 Subject: [PATCH] =?UTF-8?q?feat(notice):=20=E9=80=9A=E7=9F=A5=E4=B8=89?= =?UTF-8?q?=E8=A1=A8=E4=B8=8E=20SystemAdmin=20email=20=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=20Scheme=20=E5=8F=8A=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/scheme/SystemAdmin.php | 3 + app/admin/scheme/SystemNotice.php | 42 +++++++++++++ app/admin/scheme/SystemNoticeSubscribe.php | 35 +++++++++++ app/admin/scheme/SystemNoticeTarget.php | 61 ++++++++++++++++++ .../20261012000001_system_notice_tables.php | 62 +++++++++++++++++++ .../20261012000002_system_admin_email.php | 20 ++++++ 6 files changed, 223 insertions(+) create mode 100644 app/admin/scheme/SystemNotice.php create mode 100644 app/admin/scheme/SystemNoticeSubscribe.php create mode 100644 app/admin/scheme/SystemNoticeTarget.php create mode 100644 database/migrations/20261012000001_system_notice_tables.php create mode 100644 database/migrations/20261012000002_system_admin_email.php diff --git a/app/admin/scheme/SystemAdmin.php b/app/admin/scheme/SystemAdmin.php index 52e101f..52f2632 100644 --- a/app/admin/scheme/SystemAdmin.php +++ b/app/admin/scheme/SystemAdmin.php @@ -56,4 +56,7 @@ class SystemAdmin extends BaseScheme #[Field(length: 50, precision: 50, default: '', comment: '昵称')] public $nickname; + + #[Field(type: 'char', length: 100, precision: 100, default: '', comment: '电子邮箱')] + public $email; } \ No newline at end of file diff --git a/app/admin/scheme/SystemNotice.php b/app/admin/scheme/SystemNotice.php new file mode 100644 index 0000000..53ee16f --- /dev/null +++ b/app/admin/scheme/SystemNotice.php @@ -0,0 +1,42 @@ +table('system_notice') + ->setComment('系统通知表') + ->addColumn('scene', 'string', ['limit' => 50, 'null' => true, 'default' => 'common', 'comment' => '通知场景']) + ->addColumn('title', 'string', ['limit' => 255, 'null' => true, 'comment' => '通知标题']) + ->addColumn('content', 'text', ['null' => true, 'comment' => '通知内容']) + ->addColumn('biz_id', 'string', ['limit' => 64, 'null' => true, 'default' => '', 'comment' => '业务关联ID']) + ->addColumn('send_admin_id', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '发送管理员ID']) + ->addColumn('create_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '创建时间']) + ->addColumn('update_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false]) + ->addColumn('delete_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false]) + ->addIndex(['scene'], ['name' => 'idx_scene']) + ->addIndex(['create_time'], ['name' => 'idx_create_time']) + ->create(); + + $this->table('system_notice_target') + ->setComment('系统通知投递目标表') + ->addColumn('notice_id', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '通知ID']) + ->addColumn('admin_id', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '接收管理员ID']) + ->addColumn('channel', 'string', ['limit' => 20, 'null' => true, 'comment' => '投递渠道']) + ->addColumn('target_addr', 'string', ['limit' => 255, 'null' => true, 'default' => '', 'comment' => '投递目标地址']) + ->addColumn('status', 'tinyinteger', ['limit' => 1, 'null' => true, 'default' => 0, 'comment' => '状态:0=待发,1=发送中,2=成功,3=失败']) + ->addColumn('send_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '发送时间']) + ->addColumn('read_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '阅读时间']) + ->addColumn('claim_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '抢占时间']) + ->addColumn('claim_token', 'string', ['limit' => 32, 'null' => true, 'default' => '', 'comment' => '抢占令牌']) + ->addColumn('retry_count', 'tinyinteger', ['limit' => 1, 'null' => true, 'default' => 0, 'comment' => '重试次数']) + ->addColumn('next_retry_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '下次重试时间']) + ->addColumn('error_message', 'string', ['limit' => 500, 'null' => true, 'default' => '', 'comment' => '错误信息']) + ->addColumn('create_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '创建时间']) + ->addColumn('update_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false]) + ->addIndex(['status', 'id'], ['name' => 'idx_status_id']) + ->addIndex(['admin_id', 'channel', 'read_time'], ['name' => 'idx_admin_channel_read']) + ->addIndex(['notice_id'], ['name' => 'idx_notice_id']) + ->create(); + + $this->table('system_notice_subscribe') + ->setComment('系统通知订阅表') + ->addColumn('admin_id', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '管理员ID']) + ->addColumn('scene', 'string', ['limit' => 50, 'null' => true, 'comment' => '通知场景']) + ->addColumn('channel', 'string', ['limit' => 20, 'null' => true, 'comment' => '投递渠道']) + ->addColumn('status', 'tinyinteger', ['limit' => 1, 'null' => true, 'default' => 1, 'comment' => '订阅状态:0=退订,1=订阅']) + ->addColumn('create_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '创建时间']) + ->addColumn('update_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false]) + ->addIndex(['admin_id', 'scene', 'channel'], ['unique' => true, 'name' => 'uniq_admin_scene_channel']) + ->create(); + } +} diff --git a/database/migrations/20261012000002_system_admin_email.php b/database/migrations/20261012000002_system_admin_email.php new file mode 100644 index 0000000..16b33ac --- /dev/null +++ b/database/migrations/20261012000002_system_admin_email.php @@ -0,0 +1,20 @@ +table('system_admin'); + + if(!$table->hasColumn('email')){ + $table->addColumn(Column::char('email', 100)->setDefault('')->setComment('电子邮箱')); + $table->update(); + } + } +}