Browse Source

20220527

pull/81/head
xiaoz 2 years ago
parent
commit
5c39f7976a
  1. 7
      data/update.log
  2. 1
      templates/admin/left.php
  3. 176
      templates/admin/setting/subscribe.php
  4. 15
      templates/admin/setting/theme.php
  5. 44
      templates/admin/static/embed.js
  6. 12
      templates/admin/static/style.css

7
data/update.log

@ -117,3 +117,10 @@ CREATE INDEX on_options_key_IDX ON on_options ("key"); @@ -117,3 +117,10 @@ CREATE INDEX on_options_key_IDX ON on_options ("key");
20220513
1. 主题分类排序优化
2. 修改分类优化
20220525
1. 修复link_list和get_a_link可以查询私有分类下的公有链接问题
2. 新增查询指定分类下的链接接口:q_category_link
20220527
1. 新增订阅于在线更新

1
templates/admin/left.php

@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
<li class="layui-nav-item layui-nav-itemed">
<a class="" href="javascript:;">系统设置</a>
<dl class="layui-nav-child">
<dd><a href="/index.php?c=admin&page=setting/subscribe">订阅 & 更新</a></dd>
<dd><a href="/index.php?c=admin&page=setting/site">站点设置</a></dd>
<dd><a href="/index.php?c=admin&page=setting/theme">主题设置</a></dd>
<dd><a href="/index.php?c=admin&page=setting/transition_page">过渡页面</a></dd>

176
templates/admin/setting/subscribe.php

@ -0,0 +1,176 @@ @@ -0,0 +1,176 @@
<!-- 站点设置 -->
<!-- 主题设置 -->
<?php require_once(dirname(__DIR__).'/header.php'); ?>
<?php include_once(dirname(__DIR__).'/left.php'); ?>
<div class="layui-body">
<!-- 内容主体区域 -->
<div class="layui-row content-body place-holder" style="padding-bottom: 3em;">
<!-- 说明提示框 -->
<div class="layui-col-lg12">
<div class="setting-msg">
<ol>
<li>您可以前往:<a href="https://dwz.ovh/69h9q" rel = "nofollow" target = "_blank" title = "购买订阅服务">https://dwz.ovh/69h9q</a> 购买订阅服务,订阅后可以:</li>
<li>1. 享受一键更新OneNav</li>
<li>2. 可在线更新和下载主题(尚未实现)</li>
<li>3. 可享受一对一售后服务</li>
<li>4. 可帮助OneNav持续发展,让OneNav变得更加美好</li>
</ol>
</div>
</div>
<!-- 说明提示框END -->
<!-- 订阅表格 -->
<div class="layui-col-lg6">
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<label class="layui-form-label">订单号</label>
<div class="layui-input-block">
<input type="text" name="order_id" value = "<?php echo $subscribe['order_id']; ?>" required lay-verify="required" autocomplete="off" placeholder="请输入订单号" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">订阅邮箱</label>
<div class="layui-input-block">
<input type="email" name="email" value = "<?php echo $subscribe['email']; ?>" required lay-verify="required|email" autocomplete="off" placeholder="订阅邮箱" class="layui-input">
</div>
</div>
<div class="layui-form-item" style = "display:none;">
<label class="layui-form-label">域名</label>
<div class="layui-input-block">
<input type="text" name="domain" value = "<?php echo $_SERVER['HTTP_HOST']; ?>" autocomplete="off" placeholder="网站域名" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">到期时间</label>
<div class="layui-input-block">
<input type="text" name="end_time" readonly="readonly" value = "<?php echo date("Y-m-d",$subscribe['end_time']); ?>" autocomplete="off" placeholder="订阅到期时间" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<button class="layui-btn" lay-submit="" lay-filter="set_subscribe">保存设置</button>
</div>
</form>
</div>
<!-- 订阅表格END -->
<hr>
<div class="layui-col-lg12">
<!-- <h3>更新</h3> -->
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">当前版本</label>
<div class="layui-input-inline">
<input type="text" readonly = "readonly" id = "current_version" name="current_version" value = "<?php echo $current_version; ?>" required lay-verify="required" autocomplete="off" placeholder="当前版本" class="layui-input">
</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">
</div>
</div>
</div>
</form>
<div class="layui-input-inline">
<button class="layui-btn" lay-submit="" onclick = "update_main()">立即更新</button>
</div>
<!-- 更新进度条 -->
<div id="progress">
<div class="layui-progress layui-progress-big" lay-filter="update_progress" lay-showPercent="true">
<div class="layui-progress-bar layui-bg-blue" lay-percent="0%"></div>
</div>
<div id="msg" style = "margin-top:1em;"></div>
</div>
<!-- 更新进度条END -->
</div>
</div>
</div>
<?php include_once(dirname(__DIR__).'/footer.php'); ?>
<script>
//获取可更新版本
function available_version() {
var current_version = $("#current_version").val();
$.get("http://down.onenav.top/v1/get_version.php",{version:current_version},function(data,status){
$("#new_version").val(data);
});
}
available_version();
//立即更新按钮
function update_main() {
var current_version = $("#current_version").val();
var new_version = $("#new_version").val();
//如果当前版本和最新版本相同,则不能更新
if (current_version == new_version) {
layer.msg("已经是最新版本,无需更新!",{icon:5});
}
//否则可以更新
else {
update_status("1%","准备更新...");
//第一步检查更新信息
$.get("/index.php?c=api&method=check_subscribe",function(data,status){
update_status("10%","正在验证订阅信息...");
if( data.code == 200 ) {
update_status("20%","订阅信息验证通过...");
//取得必要的变量
var email = data.data.email;
var domain = data.data.domain;
var key = data.data.key;
var value = data.data.value;
//下载更新程序
$.get("/index.php?c=api&method=up_updater",function(data,status) {
update_status("30%","正在检查更新程序...");
if( data.code == 200 ) {
//继续往下执行
update_status("40%","更新程序准备完成...");
//准备下载升级包
update_status("50%","准备下载升级包...");
$.get("/update.php",{version:new_version,key:key,value:value,type:'main'},function(data,stauts){
update_status("70%","升级包下载完毕,正在校验版本...");
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%","更新完成!");
}
else {
layer.msg(data.msg,{icon:5,time: 0});
}
});
}
else{
layer.msg(data.msg,{icon:5,time: 0});
}
});
}
else {
layer.msg(data.msg,{icon:5,time: 0});
}
});
}
else{
layer.msg(data.msg,{icon:5,time: 0});
}
});
}
}
//进度和更新提示函数
function update_status(progress,msg) {
layui.use('element', function(){
var element = layui.element;
$("#progress").show();
element.progress('update_progress', progress);
$("#msg").text(msg);
});
}
</script>

