1、更换编辑器
2、seo优化功能 3、表单的bug
This commit is contained in:
@@ -90,10 +90,10 @@ class Base extends \think\Controller{
|
||||
foreach ($seo as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $k => $v) {
|
||||
$meta[$key] = str_replace("[".$k."]", $v, $meta[$key]);
|
||||
$meta[$key] = str_replace("[".$k."]", $v . '|', $meta[$key]);
|
||||
}
|
||||
}else{
|
||||
$meta[$key] = str_replace("[".$key."]", $value, $meta[$key]);
|
||||
$meta[$key] = str_replace("[".$key."]", $value . '|', $meta[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,20 @@ class Upload {
|
||||
echo $data->output();
|
||||
}
|
||||
|
||||
public function editor(){
|
||||
$file = request()->file('upload_file');
|
||||
$info = $file->move(config('editor_upload.rootPath'), true, false);
|
||||
if ($info) {
|
||||
$data = $this->parse_file($info);
|
||||
$data['success'] = true;
|
||||
$data['file_path'] = $data['url'];
|
||||
}else{
|
||||
$data['success'] = false;
|
||||
$data['msg'] = "error message";
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function delete(){
|
||||
$data = array(
|
||||
'status' => 1,
|
||||
|
||||
21
application/common/model/Rewrite.php
Normal file
21
application/common/model/Rewrite.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 伪静态
|
||||
*/
|
||||
class Rewrite extends Base{
|
||||
|
||||
public $keyList = array(
|
||||
array('name'=>'id','title'=>'标识','type'=>'hidden'),
|
||||
array('name'=>'title','title'=>'规则名称','type'=>'text','option'=>'','help'=>'规则名称,方便记忆'),
|
||||
);
|
||||
}
|
||||
@@ -14,6 +14,31 @@ namespace app\common\model;
|
||||
*/
|
||||
class SeoRule extends Base{
|
||||
|
||||
public $keyList = array(
|
||||
array('name'=>'id','title'=>'标识','type'=>'hidden'),
|
||||
array('name'=>'title','title'=>'规则名称','type'=>'text','option'=>'','help'=>'规则名称,方便记忆'),
|
||||
array('name'=>'app','title'=>'模块名','type'=>'select','option'=>array('*'=>'-所有模块-','index'=>'前台模块','user'=>'用户中心'),'help'=>'不选表示所有模块'),
|
||||
array('name'=>'controller','title'=>'控制器','type'=>'text','option'=>'','help'=>'不填表示所有控制器'),
|
||||
array('name'=>'action','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'=>'')
|
||||
);
|
||||
|
||||
protected function setAppAttr($value){
|
||||
return $value ? $value : '*';
|
||||
}
|
||||
|
||||
protected function setControllerAttr($value){
|
||||
return $value ? $value : '*';
|
||||
}
|
||||
|
||||
protected function setActionAttr($value){
|
||||
return (isset($value) && $value) ? $value : '*';
|
||||
}
|
||||
|
||||
protected function getAppAttr($value){
|
||||
return $value ? $value : '*';
|
||||
}
|
||||
@@ -37,13 +62,6 @@ class SeoRule extends Base{
|
||||
}
|
||||
|
||||
private function getMeta($module, $controller, $action, $seo){
|
||||
//查询缓存,如果已有,则直接返回
|
||||
$cacheKey = "sent_seo_meta_{$module}_{$controller}_{$action}";
|
||||
$cache = cache($cacheKey);
|
||||
if($cache !== false) {
|
||||
return $cache;
|
||||
}
|
||||
|
||||
//获取相关的规则
|
||||
$rules = $this->getRelatedRules($module, $controller, $action);
|
||||
|
||||
@@ -82,19 +100,15 @@ class SeoRule extends Base{
|
||||
//生成结果
|
||||
$result = array('title' => $title, 'keywords' => $keywords, 'description' => $description);
|
||||
|
||||
//写入缓存
|
||||
cache($cacheKey, $result);
|
||||
|
||||
//返回结果
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function getRelatedRules($module, $controller, $action){
|
||||
//查询与当前页面相关的SEO规则
|
||||
$map = array();
|
||||
$map = "(app='' or app='$module') and (controller='' or controller='$controller') and (action='' or action='$action') and status=1";
|
||||
$map = "(app='*' or app='$module') and (controller='*' or controller='$controller') and (action='*' or action='$action') and status=1";
|
||||
|
||||
$rules = $this->db()->where($map)->order('sort asc')->select();
|
||||
$rules = $this->where($map)->order('sort asc')->select();
|
||||
|
||||
//返回规则列表
|
||||
return $rules;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="{$field}" name="{$field}" value="{$value}" readonly size="15">
|
||||
<input type="text" class="form-control" id="{$field}" name="{$field}" value="{$value|default=time()|date='Y-m-d H:i:s',###}" readonly size="15">
|
||||
<span class="input-group-addon"><i class="fa fa-th"></i></span>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
<textarea name="{$field}" id="{$field}">{$value}</textarea>
|
||||
<script type="text/javascript">
|
||||
serverUrl = "{:url('upload/ueditor')}";
|
||||
{if $option == 'all' || $option == ''}
|
||||
var ue = UE.getEditor("{$field}",{
|
||||
serverUrl : serverUrl,
|
||||
initialFrameWidth : "100%",
|
||||
initialFrameHeight : "300"
|
||||
});
|
||||
{elseif $option == 'mini'/}
|
||||
var ue = UE.getEditor("{$field}",{
|
||||
toolbars: [
|
||||
['source', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', '|','link', 'unlink', '|','simpleupload',]
|
||||
],
|
||||
initialFrameWidth : "100%",
|
||||
initialFrameHeight : "120"
|
||||
});
|
||||
{/if}
|
||||
</script>
|
||||
<textarea name="{$field}" id="{$field}">{$value}</textarea>
|
||||
<script type="text/javascript">
|
||||
var editor = new Simditor({
|
||||
textarea: $('#{$field}'),
|
||||
defaultImage : '__PUBLIC__/images/wechat.jpg',
|
||||
upload : {
|
||||
placeholder : '欢迎使用SentCMS网站管理系统',
|
||||
url: "{:url('upload/editor')}",
|
||||
fileKey: "upload_file"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user