Browse Source

20220602

pull/81/head
xiaoz 2 years ago
parent
commit
1db6da1281
  1. 8
      class/Api.php
  2. 3
      data/update.log
  3. 33
      templates/admin/setting/subscribe.php

8
class/Api.php

@ -1598,7 +1598,7 @@ class Api { @@ -1598,7 +1598,7 @@ class Api {
if ( $file_size != $lentgh ) {
if ( $this->down_updater() ) {
//更新完毕后提示
$this->return_json(200,"","更新程序准备就绪!");
$this->return_json(200,"","更新程序更新完毕!");
}
else{
$this->return_json(-2000,"","更新程序下载失败,请检查目录权限!");
@ -1606,14 +1606,14 @@ class Api { @@ -1606,14 +1606,14 @@ class Api {
}
else {
$this->return_json(200,"","更新程序准备就绪!");
$this->return_json(200,"","更新程序(压缩包)准备就绪!");
}
}
else if( is_file("update.php") ) {
$this->return_json(200,"","更新程序准备就绪!");
$this->return_json(200,"","更新程序(PHP)准备就绪!");
}
else{
$this->return_json(200,"","更新程序准备就绪!");
$this->return_json(200,"","更新程序(其它)准备就绪!");
}
}
/**

3
data/update.log

@ -128,4 +128,5 @@ CREATE INDEX on_options_key_IDX ON on_options ("key"); @@ -128,4 +128,5 @@ CREATE INDEX on_options_key_IDX ON on_options ("key");
20220601
1. 过渡页面完善
2. 新增分类字体图标选择
2. 新增分类字体图标选择
3. 修复360 LJ浏览器登录自动切换内核问题

33
templates/admin/setting/subscribe.php

@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
</div>
<label class="layui-form-label">可用版本</label>
<div class="layui-input-inline">
<input type="text" readonly = "readonly" name="new_version" id = "new_version" value = "" required lay-verify="required" autocomplete="off" placeholder="可用版本" class="layui-input">
<input type="text" readonly = "readonly" name="new_version" id = "new_version" value = "" required lay-verify="required" autocomplete="off" placeholder="可用版本" class="layui-input">
</div>
</div>
</div>
@ -93,6 +93,18 @@ @@ -93,6 +93,18 @@
</div>
<!-- 更新进度条END -->
</div>
<!-- 日志面板 -->
<div class="layui-col-lg12" style = "margin-top:1em;">
<div class="layui-collapse">
<div class="layui-colla-item">
<h2 class="layui-colla-title">日志输出:</h2>
<div class="layui-colla-content">
<div id = "update_log"></div>
</div>
</div>
</div>
<!-- 日志面板END -->
</div>
</div>
@ -104,29 +116,39 @@ @@ -104,29 +116,39 @@
//获取可更新版本
function available_version() {
var current_version = $("#current_version").val();
$.get("http://down.onenav.top/v1/get_version.php",{version:current_version},function(data,status){
$.get("https://onenav.xiaoz.top/v1/get_version.php",{version:current_version},function(data,status){
$("#new_version").val(data);
});
}
available_version();
//立即更新按钮
function update_main() {
//清空日志面板
var update_log = $("#update_log").html();
var current_version = $("#current_version").val();
var new_version = $("#new_version").val();
//如果当前版本和最新版本相同,则不能更新
if (current_version == new_version) {
if (current_version >= new_version) {
layer.msg("已经是最新版本,无需更新!",{icon:5});
}
//如果可用版本为空
if ( new_version == '' ) {
layer.msg("无可用版本,无需更新!",{icon:5});
}
//否则可以更新
else {
$("#btn_update").hide();
$("#btn_updating").show();
update_status("1%","准备更新...");
$("#update_log").append("准备更新...\n");
//第一步检查更新信息
$.get("/index.php?c=api&method=check_subscribe",function(data,status){
update_status("10%","正在验证订阅信息...");
$("#update_log").append("正在验证订阅信息...<br />");
if( data.code == 200 ) {
update_status("30%","订阅信息验证通过...");
$("#update_log").append("订阅信息验证通过...<br />");
//取得必要的变量
var email = data.data.email;
var domain = data.data.domain;
@ -135,18 +157,23 @@ @@ -135,18 +157,23 @@
//下载更新程序
$.get("/index.php?c=api&method=up_updater",function(data,status) {
update_status("50%","正在检查更新程序...");
$("#update_log").append("正在检查更新程序...<br />");
if( data.code == 200 ) {
//继续往下执行
update_status("70%","更新程序准备完成...");
$("#update_log").append("更新程序准备完成...<br />");
//准备下载升级包
update_status("80%","准备下载升级包...");
$("#update_log").append("准备下载升级包...<br />");
$.get("/update.php",{version:new_version,key:key,value:value,type:'main'},function(data,stauts){
update_status("90%","升级包下载完毕,正在校验版本...");
$("#update_log").append("升级包下载完毕,正在校验版本...<br />");
if( data.code == 200 ) {
//校验新版本
$.get("/index.php?c=api&method=check_version",{version:new_version},function(data,status){
if(data.code == 200) {
update_status("100%","更新完成,请前往后台检查<a href = '/index.php?c=admin'>更新数据库</a>!");
$("#update_log").append("更新完成,请前往后台检查<a href = '/index.php?c=admin'>更新数据库</a><br />");
$("#btn_update").show();
$("#btn_updating").hide();
}

Loading…
Cancel
Save