Merge branch 'dev'

This commit is contained in:
wispx
2019-01-19 17:41:00 +08:00
19 changed files with 586 additions and 175 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
[![License](https://img.shields.io/badge/license-GPL_V3.0-yellowgreen.svg)](https://github.com/wisp-x/lsky-pro/blob/master/LICENSE)
[![PHP](https://img.shields.io/badge/PHP->=5.6-orange.svg)](http://php.net)
[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/wisp-x/lsky-pro.svg)](https://github.com/wisp-x/lsky-pro)
[![Join the chat at https://gitter.im/wisp-x/lsky-pro](https://badges.gitter.im/wisp-x/lsky-pro.svg)](https://gitter.im/wisp-x/lsky-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge&style=flat-square)
[![Join the chat at https://gitter.im/wisp-x/lsky-pro](https://badges.gitter.im/wisp-x/lsky-pro.svg)](https://gitter.im/wisp-x/lsky-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
> master分支为最新版,其他版本请点击[这里](https://github.com/wisp-x/lsky-pro/releases)
+24
View File
@@ -0,0 +1,24 @@
<?php
/**
* User: Wisp X
* Date: 2019-01-19
* Time: 13:07
* Link: https://github.com/wisp-x
*/
namespace app\common\model;
use think\Model;
class Group extends Model
{
protected $insert = ['default'];
public function setDefaultAttr($default)
{
if ($default) {
$this->where('default', 1)->setField('default', 0);
}
return $default ? 1 : 0;
}
}
+5
View File
@@ -80,4 +80,9 @@ class Users extends Model
{
return $this->hasMany('Folders', 'user_id', 'id');
}
public function group()
{
return $this->hasOne('Group', 'id', 'group_id');
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
/**
* User: Wisp X
* Date: 2019-01-19
* Time: 14:06
* Link: https://github.com/wisp-x
*/
namespace app\common\validate;
use think\Validate;
class Group extends Validate
{
protected $rule = [
'name' => 'require|max:30|chsAlphaNum'
];
protected $message = [
'name.require' => '角色组名称不能为空',
'name.max' => '角色组名称长度最大30个字符',
'name.chsAlphaNum' => '角色组名称只能是汉字、字母和数字'
];
}
+15 -3
View File
@@ -8,6 +8,7 @@
namespace app\index\controller;
use app\common\model\Group;
use app\common\model\Users;
use PHPMailer\PHPMailer\PHPMailer;
use think\Controller;
@@ -26,6 +27,8 @@ class Base extends Controller
protected $configs = null;
protected $group = null;
/**
* 当前储存策略配置
*
@@ -55,13 +58,22 @@ class Base extends Controller
}
// 检测数据库结构更新
if ($this->user && $this->user->is_admin) {
if ($this->user && $this->user->is_admin && !\config('app.app_debug')) {
if (file_exists(Env::get('root_path') . 'update.sql')) {
$this->redirect(url('/install/update'));
}
}
$this->currentStrategyConfig = $this->getStrategyConfig(strtolower($this->config['storage_strategy']));
// 角色组
if ($this->user) {
$this->group = $this->user->group;
}
if (!$this->group) {
// 默认角色组
$this->group = Group::where('default', 1)->find();
}
$this->currentStrategyConfig = $this->getStrategyConfig(strtolower($this->group->strategy));
$this->assign([
'config' => $this->config,
@@ -96,7 +108,7 @@ class Base extends Controller
*/
protected function getStrategyInstance($strategy = null)
{
$currentStrategy = $strategy ? $strategy : strtolower($this->config['storage_strategy']);
$currentStrategy = $strategy ? $strategy : strtolower($this->group->strategy);
// 驱动
$driver = Config::get('strategy.' . $currentStrategy . '.class');
// 获取该储存策略配置
+3
View File
@@ -8,10 +8,13 @@
namespace app\index\controller;
use app\common\model\Images;
class Index extends Base
{
public function index()
{
$this->assign('images_count', Images::cache(120)->count());
return $this->fetch();
}
+5 -3
View File
@@ -217,10 +217,12 @@ EOT;
// 新建表字段
$tableFields = [
'lsky_images' => [
'folder_id' => "ALTER TABLE `lsky_images` ADD `folder_id` INT NOT NULL DEFAULT '0' COMMENT '文件夹ID' AFTER `user_id`;"
'folder_id' => "ALTER TABLE `lsky_images` ADD `folder_id` INT NOT NULL DEFAULT '0' COMMENT '文件夹ID' AFTER `user_id`;",
'suspicious' => "ALTER TABLE `lsky_images` ADD `suspicious` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '可疑图片' AFTER `ip`;",
],
'lsky_users' => [
'default_folder' => "ALTER TABLE `lsky_users` ADD `default_folder` VARCHAR(32) DEFAULT NULL COMMENT '默认上传文件夹' AFTER `quota`;"
'default_folder' => "ALTER TABLE `lsky_users` ADD `default_folder` VARCHAR(32) DEFAULT NULL COMMENT '默认上传文件夹' AFTER `quota`;",
'group_id' => "ALTER TABLE `lsky_users` ADD `group_id` int(11) NOT NULL DEFAULT 0 COMMENT '角色组ID' AFTER `id`;"
],
];
@@ -245,7 +247,7 @@ EOT;
foreach (explode(';', $file) as $value) {
if ($value && !ctype_space($value)) {
if (!$mysqli->query($value . ';')) {
throw new Exception('数据导入失败,错误信息:' . $mysqli->error . 'sql语句:' . $value);
throw new Exception('<p>数据导入失败</p><p>错误信息:<br/>' . $mysqli->error . '</p><p>sql语句:<br/>' . $value . '</p>');
}
}
}
+6 -3
View File
@@ -91,6 +91,7 @@ class Upload extends Base
$url = make_url($domain, $pathname);
// 图片鉴黄
$suspicious = 0;
if ($this->config['open_audit']) {
$client = new Client();
$response = $client->get("https://www.moderatecontent.com/api/v2?key={$this->config['audit_key']}&url={$url}");
@@ -98,8 +99,9 @@ class Upload extends Base
$result = json_decode($response->getBody()->getContents());
if (0 == $result->error_code) {
if ($result->rating_index >= $this->config['audit_index']) {
$strategy->delete($pathname);
throw new Exception('图片[' . $image->getInfo('name') . ']涉嫌违规,禁止上传!');
/*$strategy->delete($pathname);
throw new Exception('图片[' . $image->getInfo('name') . ']涉嫌违规,禁止上传!');*/
$suspicious = 1;
}
} else {
$strategy->delete($pathname);
@@ -117,7 +119,8 @@ class Upload extends Base
'size' => $size,
'mime' => $mime,
'sha1' => $sha1,
'md5' => $md5
'md5' => $md5,
'suspicious' => $suspicious
];
// 默认上传文件夹,暂只支持一级
@@ -0,0 +1,150 @@
<?php
/**
* User: Wisp X
* Date: 2019-01-19
* Time: 11:59
* Link: https://github.com/wisp-x
*/
namespace app\index\controller\admin;
use app\common\model\Group as GroupModel;
use think\Db;
use think\Exception;
use think\facade\Config;
class Group extends Base
{
protected $strategyList;
protected function initialize()
{
parent::initialize();
$this->strategyList = Config::pull('strategy');
}
public function index()
{
$groups = GroupModel::select()->each(function ($item) {
$item->strategy_str = isset($this->strategyList[$item->strategy]) ? $this->strategyList[$item->strategy]['name'] : '未知';
return $item;
});
$this->assign([
'groups' => $groups,
'strategy_list' => $this->strategyList
]);
return $this->fetch();
}
public function add()
{
if ($this->request->isPost()) {
try {
$data = $this->request->post();
$validate = $this->validate($data, 'Group');
if (true !== $validate) {
throw new Exception($validate);
}
if (!GroupModel::create($data)) {
throw new Exception('添加失败');
}
} catch (Exception $e) {
return $this->error($e->getMessage());
}
return $this->success('添加成功');
}
}
public function edit()
{
if ($this->request->isPost()) {
try {
$data = $this->request->post();
$validate = $this->validate($data, 'Group');
if (true !== $validate) {
throw new Exception($validate);
}
if (!GroupModel::update($data)) {
throw new Exception('编辑失败');
}
} catch (Exception $e) {
return $this->error($e->getMessage());
}
return $this->success('编辑成功');
}
}
public function del()
{
if ($this->request->isPost()) {
Db::startTrans();
try {
$id = $this->request->post('id');
$group = GroupModel::find($id);
// 至少保留一个默认分组
$defaultId = GroupModel::where('default', 1)->where('id', 'neq', $id)->value('id');
if (!$defaultId) {
throw new Exception('至少保留一个默认分组');
}
// 转移该组下的用户到默认分组
if (!\app\common\model\Users::where('group_id', $group->id)->setField('group_id', $defaultId)) {
throw new Exception('删除失败');
}
$group->delete();
Db::commit();
} catch (Exception $e) {
Db::rollback();
return $this->error($e->getMessage());
}
return $this->success('删除成功');
}
}
public function getGroup()
{
if ($this->request->isPost()) {
$id = $this->request->post('id');
return $this->success('success', null, GroupModel::find($id));
}
}
public function setDefault()
{
if ($this->request->isPost()) {
$id = $this->request->post('id');
$value = $this->request->post('value');
if (1 != $value) {
if (!GroupModel::where('default', 1)->where('id', 'neq', $id)->count()) {
return $this->error('至少保留一个默认分组');
}
}
if (!GroupModel::update([
'id' => $id,
'default' => $value
])) {
return $this->error('设置失败');
}
return $this->success('设置成功');
}
}
public function setStrategy()
{
if ($this->request->isPost()) {
$id = $this->request->post('id');
$strategy = $this->request->post('strategy');
if (!array_key_exists($strategy, $this->strategyList)) {
return $this->error('储存策略不存在');
}
if (!GroupModel::update([
'id' => $id,
'strategy' => $strategy
])) {
return $this->error('设置失败');
}
return $this->success('设置成功');
}
}
}
+16 -7
View File
@@ -30,14 +30,20 @@ class Images extends Base
{
parent::initialize();
$this->strategyList = Config::pull('strategy');
$this->assign('strategyList', $this->strategyList);
$this->assign('strategy_list', $this->strategyList);
}
public function index($strategy = '', $keyword = '', $limit = 15)
public function index($where = '', $keyword = '', $limit = 15)
{
$where = json_decode($where, true);
if (null == $where) {
$where = [
'suspicious' => 0
];
}
$model = new ImagesModel();
if (!empty($strategy)) {
$model = $model->where('strategy', $strategy);
foreach ($where as $field => $value) {
$model = $model->where($field, $value);
}
if (!empty($keyword)) {
$model = $model->where('pathname|sha1|md5', 'like', "%{$keyword}%");
@@ -47,7 +53,8 @@ class Images extends Base
'keyword' => $keyword
]
])->each(function ($item) {
$item->username = Users::where('id', $item->user_id)->value('username');
$username = Users::where('id', $item->user_id)->value('username');
$item->username = $username ? $username : '访客';
$item->strategyStr = isset($this->strategyList[$item->strategy]) ? $this->strategyList[$item->strategy]['name'] : '未知';
return $item;
});
@@ -55,8 +62,10 @@ class Images extends Base
'images' => $images,
'keyword' => $keyword,
'strategyList' => $this->strategyList,
'strategy' => $strategy
'strategy' => isset($where['strategy']) ? $where['strategy'] : '',
'suspicious' => isset($where['suspicious']) ? $where['suspicious'] : 0
]);
return $this->fetch();
}
@@ -130,7 +139,7 @@ class Images extends Base
} catch (Exception $e) {
return $this->error('获取失败');
} catch (RequestException $e) {
return $this->error('淘宝接口异常');
return $this->error('淘宝接口发生异常,状态码:' . $response->getStatusCode());
}
return $this->success('获取成功', null, $data);
}
@@ -0,0 +1,201 @@
{extend name="common:base" /}
{block name="title"}角色组 - {$config.site_name}{/block}
{block name="main"}
<div class="mdui-container">
<main>
<div class="mdui-table-fluid mdui-m-t-2 mdui-m-b-2">
<div class="mdui-typo">
<blockquote>
<p>不同的角色组下的用户,上传图片将使用不同的储存策略。<br>至少有一个默认角色组,新注册用户和访客将会使用默认的角色组。<br>角色组删除后,该组下面的用户将重置默认角色组。</p>
</blockquote>
</div>
<div class="mdui-btn-group mdui-m-a-1">
<button type="button" id="add" class="mdui-btn mdui-ripple mdui-btn-raised" mdui-dialog="{target: '#add-dialog'}">添加</button>
</div>
<table class="mdui-table mdui-table-selectable">
<thead>
<tr>
<th>使用策略</th>
<th>名称</th>
<th>注册默认</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{foreach $groups as $value}
<tr data-id="{$value.id}">
<td>
<select class="mdui-select strategy">
{foreach $strategy_list as $strategy => $val}
<option value="{$strategy}" {if $value.strategy eq $strategy} selected{/if}>{$val.name}</option>
{/foreach}
</select>
</td>
<td>{$value.name}</td>
<td>
<label class="mdui-switch">
<input type="checkbox" class="default" {if $value.default eq 1}checked{/if}/>
<i class="mdui-switch-icon"></i>
</label>
</td>
<td>
<div class="mdui-btn-group">
<button class="mdui-btn mdui-btn-raised mdui-btn-dense edit">编辑</button>
<button class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-red mdui-btn-dense del">删除</button>
</div>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</main>
<div class="mdui-dialog" id="add-dialog">
<div class="mdui-dialog-content">
<form action="{:url('admin/group/edit')}" method="post">
<div class="mdui-dialog-title">添加角色组</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">组名称</label>
<input class="mdui-textfield-input" type="text" name="name" value="" placeholder="用户名" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">使用策略</label>
<select class="mdui-select" name="strategy">
{foreach $strategy_list as $strategy => $val}
<option value="{$strategy}">{$val.name}</option>
{/foreach}
</select>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">注册默认</label>
<label class="mdui-switch">
<input type="checkbox" name="default" value="1"/>
<i class="mdui-switch-icon"></i>
</label>
</div>
<div class="mdui-dialog-actions">
<button type="button" class="mdui-btn mdui-ripple" mdui-dialog-cancel>取消</button>
<button class="mdui-btn mdui-ripple">确定</button>
</div>
</form>
</div>
</div>
<div class="mdui-dialog" id="edit-dialog">
<div class="mdui-dialog-content">
<form action="{:url('admin/group/edit')}" method="post">
<div class="mdui-dialog-title">添加角色组</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">组名称</label>
<input class="mdui-textfield-input" type="text" name="name" value="" placeholder="用户名" autocomplete="off"/>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">使用策略</label>
<select class="mdui-select" name="strategy">
{foreach $strategy_list as $strategy => $val}
<option value="{$strategy}">{$val.name}</option>
{/foreach}
</select>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">注册默认</label>
<label class="mdui-switch">
<input type="checkbox" name="default" value="1"/>
<i class="mdui-switch-icon"></i>
</label>
</div>
<input type="hidden" name="id" value="">
<div class="mdui-dialog-actions">
<button type="button" class="mdui-btn mdui-ripple" mdui-dialog-cancel>取消</button>
<button class="mdui-btn mdui-ripple">修改</button>
</div>
</form>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
$(function () {
var editDialog = new mdui.Dialog('#edit-dialog');
var methods = {
delete: function (id, batch, callback) {
var msg = '确认删除该角色组吗?';
if (batch) {
msg = '确认删除选中项角色组吗?';
}
mdui.confirm(msg, function () {
app.request("{:url('admin/group/del')}", {id: id}, function () {
callback && callback();
});
}, function () {
}, {confirmText: '确定', cancelText: '取消'});
},
};
// 编辑提交
$('#edit-dialog form').submit(function (e) {
e.preventDefault();
app.request("{:url('admin/group/edit')}", $(this).serialize(), function () {
editDialog.close();
history.go(0);
});
});
// 添加角色组
$('#add-dialog form').submit(function (e) {
e.preventDefault();
app.request("{:url('admin/group/add')}", $(this).serialize(), function () {
history.go(0);
});
});
// 更改储存策略
$('td select.strategy').change(function () {
var tr = $(this).closest('tr');
app.request("{:url('admin/group/setStrategy')}", {id: tr.data('id'), strategy: $(this).val()});
});
// 状态切换
$('td .default').change(function () {
var tr = $(this).closest('tr');
app.request("{:url('admin/group/setDefault')}", {id: tr.data('id'), value: this.checked ? 1 : 0}, function () {
$('td .default').attr('checked', false);
mdui.mutation('checkbox');
}, function () {
history.go(0);
});
});
// 编辑
$('td button.edit').click(function () {
var tr = $(this).closest('tr');
app.ajax("{:url('admin/group/getGroup')}", {id: tr.data('id')}, function (response) {
if (response.code) {
var form = $("#edit-dialog form");
for (x in response.data) {
var input = form.find("input[name='" + x + "']");
if (input.length) {
input.val(response.data[x]);
}
if (x === 'default') {
form.find("[name='default']").attr('checked', 1 === response.data[x]);
mdui.mutation('checkbox');
}
}
editDialog.open();
} else {
mdui.snackbar({
message: response.msg
});
}
});
});
// 删除
$('td button.del').click(function () {
var tr = $(this).closest('tr');
methods.delete(tr.data('id'), false, function () {
tr.remove();
});
});
});
</script>
{/block}
@@ -11,16 +11,17 @@
<main>
<div class="mdui-chip">
<span class="mdui-chip-icon"><i class="mdui-icon material-icons">&#xe88e;</i></span>
<span class="mdui-chip-title">系统共有 <small class="mdui-text-color-red">{$images->total()}</small> 张图片</span>
<span class="mdui-chip-title">共有 <small class="mdui-text-color-red">{$images->total()}</small> 张图片</span>
<a href="" class="mdui-chip-delete" mdui-tooltip="{content: '刷新', position: 'right'}"><i class="mdui-icon material-icons">&#xe863;</i></a>
</div>
<div class="mdui-clearfix mdui-m-t-1"></div>
<form action="" method="post" id="search-form">
<select class="strategy mdui-select mdui-float-left" name="strategy" mdui-select>
<select class="where mdui-select mdui-float-left" name="where" mdui-select>
<option value="">全部</option>
{foreach $strategyList as $key => $value}
<option value="{$key}" {if $key eq $strategy}selected{/if}>{$value.name}</option>
<option value='{"strategy": "{$key}"}' {if $key eq $strategy}selected{/if}>{$value.name}</option>
{/foreach}
<option value='{"suspicious": "1"}' {eq name="suspicious" value="1"} selected{/eq}>可疑图片</option>
</select>
<input type="hidden" name="page" value="1">
<input class="mdui-textfield-input search-input mdui-float-left" type="text" name="keyword" placeholder="回车搜索..." value="{$keyword}" autocomplete="off"/>
@@ -98,6 +99,9 @@
}, {confirmText: '确定', cancelText: '取消'});
}
};
$('.mdui-select.where').on('close.mdui.select', function () {
$('#search-form').submit();
});
$('.mdui-select.operation').on('close.mdui.select', function () {
if ($(this).val() !== '') {
var selected = $('tr.mdui-table-row-selected');
@@ -6,9 +6,10 @@
<div class="mdui-container">
<main>
<div class="strategy-container">
<div class="mdui-chip current-strategy none mdui-m-b-2">
<span class="mdui-chip-icon mdui-color-blue"><i class="mdui-icon material-icons">&#xe1db;</i></span>
<span class="mdui-chip-title"></span>
<div class="mdui-typo">
<blockquote class="mdui-m-l-0">
<p>储存策略,可配置多个,使用不同的角色组来控制用户图片储存策略。</p>
</blockquote>
</div>
<div id="tab" class="mdui-tab mdui-tab-scrollable" mdui-tab>
{foreach $strategy as $key => $value}
@@ -44,19 +45,6 @@
<script>
$(function () {
var currentStrategy = function () {
$('.current-strategy .mdui-chip-title').text('当前使用储存策略:' + $('#tab a.mdui-tab-active').text());
$('.current-strategy').is(":hidden") && $('.current-strategy').css('display', 'inline-block');
};
currentStrategy();
$('form').submit(function (e) {
e.preventDefault();
app.request(this.action, $(this).serialize(), function () {
currentStrategy();
})
});
});
</script>
{/block}
{/block}
@@ -6,6 +6,11 @@
<div class="mdui-container">
<main>
<div class="system-container">
<div class="mdui-typo">
<blockquote class="mdui-m-l-0">
<p>系统配置,统计代码中注意要使用&lt;script&gt;&lt;/script&gt;标签,不设置可为空。</p>
</blockquote>
</div>
<div class="mdui-tab mdui-tab-scrollable" mdui-tab>
<a href="#tab-basics" class="mdui-ripple">基础配置</a>
<a href="#tab-upload" class="mdui-ripple">上传配置</a>
@@ -26,7 +31,7 @@
<input class="mdui-textfield-input" type="{$val.input_type}" name="{$val.name}" value="{$val.value}" autocomplete="off" placeholder="{$val.title}"/>
{/case}
{case textarea}
<textarea class="mdui-textfield-input" name="{$val.name}" autocomplete="off" placeholder="{$val.title}">{$val.value}</textarea>
<textarea class="mdui-textfield-input" rows="6" name="{$val.name}" autocomplete="off" placeholder="{$val.title}">{$val.value}</textarea>
{/case}
{case bool}
<label class="mdui-switch">
+5 -2
View File
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="Cache-Control" content="no-siteapp"/>
@@ -17,6 +17,7 @@
<!--[if IE]>
<script>window.location.href = '/compatibility.html';</script>
<![endif]-->
{$config.custom_style|raw}
</head>
<body class="mdui-theme-accent-indigo mdui-appbar-with-toolbar {if cookie('?menu') and cookie('menu') eq 'open'}mdui-drawer-body-left{/if}">
{block name="header"}
@@ -83,6 +84,7 @@
<i class="mdui-collapse-item-arrow mdui-icon material-icons">&#xe313;</i>
</div>
<div class="mdui-collapse-item-body mdui-list">
<a href="{:url('admin/group/index')}" class="mdui-list-item mdui-ripple {if $uri eq 'admin.group/index'}mdui-list-item-active{/if}">角色组</a>
<a href="{:url('admin/users/index')}" class="mdui-list-item mdui-ripple {if $uri eq 'admin.users/index'}mdui-list-item-active{/if}">用户管理</a>
<a href="{:url('admin/images/index')}" class="mdui-list-item mdui-ripple {if $uri eq 'admin.images/index'}mdui-list-item-active{/if}">图片管理</a>
<a href="{:url('admin/strategy/index')}" class="mdui-list-item mdui-ripple {if $uri eq 'admin.strategy/index'}mdui-list-item-active{/if}">储存策略</a>
@@ -130,7 +132,7 @@
</div>
<footer>
<div class="mdui-container">
Copyright &copy; 2018 <a href="https://www.lsky.pro">Lsky Pro</a>. All rights reserved.
Copyright &copy; 2018 - 2019 <a href="https://www.lsky.pro">Lsky Pro</a>. All rights reserved.
{if $config.icp_number}<a href="http://www.miitbeian.gov.cn" target="_blank">{$config.icp_number}</a>.{/if}
请勿上传违反中国大陆和香港法律的图片,违者后果自负。
</div>
@@ -178,5 +180,6 @@
app.update(thatVer, false);
</script>
{/if}
{$config.statistics_code|raw}
</body>
</html>
+9 -2
View File
@@ -14,7 +14,7 @@
<div class="upload-container">
<div class="title">
<h1>Image Upload</h1>
<p>最大可上传 {:round($config.upload_max_size / 1024 / 1024)} MB的图片,单次同时可选择 {$config.upload_single_num} 张。</p>
<p>最大可上传 {:round($config.upload_max_size / 1024 / 1024)} MB的图片,单次同时可选择 {$config.upload_single_num} 张。本站已托管 {$images_count} 张图片。</p>
</div>
<form action="" method="post" enctype="multipart/form-data">
<input id="image" style="display: none;" type="file" multiple name="image" accept="image/*">
@@ -84,7 +84,7 @@
$("#code-bbcode ul").prepend("<li>[img]" + response.data.url + "[/img]<i class=\"copy iconfont icon-copy\"></i></li>");
$("#code-markdown ul").prepend("<li>![" + response.data.name + "](" + response.data.url + ")<i class=\"copy iconfont icon-copy\"></i></li>");
$("#code-markdown-with-link ul").prepend("<li>[![" + response.data.name + "](" + response.data.url + ")](" + response.data.url + ")<i class=\"copy iconfont icon-copy\"></i></li>");
$(".success-info").css("width", "inherit");
$(".success-info").css("width", "inherit").css('display', 'block');
if (response.data.quota && response.data.use_quota) {
$('.quota-container progress').attr('max', response.data.quota);
$('.quota-container progress').val(response.data.use_quota);
@@ -96,6 +96,13 @@
} else {
mdui.alert(response.msg);
}
}).on("filecleared", function (event, data, msg) {
// 清空
$('.success-info')
.css('display', 'none')
.find('#code-url, #code-html, #code-bbcode, #code-markdown, #code-markdown-with-link')
.find('ul')
.html('');
});
$('#image').css("display", "block");
</script>
+1 -1
View File
@@ -34,7 +34,7 @@
<main class="mdui-shadow-2">
<h3>- 数据库结构更新准备就绪</h3>
{if $msg}
<p class="mdui-text-color-red">{$msg|raw}</p>
<div class="mdui-text-color-red">{$msg|raw}</div>
{/if}
{if $code eq 0}
<form action="" method="get">
+86 -132
View File
@@ -1,12 +1,3 @@
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: 2018-09-28 17:54:47
-- 服务器版本: 5.7.21
-- PHP Version: 7.2.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
@@ -14,80 +5,23 @@ SET time_zone = "+00:00";
-- Database: `lsky`
--
-- --------------------------------------------------------
--
-- 表的结构 `lsky_config`
--
DROP TABLE IF EXISTS `lsky_config`;
CREATE TABLE IF NOT EXISTS `lsky_config` (
`id` smallint(6) UNSIGNED NOT NULL,
`id` smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
`key` varchar(32) DEFAULT NULL COMMENT 'key',
`type` varchar(32) NOT NULL DEFAULT 'text' COMMENT 'text|bool|textarea|select',
`input_type` varchar(32) NOT NULL DEFAULT 'text' COMMENT 'input type属性',
`name` varchar(32) CHARACTER SET utf8mb4 NOT NULL COMMENT '配置名',
`name` varchar(32) CHARACTER SET utf8mb4 NOT NULL UNIQUE COMMENT '配置名',
`title` varchar(100) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '配置标题',
`tip` varchar(100) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '配置描述',
`value` text CHARACTER SET utf8mb4 NOT NULL COMMENT '配置值',
`extend` text CHARACTER SET utf8mb4 NOT NULL COMMENT '扩展属性'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统配置' ROW_FORMAT=COMPACT;
--
-- 转存表中的数据 `lsky_config`
--
INSERT INTO `lsky_config` (`id`, `key`, `type`, `input_type`, `name`, `title`, `tip`, `value`, `extend`) VALUES
(1, 'basics', 'bool', 'checkbox', 'close_register', '关闭注册', NULL, '0', ''),
(2, 'basics', 'text', 'text', 'site_name', '网站标题', NULL, 'Lsky Pro', ''),
(3, 'basics', 'text', 'text', 'site_keywords', '网站关键字', NULL, 'Lsky Pro', ''),
(4, 'basics', 'text', 'text', 'site_description', '网站描述', NULL, 'Lsky Pro, Your photo album on the cloud.', ''),
(5, 'basics', 'text', 'text', 'icp_number', '备案号', NULL, '', ''),
(6, 'upload', 'bool', 'checkbox', 'allowed_tourist_upload', '允许游客上传', '是否允许游客上传', '1', ''),
(7, 'upload', 'text', 'text', 'upload_max_size', '最大上传大小', '单位:b,默认52428805M', '5242880', ''),
(8, 'upload', 'text', 'number', 'upload_single_num', '单次同时上传数量', NULL, '10', ''),
(9, 'upload', 'text', 'text', 'upload_allowed_exts', '允许上传的文件后缀', '逗号隔开', 'jpg,jpeg,gif,png,ico', ''),
(10, 'upload', 'text', 'text', 'path_naming_rule', '文件路径命名规则', '<a href="javascript:void(0)" mdui-dialog="{target: \'#path-var\'}">路径命名变量对照表</a>', '{Y}/{m}/{d}', ''),
(11, 'upload', 'text', 'text', 'file_naming_rule', '文件命名规则', '<a href="javascript:void(0)" mdui-dialog="{target: \'#file-var\'}">文件命名变量对照表</a>', '{uniqid}', ''),
(12, 'user', 'text', 'text', 'user_initial_quota', '用户初始配额容量', '单位:b,默认10737418241G,最大18位', '1073741824', ''),
(13, 'mail', 'select', 'text', 'mail_send_mode', '邮件发送方式', NULL, 'smtp', '{\"smtp\":\"SMTP\"}'),
(14, 'mail', 'select', 'text', 'mail_smtp_secure', 'SMTP验证方式', NULL, 'none', '{\"none\":\"None\",\"tls\":\"TLS\",\"ssl\":\"SSL\"}'),
(15, 'mail', 'text', 'text', 'mail_smtp_host', 'SMTP主机地址', NULL, '', ''),
(16, 'mail', 'text', 'text', 'mail_smtp_username', 'SMTP用户名', NULL, '', ''),
(17, 'mail', 'text', 'password', 'mail_smtp_password', 'SMTP密码', NULL, '', ''),
(18, 'mail', 'text', 'number', 'mail_smtp_port', 'SMTP端口', '25/465', '25', ''),
(19, 'mail', 'text', 'email', 'mail_form_email', '发件人邮箱', NULL, '', ''),
(20, 'other', 'bool', 'checkbox', 'soft_delete', '软删除', '删除图片时不删除源文件,不建议开启', '0', ''),
(21, 'storage_strategy', 'select', 'text', 'storage_strategy', '储存策略', NULL, 'local', ''),
(22, 'local', 'text', 'text', 'local_cdn_domain', 'CDN加速域名', NULL, '', ''),
(23, 'oss', 'text', 'text', 'oss_cdn_domain', 'Bucket域名', NULL, '', ''),
(24, 'oss', 'text', 'text', 'oss_access_key_id', 'AccessKeyId', NULL, '', ''),
(25, 'oss', 'text', 'text', 'oss_access_key_secret', 'AccessKeySecret', NULL, '', ''),
(26, 'oss', 'text', 'text', 'oss_endpoint', 'Endpoint', '地域节点', '', ''),
(27, 'oss', 'text', 'text', 'oss_bucket', 'Bucket', NULL, '', ''),
(28, 'cos', 'text', 'text', 'cos_cdn_domain', 'CDN加速域名', NULL, '', ''),
(29, 'cos', 'text', 'text', 'cos_secret_id', 'SecretId', NULL, '', ''),
(30, 'cos', 'text', 'text', 'cos_secret_key', 'SecretKey', NULL, '', ''),
(31, 'cos', 'text', 'text', 'cos_region', '所属地域', NULL, '', ''),
(32, 'cos', 'text', 'text', 'cos_bucket', 'Bucket', '储存桶名称', '', ''),
(33, 'kodo', 'text', 'text', 'kodo_cdn_domain', 'CDN加速域名', NULL, '', ''),
(34, 'kodo', 'text', 'text', 'kodo_access_key', 'AccessKey', NULL, '', ''),
(35, 'kodo', 'text', 'text', 'kodo_secret_key', 'SecretKey', NULL, '', ''),
(36, 'kodo', 'text', 'text', 'kodo_bucket', 'Bucket', NULL, '', ''),
(37, 'uss', 'text', 'text', 'uss_cdn_domain', 'CDN加速域名', NULL, '', ''),
(38, 'uss', 'text', 'text', 'uss_operator_name', 'OperatorName', '操作员账号', '', ''),
(39, 'uss', 'text', 'password', 'uss_operator_pwd', 'OperatorPwd', '操作员密码', '', ''),
(40, 'uss', 'text', 'text', 'uss_service_name', 'ServiceName', '云储存服务名称', '', ''),
(41, '', 'text', 'text', 'system_version', '系统版本', NULL, '1.4.2', ''),
(42, 'audit', 'bool', 'checkbox', 'open_audit', '开启图片鉴黄', '鉴黄接口申请地址:https://www.moderatecontent.com', '0', ''),
(43, 'audit', 'text', 'text', 'audit_key', 'Key', NULL, '', ''),
(44, 'audit', 'select', 'text', 'audit_index', '内容评级', '1=所有人,2=少年,3=成人', '3', '{\"1\": \"所有人\", \"2\": \"少年\", \"3\": \"成人\"}'),
(45, 'other', 'bool', 'checkbox', 'open_api', '开启API', '是否开放接口', '0', '');
-- --------------------------------------------------------
`extend` text CHARACTER SET utf8mb4 NOT NULL COMMENT '扩展属性',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='系统配置' ROW_FORMAT=COMPACT;
--
-- 表的结构 `lsky_images`
@@ -95,7 +29,7 @@ INSERT INTO `lsky_config` (`id`, `key`, `type`, `input_type`, `name`, `title`, `
DROP TABLE IF EXISTS `lsky_images`;
CREATE TABLE IF NOT EXISTS `lsky_images` (
`id` int(11) UNSIGNED NOT NULL COMMENT 'ID',
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
`user_id` int(11) NOT NULL DEFAULT 0 COMMENT '用户ID,为0表示游客上传',
`folder_id` int(11) NOT NULL DEFAULT 0 COMMENT '文件夹ID',
`strategy` varchar(32) NOT NULL DEFAULT 'local' COMMENT '储存策略,默认本地',
@@ -107,10 +41,10 @@ CREATE TABLE IF NOT EXISTS `lsky_images` (
`sha1` varchar(100) NOT NULL COMMENT 'hash sha1',
`md5` varchar(32) NOT NULL COMMENT 'hash md5',
`ip` varchar(128) DEFAULT NULL COMMENT '上传者IP',
`create_time` int(11) NOT NULL COMMENT '创建时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='图片表';
-- --------------------------------------------------------
`suspicious` tinyint(1) NOT NULL DEFAULT '0' COMMENT '可疑图片',
`create_time` int(11) NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='图片表';
--
-- 表的结构 `lsky_users`
@@ -118,10 +52,11 @@ CREATE TABLE IF NOT EXISTS `lsky_images` (
DROP TABLE IF EXISTS `lsky_users`;
CREATE TABLE IF NOT EXISTS `lsky_users` (
`id` int(11) UNSIGNED NOT NULL,
`username` varchar(32) NOT NULL COMMENT '用户名',
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL DEFAULT '0' COMMENT '角色组ID',
`username` varchar(32) NOT NULL UNIQUE COMMENT '用户名',
`nickname` varchar(32) DEFAULT NULL COMMENT '昵称',
`email` varchar(100) NOT NULL COMMENT '邮箱',
`email` varchar(100) NOT NULL UNIQUE COMMENT '邮箱',
`password` varchar(32) NOT NULL COMMENT '密码',
`quota` decimal(20,2) NOT NULL DEFAULT '0.00' COMMENT '可用配额容量(字节:b)',
`default_folder` varchar(32) DEFAULT NULL COMMENT '默认上传文件夹',
@@ -131,8 +66,9 @@ CREATE TABLE IF NOT EXISTS `lsky_users` (
`reg_ip` varchar(32) DEFAULT NULL COMMENT '注册IP',
`delete_time` int(11) DEFAULT NULL COMMENT '删除时间',
`update_time` int(11) NOT NULL COMMENT '更新时间',
`create_time` int(11) NOT NULL COMMENT '添加时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
`create_time` int(11) NOT NULL COMMENT '添加时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='用户表';
--
-- 表的结构 `lsky_folders`
@@ -140,70 +76,88 @@ CREATE TABLE IF NOT EXISTS `lsky_users` (
DROP TABLE IF EXISTS `lsky_folders`;
CREATE TABLE `lsky_folders` (
`id` int(11) NOT NULL COMMENT 'ID',
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`user_id` int(11) NOT NULL COMMENT '用户ID',
`parent_id` int(11) NOT NULL DEFAULT '0' COMMENT '上级文件夹ID',
`name` varchar(100) NOT NULL COMMENT '文件夹名称',
`delete_time` int(11) DEFAULT NULL COMMENT '删除时间',
`update_time` int(11) DEFAULT NULL COMMENT '更新时间',
`create_time` int(11) DEFAULT NULL COMMENT '添加时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文件夹表';
`create_time` int(11) DEFAULT NULL COMMENT '添加时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='文件夹表';
--
-- Indexes for dumped tables
-- 表的结构 `lsky_users_group`
--
--
-- Indexes for table `lsky_config`
--
ALTER TABLE `lsky_config`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
DROP TABLE IF EXISTS `lsky_group`;
CREATE TABLE `lsky_group` (
`id` INT NOT NULL AUTO_INCREMENT COMMENT 'ID',
`strategy` varchar(32) NOT NULL COMMENT '使用策略',
`name` varchar(32) NOT NULL COMMENT '组名称',
`default` tinyint(1) NOT NULL DEFAULT '0' COMMENT '默认',
`update_time` int(11) DEFAULT NULL COMMENT '更新时间',
`create_time` int(11) DEFAULT NULL COMMENT '添加时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='文件夹表';
-- --------------------------------------------------------
--
-- Indexes for table `lsky_images`
--
ALTER TABLE `lsky_images`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `lsky_users`
--
ALTER TABLE `lsky_users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`),
ADD UNIQUE KEY `email` (`email`);
--
-- Indexes for table `lsky_folders`
--
ALTER TABLE `lsky_folders`
ADD PRIMARY KEY (`id`);
--
-- 在导出的表使用AUTO_INCREMENT
-- 表中的数据 `lsky_config`
--
--
-- 使用表AUTO_INCREMENT `lsky_config`
--
ALTER TABLE `lsky_config`
MODIFY `id` smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=46;
INSERT INTO `lsky_config` (`id`, `key`, `type`, `input_type`, `name`, `title`, `tip`, `value`, `extend`) VALUES
(NULL, 'basics', 'bool', 'checkbox', 'close_register', '关闭注册', NULL, '0', ''),
(NULL, 'basics', 'text', 'text', 'site_name', '网站标题', NULL, 'Lsky Pro', ''),
(NULL, 'basics', 'text', 'text', 'site_keywords', '网站关键字', NULL, 'Lsky Pro', ''),
(NULL, 'basics', 'text', 'text', 'site_description', '网站描述', NULL, 'Lsky Pro, Your photo album on the cloud.', ''),
(NULL, 'basics', 'textarea', 'textarea', 'custom_style', '自定义CSS', NULL, '<!-- 可以直接引入第三方css样式 -->\r\n<style>\r\n /* body {} */\r\n</style>', ''),
(NULL, 'basics', 'textarea', 'textarea', 'statistics_code', '统计代码', NULL, '<script>\r\n// js统计代码</script>', ''),
(NULL, 'basics', 'text', 'text', 'icp_number', '备案号', NULL, '', ''),
(NULL, 'upload', 'bool', 'checkbox', 'allowed_tourist_upload', '允许游客上传', '是否允许游客上传', '1', ''),
(NULL, 'upload', 'text', 'text', 'upload_max_size', '最大上传大小', '单位:b,默认52428805M', '5242880', ''),
(NULL, 'upload', 'text', 'number', 'upload_single_num', '单次同时上传数量', NULL, '10', ''),
(NULL, 'upload', 'text', 'text', 'upload_allowed_exts', '允许上传的文件后缀', '逗号隔开', 'jpg,jpeg,gif,png,ico', ''),
(NULL, 'upload', 'text', 'text', 'path_naming_rule', '文件路径命名规则', '<a href="javascript:void(0)" mdui-dialog="{target: \'#path-var\'}">路径命名变量对照表</a>', '{Y}/{m}/{d}', ''),
(NULL, 'upload', 'text', 'text', 'file_naming_rule', '文件命名规则', '<a href="javascript:void(0)" mdui-dialog="{target: \'#file-var\'}">文件命名变量对照表</a>', '{uniqid}', ''),
(NULL, 'user', 'text', 'text', 'user_initial_quota', '用户初始配额容量', '单位:b,默认10737418241G,最大18位', '1073741824', ''),
(NULL, 'mail', 'select', 'text', 'mail_send_mode', '邮件发送方式', NULL, 'smtp', '{\"smtp\":\"SMTP\"}'),
(NULL, 'mail', 'select', 'text', 'mail_smtp_secure', 'SMTP验证方式', NULL, 'none', '{\"none\":\"None\",\"tls\":\"TLS\",\"ssl\":\"SSL\"}'),
(NULL, 'mail', 'text', 'text', 'mail_smtp_host', 'SMTP主机地址', NULL, '', ''),
(NULL, 'mail', 'text', 'text', 'mail_smtp_username', 'SMTP用户名', NULL, '', ''),
(NULL, 'mail', 'text', 'password', 'mail_smtp_password', 'SMTP密码', NULL, '', ''),
(NULL, 'mail', 'text', 'number', 'mail_smtp_port', 'SMTP端口', '25/465', '25', ''),
(NULL, 'mail', 'text', 'email', 'mail_form_email', '发件人邮箱', NULL, '', ''),
--
-- 使用表AUTO_INCREMENT `lsky_images`
--
ALTER TABLE `lsky_images`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID';
(NULL, 'other', 'bool', 'checkbox', 'soft_delete', '软删除', '删除图片时不删除源文件,不建议开启', '0', ''),
(NULL, 'other', 'bool', 'checkbox', 'open_api', '开启API', '是否开放接口', '0', ''),
--
-- 使用表AUTO_INCREMENT `lsky_users`
--
ALTER TABLE `lsky_users`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
(NULL, 'storage_strategy', 'select', 'text', 'storage_strategy', '储存策略', NULL, 'local', ''),
(NULL, 'local', 'text', 'text', 'local_cdn_domain', 'CDN加速域名', NULL, '', ''),
(NULL, 'oss', 'text', 'text', 'oss_cdn_domain', 'Bucket域名', NULL, '', ''),
(NULL, 'oss', 'text', 'text', 'oss_access_key_id', 'AccessKeyId', NULL, '', ''),
(NULL, 'oss', 'text', 'text', 'oss_access_key_secret', 'AccessKeySecret', NULL, '', ''),
(NULL, 'oss', 'text', 'text', 'oss_endpoint', 'Endpoint', '地域节点', '', ''),
(NULL, 'oss', 'text', 'text', 'oss_bucket', 'Bucket', NULL, '', ''),
(NULL, 'cos', 'text', 'text', 'cos_cdn_domain', 'CDN加速域名', NULL, '', ''),
(NULL, 'cos', 'text', 'text', 'cos_secret_id', 'SecretId', NULL, '', ''),
(NULL, 'cos', 'text', 'text', 'cos_secret_key', 'SecretKey', NULL, '', ''),
(NULL, 'cos', 'text', 'text', 'cos_region', '所属地域', NULL, '', ''),
(NULL, 'cos', 'text', 'text', 'cos_bucket', 'Bucket', '储存桶名称', '', ''),
(NULL, 'kodo', 'text', 'text', 'kodo_cdn_domain', 'CDN加速域名', NULL, '', ''),
(NULL, 'kodo', 'text', 'text', 'kodo_access_key', 'AccessKey', NULL, '', ''),
(NULL, 'kodo', 'text', 'text', 'kodo_secret_key', 'SecretKey', NULL, '', ''),
(NULL, 'kodo', 'text', 'text', 'kodo_bucket', 'Bucket', NULL, '', ''),
(NULL, 'uss', 'text', 'text', 'uss_cdn_domain', 'CDN加速域名', NULL, '', ''),
(NULL, 'uss', 'text', 'text', 'uss_operator_name', 'OperatorName', '操作员账号', '', ''),
(NULL, 'uss', 'text', 'password', 'uss_operator_pwd', 'OperatorPwd', '操作员密码', '', ''),
(NULL, 'uss', 'text', 'text', 'uss_service_name', 'ServiceName', '云储存服务名称', '', ''),
--
-- 使用表AUTO_INCREMENT `lsky_folders`
--
ALTER TABLE `lsky_folders`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', AUTO_INCREMENT=1;
(NULL, 'audit', 'bool', 'checkbox', 'open_audit', '开启图片鉴黄', '接口申请地址:<a href="https://www.moderatecontent.com" target="_blank">https://www.moderatecontent.com</a>', '0', ''),
(NULL, 'audit', 'text', 'text', 'audit_key', 'Key', NULL, '', ''),
(NULL, 'audit', 'select', 'text', 'audit_index', '内容评级', '1=所有人,2=少年,3=成人', '3', '{\"1\": \"所有人\", \"2\": \"少年\", \"3\": \"成人\"}'),
(NULL, '', 'text', 'text', 'system_version', '系统版本', NULL, '1.4.2', '');
INSERT INTO `lsky_group` (`id`, `strategy`, `name`, `default`, `update_time`, `create_time`) VALUES (NULL, 'local', '默认组', '1', '0', '0');
+17
View File
@@ -46,3 +46,20 @@ CREATE TABLE IF NOT EXISTS `lsky_folders` (
UPDATE `lsky_config` SET `value` = '1.4.2' WHERE `lsky_config`.`name` = 'system_version';
UPDATE `lsky_images` SET `strategy` = 'uss' WHERE `lsky_images`.`strategy` = 'upyun';
UPDATE `lsky_images` SET `strategy` = 'kodo' WHERE `lsky_images`.`strategy` = 'qiniu';
-- v1.5.0
UPDATE `lsky_config` SET `value` = '1.5.0' WHERE `lsky_config`.`name` = 'system_version';
UPDATE `lsky_config` SET `tip` = '接口申请地址:<a href="https://www.moderatecontent.com" target="_blank">https://www.moderatecontent.com</a>' WHERE `lsky_config`.`name` = 'open_audit';
INSERT IGNORE INTO `lsky_config` (`id`, `key`, `type`, `input_type`, `name`, `title`, `tip`, `value`, `extend`) VALUES
(NULL, 'basics', 'textarea', 'textarea', 'custom_style', '自定义CSS', NULL, '<!-- 可以直接引入第三方css样式 -->\r\n<style>\r\n /* body {} */\r\n</style>', ''),
(NULL, 'basics', 'textarea', 'textarea', 'statistics_code', '统计代码', NULL, '<script>\r\n // js统计代码 \r\n</script>', '');
CREATE TABLE IF NOT EXISTS `lsky_group` (
`id` INT NOT NULL AUTO_INCREMENT COMMENT 'ID',
`strategy` varchar(32) NOT NULL COMMENT '使用策略',
`name` varchar(32) NOT NULL COMMENT '组名称',
`default` tinyint(1) NOT NULL DEFAULT '0' COMMENT '默认',
`update_time` int(11) DEFAULT NULL COMMENT '更新时间',
`create_time` int(11) DEFAULT NULL COMMENT '添加时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='文件夹表';
INSERT IGNORE INTO `lsky_group` (`id`, `strategy`, `name`, `default`, `update_time`, `create_time`) VALUES (NULL, 'local', '默认组', '1', '0', '0');