build admin for hr

This commit is contained in:
xiaomlove
2021-06-22 13:49:54 +08:00
parent 142e18bed0
commit cd5f1305e9
31 changed files with 46 additions and 36 deletions
+18 -2
View File
@@ -46,11 +46,11 @@ class Install
for ($i = 1; $i < $step; $i++) {
$progressKey = $this->getProgressKey($i);
if (!isset($_SESSION[$progressKey])) {
$this->doLog("check step: $i, session doesn't have, session: " . json_encode($_SESSION));
$this->doLog("check step: $i, session doesn't have" );
return false;
}
}
$this->doLog("check step: $step, can access, session: " . json_encode($_SESSION));
$this->doLog("check step: $step, can access" );
return true;
}
@@ -554,4 +554,20 @@ class Install
$this->doLog("[MIGRATE] success.");
}
}
public function runDatabaseSeeder()
{
if (!WITH_LARAVEL) {
throw new \RuntimeException('Laravel is not avaliable.');
}
$command = "php " . ROOT_PATH . "artisan db:seed";
$result = exec($command, $output, $result_code);
$this->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
$this->doLog("output: " . json_encode($output));
if ($result_code != 0) {
throw new \RuntimeException(json_encode($output));
} else {
$this->doLog("[DATABASE_SEED] success.");
}
}
}
+8 -14
View File
@@ -61,18 +61,7 @@ if ($currentStep == 3) {
while ($isPost) {
try {
// $install->createTable($shouldCreateTable);
if (!WITH_LARAVEL) {
throw new \RuntimeException('Laravel is not avaliable.');
}
$command = "php " . ROOT_PATH . "artisan migrate --force";
$result = exec($command, $output, $result_code);
$install->doLog(sprintf('command: %s, result_code: %s, result: %s', $command, $result_code, $result));
$install->doLog("output: " . json_encode($output));
if ($result_code != 0) {
throw new \RuntimeException(json_encode($output));
} else {
$install->doLog("[CREATE TABLE] success.");
}
$install->runMigrate();
$install->nextStep();
} catch (\Exception $exception) {
$error = $exception->getMessage();
@@ -124,7 +113,7 @@ if ($currentStep == 4) {
while ($isPost) {
try {
$install->createSymbolicLinks($symbolicLinks);
$install->runMigrate();
$install->runDatabaseSeeder();
$install->saveSettings($settings);
$install->nextStep();
} catch (\Exception $e) {
@@ -174,7 +163,12 @@ if (!empty($error)) {
<input type="hidden" name="step" value="<?php echo $currentStep?>">
<?php
echo'<div class="step-' . $currentStep . ' text-center">';
$header = ['项目', '要求', '当前', '结果'];
$header = [
'label' => '项目',
'required' => '要求',
'current' => '当前',
'result' => '结果'
];
if ($currentStep == 1) {
echo $install->renderTable($header, $requirements['table_rows']);
} elseif ($currentStep == 2) {