feat(notice): 通知三表与 SystemAdmin email 字段 Scheme 及迁移

This commit is contained in:
augushong
2026-10-12 10:37:23 +00:00
parent 19c61ebad5
commit f03e06276c
6 changed files with 223 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -0,0 +1,42 @@
<?php
namespace app\admin\scheme;
use app\common\scheme\BaseScheme;
use app\common\scheme\attribute\Table;
use app\common\scheme\attribute\Field;
use app\common\scheme\attribute\Component;
use app\common\scheme\attribute\Index;
#[Table(name: 'ul_system_notice', comment: '系统通知表')]
#[Index(columns: ['scene'], name: 'idx_scene', type: 'NORMAL')]
#[Index(columns: ['create_time'], name: 'idx_create_time', type: 'NORMAL')]
class SystemNotice extends BaseScheme
{
#[Field(type: 'int', length: 11, nullable: false, unsigned: true, autoIncrement: true, primary: true)]
public $id;
#[Field(type: 'varchar', length: 50, precision: 50, default: 'common', comment: '通知场景')]
public $scene;
#[Field(type: 'varchar', length: 255, precision: 255, comment: '通知标题')]
public $title;
#[Field(type: 'text', nullable: true, comment: '通知内容')]
public $content;
#[Field(type: 'varchar', length: 64, precision: 64, default: '', comment: '业务关联ID')]
public $biz_id;
#[Field(type: 'int', length: 11, default: '0', comment: '发送管理员ID', unsigned: true)]
public $send_admin_id;
#[Field(type: 'int', length: 11, default: '0', comment: '创建时间', unsigned: true)]
public $create_time;
#[Field(type: 'int', length: 11, default: '0', unsigned: true)]
public $update_time;
#[Field(type: 'int', length: 11, default: '0', unsigned: true)]
public $delete_time;
}

View File

@@ -0,0 +1,35 @@
<?php
namespace app\admin\scheme;
use app\common\scheme\BaseScheme;
use app\common\scheme\attribute\Table;
use app\common\scheme\attribute\Field;
use app\common\scheme\attribute\Component;
use app\common\scheme\attribute\Index;
#[Table(name: 'ul_system_notice_subscribe', comment: '系统通知订阅表')]
#[Index(columns: ['admin_id', 'scene', 'channel'], name: 'uniq_admin_scene_channel', type: 'UNIQUE')]
class SystemNoticeSubscribe extends BaseScheme
{
#[Field(type: 'int', length: 11, nullable: false, unsigned: true, autoIncrement: true, primary: true)]
public $id;
#[Field(type: 'int', length: 11, default: '0', comment: '管理员ID', unsigned: true)]
public $admin_id;
#[Field(type: 'varchar', length: 50, precision: 50, comment: '通知场景')]
public $scene;
#[Field(type: 'varchar', length: 20, precision: 20, comment: '投递渠道')]
public $channel;
#[Field(type: 'tinyint', length: 1, default: '1', comment: '订阅状态:0=退订,1=订阅')]
public $status;
#[Field(type: 'int', length: 11, default: '0', comment: '创建时间', unsigned: true)]
public $create_time;
#[Field(type: 'int', length: 11, default: '0', unsigned: true)]
public $update_time;
}

View File

@@ -0,0 +1,61 @@
<?php
namespace app\admin\scheme;
use app\common\scheme\BaseScheme;
use app\common\scheme\attribute\Table;
use app\common\scheme\attribute\Field;
use app\common\scheme\attribute\Component;
use app\common\scheme\attribute\Index;
#[Table(name: 'ul_system_notice_target', comment: '系统通知投递目标表')]
#[Index(columns: ['status', 'id'], name: 'idx_status_id', type: 'NORMAL')]
#[Index(columns: ['admin_id', 'channel', 'read_time'], name: 'idx_admin_channel_read', type: 'NORMAL')]
#[Index(columns: ['notice_id'], name: 'idx_notice_id', type: 'NORMAL')]
class SystemNoticeTarget extends BaseScheme
{
#[Field(type: 'int', length: 11, nullable: false, unsigned: true, autoIncrement: true, primary: true)]
public $id;
#[Field(type: 'int', length: 11, default: '0', comment: '通知ID', unsigned: true)]
public $notice_id;
#[Field(type: 'int', length: 11, default: '0', comment: '接收管理员ID', unsigned: true)]
public $admin_id;
#[Field(type: 'varchar', length: 20, precision: 20, comment: '投递渠道')]
public $channel;
#[Field(type: 'varchar', length: 255, precision: 255, default: '', comment: '投递目标地址')]
public $target_addr;
#[Field(type: 'tinyint', length: 1, default: '0', comment: '状态:0=待发,1=发送中,2=成功,3=失败')]
public $status;
#[Field(type: 'int', length: 11, default: '0', comment: '发送时间', unsigned: true)]
public $send_time;
#[Field(type: 'int', length: 11, default: '0', comment: '阅读时间', unsigned: true)]
public $read_time;
#[Field(type: 'int', length: 11, default: '0', comment: '抢占时间', unsigned: true)]
public $claim_time;
#[Field(type: 'varchar', length: 32, precision: 32, default: '', comment: '抢占令牌')]
public $claim_token;
#[Field(type: 'tinyint', length: 1, default: '0', comment: '重试次数')]
public $retry_count;
#[Field(type: 'int', length: 11, default: '0', comment: '下次重试时间', unsigned: true)]
public $next_retry_time;
#[Field(type: 'varchar', length: 500, precision: 500, default: '', comment: '错误信息')]
public $error_message;
#[Field(type: 'int', length: 11, default: '0', comment: '创建时间', unsigned: true)]
public $create_time;
#[Field(type: 'int', length: 11, default: '0', unsigned: true)]
public $update_time;
}