15
templates/admin/setting/theme.php

@ -18,20 +18,23 @@ @@ -18,20 +18,23 @@
?>
<!-- 主题列表 -->
<div class="layui-col-lg3">
<fieldset style = "padding:1em;border:0px;height:170px;border:1px dashed #1E9FFF;box-shadow: 2px 2px 3px #888888;color:#666666">
<legend style = "font-size:32px;"><?php echo $key; ?></legend>
<p><h2><?php echo $theme['info']->name ?></h2></p>
<p>版本:<?php echo $theme['info']->version ?></p>
<p>更新时间:<?php echo $theme['info']->update ?></p>
<br />
<fieldset style = "padding:1em;border:0px;height:280px;border:1px dashed #1E9FFF;box-shadow: 2px 2px 3px #888888;color:#666666">
<legend style = "font-size:24px;"><?php echo $key; ?> - <?php echo $theme['info']->version ?></legend>
<!-- 主题图片 -->
<div class = "screenshot"><p><img src="<?php echo $theme['info']->screenshot; ?>" alt=""></p></div>
<!-- 主题图片END -->
<p>
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-sm" onclick = "set_theme('<?php echo $key; ?>')">使用</button>
<button type="button" class="layui-btn layui-btn-sm" onclick = "theme_detail('<?php echo $key; ?>')">详情</button>
<button type="button" class="layui-btn layui-btn-sm" onclick = "theme_config('<?php echo $key; ?>')">参数设置</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick = "delete_theme('<?php echo $key; ?>')">删除</button>
<?php if( $current_them == $key ) { ?>
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger">当前主题</button>
<?php } ?>
</div>
</p>
</fieldset>

44
templates/admin/static/embed.js

@ -389,6 +389,33 @@ layui.use(['element','table','layer','form','upload'], function(){ @@ -389,6 +389,33 @@ layui.use(['element','table','layer','form','upload'], function(){
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
//保存订阅信息
form.on('submit(set_subscribe)', function(data){
var order_id = data.field.order_id;
$.get('http://down.onenav.top/v1/check_subscribe.php',data.field,function(data,status){
if(data.code == 200) {
//order_id = data.data.order_id;
email = data.data.email;
end_time = data.data.end_time;
//存储到数据库中
$.post("index.php?c=api&method=set_subscribe",{order_id:order_id,email:email,end_time:end_time},function(data,status){
if(data.code == 0) {
layer.msg(data.data, {icon: 1});
}
else{
layer.msg(data.err_msg, {icon: 5});
}
});
}
else{
layer.msg(data.msg, {icon: 5});
}
});
console.log(data.field) //当前容器的全部表单字段,名值对形式:{name: value}
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
//保存站点设置
form.on('submit(set_transition_page)', function(data){
$.post('/index.php?c=api&method=set_transition_page',data.field,function(data,status){
@ -809,3 +836,20 @@ function export_link(url, fileName) { @@ -809,3 +836,20 @@ function export_link(url, fileName) {
});
}
//删除主题
function delete_theme(name) {
layer.confirm('确认删除此主题(' + name + ')?', {icon: 3, title:'重要提示'}, function(index){
$.post("index.php?c=api&method=delete_theme",{name:name},function(data,status){
if( data.code == 200 ) {
layer.msg(data.msg,{icon:1});
setTimeout(() => {
window.location.reload();
}, 2000);
}
else{
layer.msg(data.msg,{icon:5});
}
});
});
}

12
templates/admin/static/style.css

@ -107,3 +107,15 @@ @@ -107,3 +107,15 @@
.place-holder{
padding-bottom: 3em;
}
.screenshot {
height:220px;
}
.screenshot img{
max-width: auto;
max-height: 200px;
}
#progress{
display:none;
margin-top:1em;
}
Loading…
Cancel
Save