feat(notice): 通知菜单与配置默认值快照及对齐迁移

This commit is contained in:
augushong
2026-10-12 12:59:14 +00:00
parent 4f772fc843
commit f011c3ba7b
3 changed files with 168 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
use app\admin\service\InitDataAlignService;
use app\admin\service\MenuAlignService;
use think\console\Output;
use think\migration\Migrator;
/**
* 通知管理菜单与 notify 配置默认值对齐
*
* 背景:通知系统特性落地(system.notice 模块 + sysconfig notify 配置组),
* 快照变更配套迁移——adminInitData/SystemMenu.php 追加「通知管理」菜单
* (id=315,pid=228 系统管理组),adminInitData/SystemConfig.php 追加
* notify 组全部键的默认值行。按 ulthon-init-data-migration.md 铁律,
* 本迁移不硬编码任何数据副本,只调用对齐服务:
* - MenuAlignService::align('SystemMenu'):按快照显式 id 判存补插菜单行
* - InitDataAlignService::align():六域全量对齐(幂等安全),其中配置域
* 按 (group, name) 只插缺失并自动刷新 sysconfig 缓存
*
* 幂等:phinxlog 按文件记账保证只执行一次;重放由服务内的存在性检查兜底。
* down:数据对齐迁移不提供对称回滚(对齐只增不删,无法精确还原对齐前的
* 用户态数据),如需回退参考 adminInitData/ 快照手工处理。
*/
class NoticeMenuConfigAlign extends Migrator
{
public function up()
{
(new MenuAlignService(new Output()))->align('SystemMenu');
(new InitDataAlignService(new Output()))->align();
}
public function down()
{
// 有意留空:见类注释 down 说明
}
}