Browse Source

fix bug

pull/59/head
xiaoz 3 years ago
parent
commit
f7d5f131a1
  1. 7
      class/Api.php
  2. 2
      data/.htaccess
  3. BIN
      db/onenav.simple.db3
  4. 18
      db/sql/20220413.sql
  5. 10
      templates/admin/setting/theme.php
  6. 6
      templates/admin/setting/transition_page.php
  7. 2
      templates/admin/static/embed.js

7
class/Api.php

@ -781,6 +781,13 @@ class Api { @@ -781,6 +781,13 @@ class Api {
//数据库sql目录
$sql_dir = 'db/sql/';
$name = $data['name'];
//查询sql是否已经执行过
$count = $this->db->count("on_db_logs",[
"sql_name" => $name
]);
if( $count >= 1 ) {
$this->err_msg(-2000,$name."已经更新过!");
}
$sql_name = $sql_dir.$name;
//如果文件不存在,直接返回错误
if ( !file_exists($sql_name) ) {

2
data/.htaccess

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
order allow,deny
deny from all

BIN
db/onenav.simple.db3

Binary file not shown.

18
db/sql/20220413.sql

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
DROP TABLE on_options;
CREATE TABLE on_options (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"key" TEXT(64) NOT NULL,
"value" TEXT,
"extend" TEXT,
CONSTRAINT "option_key_only" UNIQUE ("key" ASC)
);
CREATE INDEX "main"."on_options_id_IDX"
ON "on_options" (
"id" ASC,
"key" ASC
);
CREATE INDEX "main"."on_options_key_IDX"
ON "on_options" (
"key" ASC
);

10
templates/admin/setting/theme.php

@ -10,10 +10,10 @@ @@ -10,10 +10,10 @@
//var_dump($theme['info']->name);
?>
<!-- 主题列表 -->
<div class="layui-col-lg2">
<fieldset style = "padding:1em;border:0px;height:180px;background-color:#EEEEEE;box-shadow: 2px 2px 3px #888888;color:#666666">
<legend style = "font-size:38px;"><?php echo $key; ?></legend>
<p><h1><?php echo $theme['info']->name ?></h1></p>
<div class="layui-col-lg3">
<fieldset style = "padding:1em;border:0px;height:170px;background-color:#EEEEEE;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 />
@ -57,7 +57,7 @@ function set_theme(name) { @@ -57,7 +57,7 @@ function set_theme(name) {
}, 2000);
}
else{
layer.msg(data.data, {icon: 5});
layer.msg(data.err_msg, {icon: 5});
}
});
}

6
templates/admin/setting/transition_page.php

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<label class="layui-form-label">过渡页</label>
<label class="layui-form-label" style = "width:130px;">过渡页</label>
<div class="layui-input-block">
<input type="radio" name="control" value="off" <?php echo ( $transition_page['control'] == 'off' ) ? "checked" : ''; ?> title="关闭">
<input type="radio" name="control" value="on" <?php echo ( $transition_page['control'] == 'on' ) ? "checked" : ''; ?> title="开启">
@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
</div>
<div class="layui-form-item">
<label class="layui-form-label">访客停留时间</label>
<label class="layui-form-label" style = "width:130px;">访客停留时间</label>
<div class="layui-input-inline">
<input type="number" min="0" max="86400" lay-verify="required|number" name="visitor_stay_time" value = "<?php echo $transition_page['visitor_stay_time']; ?>" autocomplete="off" placeholder="访客停留时间,单位s" class="layui-input">
</div>
@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
</div>
<div class="layui-form-item">
<label class="layui-form-label">管理员停留时间</label>
<label class="layui-form-label" style = "width:130px;">管理员停留时间</label>
<div class="layui-input-inline">
<input type="number" min="0" max="86400" lay-verify="required|number" name="admin_stay_time" value = "<?php echo $transition_page['admin_stay_time']; ?>" required lay-verify="required" autocomplete="off" placeholder="管理员停留时间,单位s" class="layui-input">
</div>

2
templates/admin/static/embed.js

@ -507,7 +507,7 @@ function get_sql_update_list() { @@ -507,7 +507,7 @@ function get_sql_update_list() {
function exe_sql(sqlname) {
$.ajax({ url: "index.php?c=api&method=exe_sql&name=" + sqlname, async:false, success: function(data,status){
if( data.code == 0 ){
$("#console_log").append(data.data);
$("#console_log").append(data.data + "\n" );
}
else {
$("#console_log").append(sqlname + "更新失败!\n");

Loading…
Cancel
Save