Skip to content
This repository was archived by the owner on Jun 6, 2024. It is now read-only.

Commit 61a5397

Browse files
committed
fix: cannot login admin
1 parent df41825 commit 61a5397

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

app/Update.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace app;
44

5+
use app\controller\Index;
6+
57
class Update
68
{
79
private static function fetch(bool $includePreRelease, array &$info) // 下载
@@ -151,9 +153,9 @@ public static function check(bool $includePreRelease = false, bool $enforce = fa
151153
$commonReturn = array(
152154
"code" => 0, "version" => $version, "PreRelease" => $isPreRelease,
153155
"file_url" => $url, "page_url" => $page_url, "info" => $info,
154-
"now_version" => config('baiduwp.program_version')
156+
"now_version" => config('baiduwp.program_version') ?? Index::$version
155157
);
156-
$compare = version_compare(config('baiduwp.program_version'), $version); // 比较版本
158+
$compare = version_compare(config('baiduwp.program_version') ?? Index::$version, $version); // 比较版本
157159
if ($compare === -1 || $compare === 0) { // 更新或相同
158160
$commonReturn['have_update'] = $compare === -1; // 更新则为 true
159161
return $commonReturn;

app/controller/Install.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,10 @@ public function install(Request $request)
144144

145145
Setting::updateConfig([
146146
'program_version' => Index::$version,
147+
'admin_password' => $ADMIN_PASSWORD,
148+
'db' => $USING_DB == 'true',
147149
], true);
148-
150+
149151
return json([
150152
'error' => 0,
151153
'msg' => 'success',

app/controller/admin/Setting.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ public static function updateConfig($data, $force = false)
7171
'footer' => '',
7272
];
7373

74-
$config = config('baiduwp', $default);
74+
$config = config('baiduwp');
75+
if (!$config) {
76+
$config = $default;
77+
}
7578
foreach ($data as $key => $value) {
7679
if (array_key_exists($key, self::$setting)) {
7780
if (self::$setting[$key][1] == 'number') {

0 commit comments

Comments
 (0)