1、更换编辑器
2、seo优化功能 3、表单的bug
This commit is contained in:
@@ -56,7 +56,7 @@ class Content extends Admin{
|
||||
}
|
||||
|
||||
$list = $this->model->where($map)->order($order)->paginate(15, false, array(
|
||||
'query' => $this->request->param()
|
||||
'query' => $this->param
|
||||
));
|
||||
|
||||
$data = array(
|
||||
|
||||
@@ -12,31 +12,20 @@ use app\common\controller\Admin;
|
||||
|
||||
class Seo extends Admin{
|
||||
|
||||
protected $model;
|
||||
protected $keyList;
|
||||
protected $seo;
|
||||
protected $rewrite;
|
||||
|
||||
public function _initialize(){
|
||||
parent::_initialize();
|
||||
$app=array(''=>'-所有模块-','index'=>'前台模块','user'=>'用户中心');
|
||||
$this->keyList = array(
|
||||
array('name'=>'id','title'=>'标识','type'=>'hidden'),
|
||||
array('name'=>'title','title'=>'规则名称','type'=>'text','option'=>'','help'=>'规则名称,方便记忆'),
|
||||
array('name'=>'app','title'=>'模块名','type'=>'select','option'=>$app,'help'=>'不选表示所有模块'),
|
||||
array('name'=>'controller','title'=>'控制器','type'=>'text','option'=>'','help'=>'不填表示所有控制器'),
|
||||
array('name'=>'act','title'=>'方法','type'=>'text','option'=>'','help'=>'不填表示所有方法'),
|
||||
array('name'=>'seo_title','title'=>'SEO标题','type'=>'text','option'=>'','help'=>'不填表示使用默认'),
|
||||
array('name'=>'seo_keywords','title'=>'SEO关键字','type'=>'text','option'=>'','help'=>'不填表示使用默认'),
|
||||
array('name'=>'seo_description','title'=>'SEO描述','type'=>'text','option'=>'','help'=>'不填表示使用默认'),
|
||||
array('name'=>'status', 'title'=>'状态', 'type'=>'select','option'=>array('0'=>'禁用','1'=>'启用'),'help'=>''),
|
||||
array('name'=>'sort','title'=>'排序','type'=>'text','option'=>'','help'=>'')
|
||||
);
|
||||
$this->seo = model('SeoRule');
|
||||
$this->rewrite = model('Rewrite');
|
||||
}
|
||||
|
||||
public function index($page = 1, $r = 20){
|
||||
//读取规则列表
|
||||
$map = array('status' => array('EGT', 0));
|
||||
|
||||
$list = model('SeoRule')->where($map)->order('sort asc')->paginate(10);
|
||||
$list = $this->seo->where($map)->order('sort asc')->paginate(10);
|
||||
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
@@ -50,19 +39,15 @@ class Seo extends Admin{
|
||||
public function add(){
|
||||
if (IS_POST) {
|
||||
$data = $this->request->post();
|
||||
if ($data) {
|
||||
$result = model('SeoRule')->save($data);
|
||||
if ($result) {
|
||||
return $this->success("添加成功!");
|
||||
}else{
|
||||
return $this->error("添加失败!");
|
||||
}
|
||||
$result = $this->seo->save($data);
|
||||
if ($result) {
|
||||
return $this->success("添加成功!");
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
return $this->error("添加失败!");
|
||||
}
|
||||
}else{
|
||||
$data = array(
|
||||
'keyList' => $this->keyList
|
||||
'keyList' => $this->seo->keyList
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta("添加规则");
|
||||
@@ -73,22 +58,18 @@ class Seo extends Admin{
|
||||
public function edit($id = null){
|
||||
if (IS_POST) {
|
||||
$data = $this->request->post();
|
||||
if ($data) {
|
||||
$result = model('SeoRule')->save($data,array('id'=>$data['id']));
|
||||
if (false !== $result) {
|
||||
return $this->success("修改成功!");
|
||||
}else{
|
||||
return $this->error("修改失败!");
|
||||
}
|
||||
$result = $this->seo->save($data,array('id'=>$data['id']));
|
||||
if (false !== $result) {
|
||||
return $this->success("修改成功!");
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
return $this->error("修改失败!");
|
||||
}
|
||||
}else{
|
||||
$id = input('id','','trim,intval');
|
||||
$info = db('SeoRule')->where(array('id'=>$id))->find();
|
||||
$info = $this->seo->where(array('id'=>$id))->find();
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'keyList' => $this->keyList
|
||||
'keyList' => $this->seo->keyList
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta("编辑规则");
|
||||
@@ -101,7 +82,61 @@ class Seo extends Admin{
|
||||
if (empty($id)) {
|
||||
return $this->error("非法操作!");
|
||||
}
|
||||
$result = db('SeoRule')->where(array('id'=>array('IN',$id)))->delete();
|
||||
$result = $this->seo->where(array('id'=>array('IN',$id)))->delete();
|
||||
if ($result) {
|
||||
return $this->success("删除成功!");
|
||||
}else{
|
||||
return $this->error("删除失败!");
|
||||
}
|
||||
}
|
||||
|
||||
public function rewrite(){
|
||||
$list = db('Rewrite')->paginate(10);
|
||||
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
'page' => $list->render()
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta("路由规则");
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function addrewrite(){
|
||||
if (IS_POST) {
|
||||
# code...
|
||||
}else{
|
||||
$data = array(
|
||||
'keyList' => $this->rewrite->keyList
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta("添加路由规则");
|
||||
return $this->fetch('public/edit');
|
||||
}
|
||||
}
|
||||
|
||||
public function editrewrite(){
|
||||
if (IS_POST) {
|
||||
# code...
|
||||
}else{
|
||||
$id = input('id','','trim,intval');
|
||||
$info = db('Rewrite')->where(array('id'=>$id))->find();
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'keyList' => $this->rewrite->keyList
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta("编辑路由规则");
|
||||
return $this->fetch('public/edit');
|
||||
}
|
||||
}
|
||||
|
||||
public function delrewrite(){
|
||||
$id = $this->getArrayParam('id');
|
||||
if (empty($id)) {
|
||||
return $this->error("非法操作!");
|
||||
}
|
||||
$result = db('Rewrite')->where(array('id'=>array('IN',$id)))->delete();
|
||||
if ($result) {
|
||||
return $this->success("删除成功!");
|
||||
}else{
|
||||
|
||||
@@ -4,8 +4,12 @@
|
||||
<script src="__PUBLIC__/plugs/tagsinput/bootstrap-tagsinput.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/webuploader/webuploader.css">
|
||||
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/plugs/ueditor/ueditor.config.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/plugs/ueditor/ueditor.all.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/editor/css/simditor.css" />
|
||||
|
||||
<script type="text/javascript" src="__PUBLIC__/plugs/editor/js/module.js"></script>
|
||||
<script type="text/javascript" src="__PUBLIC__/plugs/editor/js/hotkeys.js"></script>
|
||||
<script type="text/javascript" src="__PUBLIC__/plugs/editor/js/uploader.js"></script>
|
||||
<script type="text/javascript" src="__PUBLIC__/plugs/editor/js/simditor.js"></script>
|
||||
<!-- datepicker statr -->
|
||||
<link href="__PUBLIC__/plugs/datepicker/css/foundation-datepicker.min.css" rel="stylesheet" type="text/css">
|
||||
<script src="__PUBLIC__/plugs/datepicker/js/foundation-datepicker.js"></script>
|
||||
@@ -41,7 +45,7 @@
|
||||
{else/}
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">{$field['title']|htmlspecialchars}</label>
|
||||
<div class="col-lg-8 col-sm-10">
|
||||
<div class="col-lg-10 col-sm-10">
|
||||
{:widget('common/Form/show',array($field,$info))}
|
||||
<div class="help-block">{$field['help']|default=''}</div>
|
||||
</div>
|
||||
@@ -59,7 +63,7 @@
|
||||
{else/}
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">{$field['title']|htmlspecialchars}</label>
|
||||
<div class="col-lg-8 col-sm-10">
|
||||
<div class="col-lg-10 col-sm-10">
|
||||
{:widget('common/Form/show',array($field,$info))}
|
||||
<div class="help-block">{$field['help']|default=''}</div>
|
||||
</div>
|
||||
|
||||
49
application/admin/view/seo/rewrite.html
Normal file
49
application/admin/view/seo/rewrite.html
Normal file
@@ -0,0 +1,49 @@
|
||||
{extend name="public/base"/}
|
||||
{block name="style"}
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
|
||||
{/block}
|
||||
{block name="body"}
|
||||
<div class="main-box clearfix">
|
||||
<header class="main-box-header clearfix">
|
||||
<div class="pull-left">
|
||||
<h2>{$meta_title}</h2>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-primary" href="{:url('addrewrite')}">新 增</a>
|
||||
<button class="btn btn-danger ajax-post confirm" url="{:url('delrewrite')}" target-form="ids">删 除</button>
|
||||
</div>
|
||||
</header>
|
||||
<div class="main-box-body clearfix">
|
||||
<div class="table-responsive clearfix">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
|
||||
<th width="60">ID</th>
|
||||
<th>规则</th>
|
||||
<th>地址</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="list" id="item"}
|
||||
<tr>
|
||||
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$item['id']}"></td>
|
||||
<td>{$item['id']}</td>
|
||||
<td>{$item['rule']}</td>
|
||||
<td>{$item['url']}</td>
|
||||
<td>
|
||||
<a href="{:url('editrewrite?id='.$item['id'])}">编辑</a>
|
||||
<a href="{:url('delrewrite?id='.$item['id'])}" class="confirm ajax-get">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
{/block}
|
||||
Reference in New Issue
Block a user