From 4b773c13e017bb444d72df89b87b5106504b29d9 Mon Sep 17 00:00:00 2001 From: tianya Date: Mon, 28 Nov 2022 21:29:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/admin/api.php | 30 +++++++++++++++++++++++++++++- src/admin/templets/index_body.htm | 22 ++++++++++++++++------ 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/admin/api.php b/src/admin/api.php index 8183a2d1..c70517cc 100644 --- a/src/admin/api.php +++ b/src/admin/api.php @@ -53,7 +53,14 @@ if ($action === 'is_need_check_code') { $dhd = new DedeHttpDown(); $dhd->OpenUrl($offUrl); $data = $dhd->GetHtml(); - echo $data; + if (empty($data)) { + echo json_encode(array( + "code"=>-1, + "msg"=>'获取版本信息失败', + )); + } else { + echo $data; + } } else if ($action === 'get_changed_files') { require_once(DEDEINC.'/libraries/dedehttpdown.class.php'); checkLogin(); @@ -62,6 +69,13 @@ if ($action === 'is_need_check_code') { $dhd = new DedeHttpDown(); $dhd->OpenUrl($hashUrl); $data = $dhd->GetJSON(); + if (empty($data)) { + echo json_encode(array( + "code"=>-1, + "msg"=>'获取版本信息失败', + )); + exit(); + } $changedFiles = array(); foreach ($data as $file) { $realFile = DEDEROOT.str_replace("\\", '/', $file->filename); @@ -86,6 +100,13 @@ if ($action === 'is_need_check_code') { $dhd = new DedeHttpDown(); $dhd->OpenUrl($hashUrl); $data = $dhd->GetJSON(); + if (empty($data)) { + echo json_encode(array( + "code"=>-1, + "msg"=>'获取版本信息失败', + )); + exit; + } $changedFiles = array(); $enkey = substr(md5(substr($cfg_cookie_encode, 0, 5)), 0, 10); $backupPath = DEDEDATA."/backupfile_{$enkey}"; @@ -116,6 +137,13 @@ if ($action === 'is_need_check_code') { $dhd = new DedeHttpDown(); $dhd->OpenUrl($offUrl); $data = $dhd->GetHtml(); + if (empty($data)) { + echo json_encode(array( + "code"=>-1, + "msg"=>'获取版本信息失败', + )); + exit; + } $arr = json_decode($data); SetCache('update', 'vers', $arr->result->Versions); echo $data; diff --git a/src/admin/templets/index_body.htm b/src/admin/templets/index_body.htm index 2f4bb7e3..9803be9f 100644 --- a/src/admin/templets/index_body.htm +++ b/src/admin/templets/index_body.htm @@ -110,7 +110,6 @@
版本授权 软件更新 - 已是最新软件版本
正在加载
@@ -139,10 +138,13 @@