diff --git a/stc/database/20250623000000_install_notice_table.php b/stc/database/20250623000000_install_notice_table.php new file mode 100644 index 0000000..2f45735 --- /dev/null +++ b/stc/database/20250623000000_install_notice_table.php @@ -0,0 +1,54 @@ +_create_notice(); + } + + /** + * 创建数据对象 + * @class JlNoticeNotice + * @table jl_notice_notice + * @return void + */ + private function _create_notice() + { + // 创建数据表对象 + $table = $this->table('jl_notice_notice', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '消息通知', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['staff_id', 'integer', ['default' => NULL, 'null' => false, 'comment' => '员工ID']], + ['type', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '类型']], + ['content', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '信息内容']], + ['link', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '跳转链接(如果有)']], + ['create_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '创建时间']], + ['read_at', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '已读时间']], + ], [ + 'type', 'staff_id', + ], false); + } + +} diff --git a/stc/database/20250623000001_install_notice_menu.php b/stc/database/20250623000001_install_notice_menu.php new file mode 100644 index 0000000..09db807 --- /dev/null +++ b/stc/database/20250623000001_install_notice_menu.php @@ -0,0 +1,54 @@ +insertMenu(); + } + + /** + * 初始化系统菜单 + * @return void + * @throws \Exception + */ + private function insertMenu() + { + + // 初始化菜单数据 + PhinxExtend::write2menu([ + [ + 'name' => '消息通知', + 'sort' => '105', + 'subs' => Service::menu(), + ], + ], [ + 'url|node' => 'notice/notice/index' + ]); + } +} \ No newline at end of file