优化安装程序,初试数据库驱动为InnoDb
This commit is contained in:
@@ -22,7 +22,7 @@ class Plugin extends \sent\Addons{
|
|||||||
'title'=>'站点统计信息',
|
'title'=>'站点统计信息',
|
||||||
'description'=>'统计站点的基础信息',
|
'description'=>'统计站点的基础信息',
|
||||||
'status'=>1,
|
'status'=>1,
|
||||||
'author'=>'thinkphp',
|
'author'=>'molong',
|
||||||
'version'=>'0.2'
|
'version'=>'0.2'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -141,10 +141,8 @@ class Config extends Base {
|
|||||||
*/
|
*/
|
||||||
public function save($config) {
|
public function save($config) {
|
||||||
if ($config && is_array($config)) {
|
if ($config && is_array($config)) {
|
||||||
$Config = db('Config');
|
|
||||||
foreach ($config as $name => $value) {
|
foreach ($config as $name => $value) {
|
||||||
$map = array('name' => $name);
|
(new ConfigM())->save(['value' => $value], ['name' => $name]);
|
||||||
$Config->where($map)->setField('value', $value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Cache::pull('system_config_data');
|
Cache::pull('system_config_data');
|
||||||
@@ -156,14 +154,14 @@ class Config extends Base {
|
|||||||
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||||
*/
|
*/
|
||||||
public function del() {
|
public function del() {
|
||||||
$id = array_unique((array) input('id', 0));
|
$id = $this->request->param('id');
|
||||||
|
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
return $this->error('请选择要操作的数据!');
|
return $this->error('请选择要操作的数据!');
|
||||||
}
|
}
|
||||||
|
|
||||||
$map = array('id' => array('in', $id));
|
$result = ConfigM::find($id)->delete();
|
||||||
if (db('Config')->where($map)->delete()) {
|
if (false !== $result) {
|
||||||
Cache::pull('system_config_data');
|
Cache::pull('system_config_data');
|
||||||
return $this->success('删除成功');
|
return $this->success('删除成功');
|
||||||
} else {
|
} else {
|
||||||
@@ -171,41 +169,6 @@ class Config extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @title 配置排序
|
|
||||||
* @author huajie <banhuajie@163.com>
|
|
||||||
*/
|
|
||||||
public function sort() {
|
|
||||||
if ($this->request->isGet()) {
|
|
||||||
$ids = input('ids');
|
|
||||||
//获取排序的数据
|
|
||||||
$map = array('status' => array('gt', -1));
|
|
||||||
if (!empty($ids)) {
|
|
||||||
$map['id'] = array('in', $ids);
|
|
||||||
} elseif (input('group')) {
|
|
||||||
$map['group'] = input('group');
|
|
||||||
}
|
|
||||||
$list = db('Config')->where($map)->field('id,title')->order('sort asc,id asc')->select();
|
|
||||||
|
|
||||||
$this->assign('list', $list);
|
|
||||||
$this->setMeta('配置排序');
|
|
||||||
return $this->fetch();
|
|
||||||
} elseif ($this->request->isPost()) {
|
|
||||||
$ids = input('post.ids');
|
|
||||||
$ids = explode(',', $ids);
|
|
||||||
foreach ($ids as $key => $value) {
|
|
||||||
$res = db('Config')->where(array('id' => $value))->setField('sort', $key + 1);
|
|
||||||
}
|
|
||||||
if ($res !== false) {
|
|
||||||
return $this->success('排序成功!', Cookie('__forward__'));
|
|
||||||
} else {
|
|
||||||
return $this->error('排序失败!');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return $this->error('非法请求!');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 主题选择
|
* @title 主题选择
|
||||||
*/
|
*/
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -46,7 +46,7 @@
|
|||||||
<i class="fa fa-plus-square"></i>
|
<i class="fa fa-plus-square"></i>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{$list['url']}</td>
|
<td><a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="url" data-type="text" data-pk="{$list['id']}" data-url="{:url('/admin/channel/editable')}">{$list['url']}</a></td>
|
||||||
<td><a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="sort" data-type="text" data-pk="{$list['id']}" data-url="{:url('/admin/channel/editable')}">{$list['sort']}</a></td>
|
<td><a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="sort" data-type="text" data-pk="{$list['id']}" data-url="{:url('/admin/channel/editable')}">{$list['sort']}</a></td>
|
||||||
<td>
|
<td>
|
||||||
{if $list['status']}
|
{if $list['status']}
|
||||||
@@ -70,32 +70,3 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="script"}
|
|
||||||
<script type="text/javascript" src="__static__/common/js/bootstrap-editable.min.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function() {
|
|
||||||
//点击排序
|
|
||||||
$('.list_sort').click(function(){
|
|
||||||
var url = $(this).attr('url');
|
|
||||||
var ids = $('.ids:checked');
|
|
||||||
var param = '';
|
|
||||||
if(ids.length > 0){
|
|
||||||
var str = new Array();
|
|
||||||
ids.each(function(){
|
|
||||||
str.push($(this).val());
|
|
||||||
});
|
|
||||||
param = str.join(',');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(url != undefined && url != ''){
|
|
||||||
window.location.href = url + '?ids=' + param;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.fn.editable.defaults.mode = 'popup';
|
|
||||||
$.fn.editableform.buttons = '<button type="submit" class="btn btn-success editable-submit btn-mini"><i class="fa fa-check-square-o fa-white"></i></button>' +
|
|
||||||
'<button type="button" class="btn editable-cancel btn-mini"><i class="fa fa-times"></i></button>';
|
|
||||||
$('.editable').editable();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{/block}
|
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
{extend name="admin/public/base"/}
|
{extend name="admin/public/base"/}
|
||||||
{block name="style"}
|
|
||||||
<link rel="stylesheet" type="text/css" href="__static__/common/css/bootstrap-editable.css">
|
|
||||||
{/block}
|
|
||||||
{block name="body"}
|
{block name="body"}
|
||||||
<div class="box box-primary">
|
<div class="box box-primary">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
@@ -47,8 +44,8 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{$menu.up_title|default='无'}</td>
|
<td>{$menu.up_title|default='无'}</td>
|
||||||
<td>{$menu.group}</td>
|
<td><a href="#" class="editable editable-click" data-id="{$menu['id']}" data-name="group" data-type="text" data-pk="{$menu['id']}" data-url="{:url('/admin/menu/editable')}">{$menu.group}</a></td>
|
||||||
<td>{$menu.url}</td>
|
<td><a href="#" class="editable editable-click" data-id="{$menu['id']}" data-name="url" data-type="text" data-pk="{$menu['id']}" data-url="{:url('/admin/menu/editable')}">{$menu.url}</a></td>
|
||||||
<td><a href="#" class="editable editable-click" data-id="{$menu['id']}" data-name="sort" data-type="text" data-pk="{$menu['id']}" data-url="{:url('/admin/menu/editable')}">{$menu['sort']}</a></td>
|
<td><a href="#" class="editable editable-click" data-id="{$menu['id']}" data-name="sort" data-type="text" data-pk="{$menu['id']}" data-url="{:url('/admin/menu/editable')}">{$menu['sort']}</a></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{:url('/admin/menu/toogleDev',array('id'=>$menu['id'],'value'=>abs($menu['is_dev']-1)))}"
|
<a href="{:url('/admin/menu/toogleDev',array('id'=>$menu['id'],'value'=>abs($menu['is_dev']-1)))}"
|
||||||
@@ -78,34 +75,3 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
{block name="script"}
|
|
||||||
<script type="text/javascript" src="__static__/common/js/bootstrap-editable.min.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function () {
|
|
||||||
$.fn.editable.defaults.mode = 'popup';
|
|
||||||
$.fn.editableform.buttons = '<button type="submit" class="btn btn-success editable-submit btn-mini"><i class="fa fa-check-square-o fa-white"></i></button>' +
|
|
||||||
'<button type="button" class="btn editable-cancel btn-mini"><i class="fa fa-times"></i></button>';
|
|
||||||
$('.editable').editable();
|
|
||||||
//搜索功能
|
|
||||||
$("#search").click(function () {
|
|
||||||
var url = $(this).attr('url');
|
|
||||||
var query = $('.search-form').find('input').serialize();
|
|
||||||
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
|
|
||||||
query = query.replace(/^&/g, '');
|
|
||||||
if (url.indexOf('?') > 0) {
|
|
||||||
url += '&' + query;
|
|
||||||
} else {
|
|
||||||
url += '?' + query;
|
|
||||||
}
|
|
||||||
window.location.href = url;
|
|
||||||
});
|
|
||||||
//回车搜索
|
|
||||||
$(".search-input").keyup(function (e) {
|
|
||||||
if (e.keyCode === 13) {
|
|
||||||
$("#search").click();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{/block}
|
|
||||||
Reference in New Issue
Block a user