From 9905862280347ee837d48855dc01432b26d7197c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8F=99=E8=BF=B0=E3=80=81=E5=88=AB=E7=A6=BB?=
<93301500+xushubieli@users.noreply.github.com>
Date: Thu, 18 May 2023 11:02:09 +0800
Subject: [PATCH] =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/admin/index_body.php | 4 +-
src/admin/js/body.js | 87 ++++++++++++-----
src/admin/js/update.js | 132 +++++++++++++++++++++++++
src/admin/templets/index_body.htm | 157 +++---------------------------
src/static/web/css/admin.css | 14 ++-
5 files changed, 215 insertions(+), 179 deletions(-)
create mode 100644 src/admin/js/update.js
diff --git a/src/admin/index_body.php b/src/admin/index_body.php
index bf313aaf..b7329e70 100644
--- a/src/admin/index_body.php
+++ b/src/admin/index_body.php
@@ -32,14 +32,14 @@ if (empty($dopost)) {
exit;
} elseif ($dopost == 'get_articles') {
?>
-
+
0) {
$admin_catalog = join(',', $admin_catalogs);
$userCatalogSql = "AND arc.typeid IN($admin_catalog) ";
}
- $query = "SELECT arc.id, arc.arcrank, arc.title, arc.typeid, arc.mid, arc.pubdate, arc.channel, ch.editcon, tp.typename FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id = arc.channel LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id WHERE arc.arcrank<>-2 {$userCatalogSql} AND arc.mid={$cuserLogin->getUserID()} ORDER BY arc.id DESC LIMIT 0,13";
+ $query = "SELECT arc.id, arc.arcrank, arc.title, arc.typeid, arc.mid, arc.pubdate, arc.channel, ch.editcon, tp.typename FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id = arc.channel LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id WHERE arc.arcrank<>-2 {$userCatalogSql} AND arc.mid={$cuserLogin->getUserID()} ORDER BY arc.id DESC LIMIT 0,20";
$arcArr = array();
$dsql->Execute('m', $query);
while($row = $dsql->GetArray('m'))
diff --git a/src/admin/js/body.js b/src/admin/js/body.js
index c06a7c06..6294041b 100644
--- a/src/admin/js/body.js
+++ b/src/admin/js/body.js
@@ -23,18 +23,32 @@ function ViewDedeBIZ() {
ShowMsg("启动商业组件失败");
return;
}
- ShowMsg(`
+ ShowMsg(`
- 版本号: |
- V${dedebizInfo.result.server_version} |
- 服务器系统: |
- ${dedebizInfo.result.server_goos}(${dedebizInfo.result.server_goarch}) |
-
-
- 运行时间: |
- ${dedebizInfo.result.server_run_time} |
- 内存占用: |
- ${dedebizInfo.result.server_memory_usage}% |
+
+
+ 版本号
+ ${dedebizInfo.result.server_version}
+
+ |
+
+
+ 服务器系统
+ ${dedebizInfo.result.server_goos}
+
+ |
+
+
+ 运行时间
+ ${dedebizInfo.result.server_run_time}
+
+ |
+
+
+ 内存占用
+ ${dedebizInfo.result.server_memory_usage}%
+
+ |
`);
}
@@ -50,18 +64,35 @@ function LoadServer() {
let infoStr = ``;
if (typeof rsp.result.domain !== "undefined") {
infoStr += `
- 授权域名: |
- ${rsp.result.domain} |
- 授权版本: |
- ${rsp.result.auth_version}.x.x(时间:${rsp.result.auth_at}) |
-
-
- 站点名称: |
- ${rsp.result.title}(${rsp.result.stype}) |
- 站点证书: |
-
- 授权证书
- 组件状态
+ |
+
+ 授权域名
+ ${rsp.result.domain}
+
+ |
+
+
+ 授权版本
+ ${rsp.result.auth_version}.x.x
+
+ |
+
+
+ 站点名称
+ ${rsp.result.title}
+
+ |
+
+
+ |
+
+
|
`;
}
@@ -70,10 +101,12 @@ function LoadServer() {
} else {
$("#system-info").html(`
- ${rsp.msg} |
-
-
- 您已购买了商业版授权,登录DedeBIZ官网会员中心可查看相关授权信息。若授权结果与实际授权存在差异,购买到其它非商业授权,及时与我们取得联系。 |
+
+
+ ${rsp.msg}
+ 您已购买了商业版授权,登录DedeBIZ官网会员中心可查看相关授权信息。
+
+ |
`);
}
diff --git a/src/admin/js/update.js b/src/admin/js/update.js
new file mode 100644
index 00000000..25a98274
--- /dev/null
+++ b/src/admin/js/update.js
@@ -0,0 +1,132 @@
+var currentStep = 1;
+var hasNewVer = false;
+//步骤
+function dedeAlter(msg, t = 'info', loading = false) {
+ let loadingStr = loading ? '' : '';
+ return `${loadingStr}
+ ${msg}
+
`;
+}
+//显示步骤区域
+function showStepArea(step) {
+ $(".stepArea").hide();
+ $(".btnStep").hide();
+ $("#stepArea" + step).show();
+ $("#btnStep" + step).show();
+}
+function update() {
+ $.get("api.php?action=update", function (rs) {
+ if (rs.code === 0) {
+ $("#_updateMsg").html(rs.msg);
+ if (rs.data.finish === false) {
+ setTimeout(() => {
+ update();
+ }, 500);
+ } else {
+ currentStep++
+ $("#_msgInfo").html('');
+ $("#_msgInfo").hide();
+ showStepArea(currentStep);
+ }
+ }
+ })
+}
+function hasNewVersion() {
+ $.get("api.php?action=has_new_version", function (rs) {
+ try {
+ if (rs.code === 0) {
+ if (rs.result.HasNew === true) {
+ hasNewVer = true;
+ $(".updates-dot").show();
+ } else {
+ hasNewVer = false;
+ $(".updates-dot").hide();
+ }
+ } else {
+ $(".updates-dot").hide();
+ showStepArea(0);
+ }
+ } catch (error) {
+ console.log("获取软件信息失败")
+ }
+ })
+}
+$(document).ready(function () {
+ hasNewVersion();
+ $("#btnCancel").click(function () {
+ currentStep = 1;
+ $("#_fileList").html(``);
+ })
+ $("#btnBackup").click(function () {
+ let alertMsg = dedeAlter("正在备份差异文件", 'info', true);
+ $("#_msgInfo").html(alertMsg);
+ $("#_msgInfo").show();
+ $.get("api.php?action=update_backup", function (rs) {
+ if (rs.code === 0) {
+ alertMsg = dedeAlter(`成功备份差异文件,目录:${rs.data.backupdir}`, 'success');
+ $("#_msgInfo").html(alertMsg);
+ }
+ })
+ })
+ $("#systemUpdate").click(function () {
+ if (hasNewVer === false) {
+ currentStep = 5;
+ showStepArea(currentStep);
+ $('#mdlUpdate').modal('show');
+ return;
+ }
+ $('#mdlUpdate').modal('show');
+ showStepArea(currentStep);
+ currentStep++;
+ $.get("api.php?action=get_changed_files", function (rs) {
+ if (rs.code === 0) {
+ let fstr = '';
+ let i = 1;
+ rs.data.files.forEach(file => {
+ fstr += `- 第${i}个文件:${file['filename']}
`;
+ i++;
+ });
+ fstr += '
';
+ $("#_fileList").html(fstr);
+ showStepArea(currentStep);
+ } else {
+ showStepArea(0);
+ }
+ })
+ })
+ $('#mdlUpdate').on('hidden.bs.modal', function (event) {
+ currentStep = 1;
+ $("#_msgInfo").html('');
+ $("#_msgInfo").hide();
+ })
+ $("#btnGoStep3").click(function () {
+ currentStep++
+ $("#_msgInfo").html('');
+ $("#_msgInfo").hide();
+ showStepArea(currentStep);
+ $.get("api.php?action=get_update_versions", function (rs) {
+ if (rs.code === 0) {
+ let fstr = '';
+ let i = 1;
+ rs.result.Versions.forEach(ver => {
+ fstr += `- 版本号:${ver.ver},发布日期:${ver.r} 更新记录
`;
+ i++;
+ });
+ fstr += '
';
+ $("#_verList").html(fstr);
+ } else {
+ showStepArea(0);
+ }
+ })
+ })
+ $("#btnGoStep4").click(function () {
+ currentStep++
+ $("#_msgInfo").html('');
+ $("#_msgInfo").hide();
+ showStepArea(currentStep);
+ update();
+ })
+ $("#btnOK").click(function () {
+ hasNewVersion();
+ })
+})
\ No newline at end of file
diff --git a/src/admin/templets/index_body.htm b/src/admin/templets/index_body.htm
index f08849fa..f055ac4f 100644
--- a/src/admin/templets/index_body.htm
+++ b/src/admin/templets/index_body.htm
@@ -13,6 +13,7 @@
+
@@ -35,11 +36,11 @@
访问次数(VV) |
- 今日记录 |
- 0 |
- 0 |
- 0 |
- 0 |
+ 今日记录 |
+ 0 |
+ 0 |
+ 0 |
+ 0 |
昨日记录 |
@@ -68,37 +69,37 @@
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
|
-
+ |
上传限制
@@ -192,139 +193,5 @@
-
|