Skip to content

Commit

Permalink
优化首次安装
Browse files Browse the repository at this point in the history
  • Loading branch information
ichynul committed Dec 7, 2024
1 parent 7ee015c commit e499e3a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/admin/controller/Creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ public function relations()

foreach ($relations as $key => &$pdata) {
if ($pdata['relation_type'] == 'belongs_to') {
$pdata['field_name'] = $pdata['foreign_key'];
$pdata['field_name'] = $pdata['foreign_key'];
$pdata['relation_key'] = $pdata['local_key'];
} else {
$pdata['relation_key'] = $pdata['foreign_key'];
Expand Down Expand Up @@ -805,6 +805,8 @@ public function lang()
$form->text('COLUMN_NAME', '字段名')->rendering(function ($field) {
if (!isset($field->data['__can_delete__']) || $field->data['__can_delete__'] == 0) {
$field->readonly();
} else {
$field->readonly(false);
}
})->required(),
$form->show('COLUMN_TYPE', '字段类型')->default('--'),
Expand Down
10 changes: 8 additions & 2 deletions src/admin/controller/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public function dbconfig()
}
$this->success('数据库配置成功', url('prepare'), 1);
} else {
builderRes::getInstance()->loaded();
$builder = Builder::getInstance('扩展管理', '数据库配置');

$builder->content(3)->display('');
Expand Down Expand Up @@ -223,7 +224,7 @@ public function dbconfig()

$url = url('prepare');
$form->raw('tips', '提示')->value('<p>数据库配置信息将保存在<b>`config/database.php`</b>文件中,请确保程序对此文件有可写权限。'
. '如果您不想通过此程序修改配置,请手动修改数据库配置文件,<a href="' . $url . '">后点此进入</a>下一步,如果仍然回到此页面,请检查配置。</p>');
. '如果您不想通过此程序修改配置,请手动修改数据库配置文件,<a href="' . $url . '">[点此]</a>进入下一步,如果仍然回到此页面,请检查配置。</p>');

$data = Session::get('dbconfig');

Expand Down Expand Up @@ -272,7 +273,7 @@ public function prepare()
return "<h4>(4/4)</h4><p>安装[builder.mdeditor],完成!</p><script>setTimeout(function(){location.href='{$next}'},1000);</script>";
} else {
ExtLoader::trigger('tpext_extension_prepare_done'); //如果扩展要在首次安装时静默安装,可监听此事件
$next = url('/admin/extension/index');
$next = url('/admin/extension/index', ['first_install' => 1]);
return "<h4>(预安装完成)</h4><p>即将跳转[扩展管理]页面,继续安装其他扩展!</p><script>setTimeout(function(){location.href='{$next}'},1500);</script>";
}
}
Expand Down Expand Up @@ -414,6 +415,7 @@ protected function buildDataList($where = [], $sortOrder = '', $page = 1, &$tota
protected function buildTable(&$data = [], $isExporting = false)
{
$table = $this->table;
$first_install = input('first_install', 0);

$table->show('title', '标题');
$table->show('name', '标识');
Expand Down Expand Up @@ -495,6 +497,10 @@ protected function buildTable(&$data = [], $isExporting = false)

$table->useCheckbox(false);
$table->useChooseColumns(false); //切换远程和本地表格列不同,会有问题,干脆禁用。

if ($first_install == 1) {
$table->addBottom()->content()->display('<div style="padding:10px"><h5>首次安装提示:</h5>安装完成点此<a href="' . url('/admin/index') . '">[进入后台]</a><br>此页面排版错乱?点此<a href="' . url('prepare') . '">[刷新]</a>样式资源</div>');
}
}

public function install()
Expand Down

0 comments on commit e499e3a

Please sign in to comment.