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

Commit

Permalink
fix: cannot login admin
Browse files Browse the repository at this point in the history
  • Loading branch information
yuantuo666 committed Sep 27, 2023
1 parent df41825 commit 61a5397
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace app;

use app\controller\Index;

class Update
{
private static function fetch(bool $includePreRelease, array &$info) // 下载
Expand Down Expand Up @@ -151,9 +153,9 @@ public static function check(bool $includePreRelease = false, bool $enforce = fa
$commonReturn = array(
"code" => 0, "version" => $version, "PreRelease" => $isPreRelease,
"file_url" => $url, "page_url" => $page_url, "info" => $info,
"now_version" => config('baiduwp.program_version')
"now_version" => config('baiduwp.program_version') ?? Index::$version
);
$compare = version_compare(config('baiduwp.program_version'), $version); // 比较版本
$compare = version_compare(config('baiduwp.program_version') ?? Index::$version, $version); // 比较版本
if ($compare === -1 || $compare === 0) { // 更新或相同
$commonReturn['have_update'] = $compare === -1; // 更新则为 true
return $commonReturn;
Expand Down
4 changes: 3 additions & 1 deletion app/controller/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ public function install(Request $request)

Setting::updateConfig([
'program_version' => Index::$version,
'admin_password' => $ADMIN_PASSWORD,
'db' => $USING_DB == 'true',
], true);

return json([
'error' => 0,
'msg' => 'success',
Expand Down
5 changes: 4 additions & 1 deletion app/controller/admin/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ public static function updateConfig($data, $force = false)
'footer' => '',
];

$config = config('baiduwp', $default);
$config = config('baiduwp');
if (!$config) {
$config = $default;
}
foreach ($data as $key => $value) {
if (array_key_exists($key, self::$setting)) {
if (self::$setting[$key][1] == 'number') {
Expand Down

0 comments on commit 61a5397

Please sign in to comment.