mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-11-08 20:10:50 +08:00
refactor(install): 种子退役,migrate:run 一条命令完成建表与初始数据
新增 InitDataAlignService 六域对齐(超管/角色/权限节点/配置/快捷入口/商城演示)与 20260909130000 迁移;SystemAdmin 快照以字面量哈希入库;删除种子三件与安装锁依赖,seeds 目录留 .gitkeep;README/tests/规则等 11 处说明同步。 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
1
database/seeds/.gitkeep
Normal file
1
database/seeds/.gitkeep
Normal file
@@ -0,0 +1 @@
|
||||
# 种子已退役:migrate:run 是唯一安装命令;下游业务仍可放自己的种子文件
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
use app\admin\model\SystemConfig;
|
||||
use app\admin\service\AdminInitService;
|
||||
use app\admin\service\TriggerService;
|
||||
use think\migration\Seeder;
|
||||
|
||||
class InitBaseAdminData extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run Method.
|
||||
*
|
||||
* Write your database seeder using this method.
|
||||
*
|
||||
* More information on writing seeders is available here:
|
||||
* http://docs.phinx.org/en/latest/seeding.html
|
||||
*/
|
||||
public function run():void
|
||||
{
|
||||
$output = $this->getOutput();
|
||||
|
||||
TriggerService::updateSysconfig();
|
||||
|
||||
$install_lock = sysconfig('base_admin_install', true, 0);
|
||||
|
||||
if ($install_lock == 1) {
|
||||
$output->writeln('系统已初始化,跳过当前程序');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$model_config = SystemConfig::where('group', 'system')
|
||||
->where('name', 'base_admin_install')
|
||||
->find();
|
||||
|
||||
if (empty($model_config)) {
|
||||
$model_config = new SystemConfig();
|
||||
|
||||
$model_config->group = 'system';
|
||||
$model_config->name = 'base_admin_install';
|
||||
$model_config->remark = '系统初始化锁定,请勿修改,避免插入重复数据';
|
||||
}
|
||||
|
||||
$model_config->value = 1;
|
||||
|
||||
$model_config->save();
|
||||
|
||||
TriggerService::updateSysconfig();
|
||||
|
||||
(new AdminInitService($output))->init();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user