mirror of https://github.com/1099438829/apeblog
This commit is contained in:
parent
27f38257dd
commit
9c80b44950
2125
ape_blog.sql
2125
ape_blog.sql
File diff suppressed because it is too large
Load Diff
|
|
@ -5,11 +5,7 @@ namespace app\admin\controller;
|
||||||
use app\admin\model\DocumentCategory as aModel;
|
use app\admin\model\DocumentCategory as aModel;
|
||||||
use app\admin\model\DocumentCategoryContent;
|
use app\admin\model\DocumentCategoryContent;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use FormBuilder\Exception\FormBuilderException;
|
|
||||||
use FormBuilder\Factory\Elm;
|
|
||||||
use app\admin\services\FormBuilderService as Form;
|
|
||||||
use app\admin\services\UtilService as Util;
|
use app\admin\services\UtilService as Util;
|
||||||
use think\facade\Route as Url;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Article
|
* Class Article
|
||||||
|
|
@ -56,7 +52,8 @@ class Category extends AuthController
|
||||||
public function save($id="")
|
public function save($id="")
|
||||||
{
|
{
|
||||||
$data = Util::postMore([
|
$data = Util::postMore([
|
||||||
['title',''], ['en_title',''],
|
['title',''],
|
||||||
|
['en_title',''],
|
||||||
['type',''],
|
['type',''],
|
||||||
['pid',0],
|
['pid',0],
|
||||||
['meta_title',''],
|
['meta_title',''],
|
||||||
|
|
@ -64,6 +61,7 @@ class Category extends AuthController
|
||||||
['description',''],
|
['description',''],
|
||||||
['template',''],
|
['template',''],
|
||||||
['link_str',''],
|
['link_str',''],
|
||||||
|
['content',''],
|
||||||
['sort',0],
|
['sort',0],
|
||||||
['display',1]
|
['display',1]
|
||||||
]);
|
]);
|
||||||
|
|
@ -71,9 +69,23 @@ class Category extends AuthController
|
||||||
if ($data['type'] == "") return app("json")->fail("类型不能为空");
|
if ($data['type'] == "") return app("json")->fail("类型不能为空");
|
||||||
if ($id=="")
|
if ($id=="")
|
||||||
{
|
{
|
||||||
$res = aModel::insert($data);
|
$content = $data['content'];
|
||||||
}else
|
unset($data['content']);
|
||||||
{ $res = aModel::update($data,['id'=>$id]);
|
$model = new aModel();
|
||||||
|
$id = $model->insert($data,true);
|
||||||
|
$data = [
|
||||||
|
'id' => $id,
|
||||||
|
'content'=> $content
|
||||||
|
];
|
||||||
|
$model = new DocumentCategoryContent();
|
||||||
|
$res = $model->save($data);
|
||||||
|
}else{
|
||||||
|
$content = $data['content'];
|
||||||
|
unset($data['content']);
|
||||||
|
$res = aModel::update($data,['id'=>$id]);
|
||||||
|
if ($res){
|
||||||
|
$res = DocumentCategoryContent::update(['content'=>$content],['id'=>$id]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
||||||
}
|
}
|
||||||
|
|
@ -98,14 +110,19 @@ class Category extends AuthController
|
||||||
*/
|
*/
|
||||||
public function add($pid ='')
|
public function add($pid ='')
|
||||||
{
|
{
|
||||||
$where = [
|
$systemConfig = cache('systemConfig');
|
||||||
|
$themeInfoFile = public_path('template'.DIRECTORY_SEPARATOR.$systemConfig['web_template']).'info.json';
|
||||||
|
$themeInfo = json_decode(file_get_contents($themeInfoFile),true);
|
||||||
|
$themeList = $themeInfo['category_list'];
|
||||||
|
$where = Util::postMore([
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'status' => '',
|
'status' => '',
|
||||||
];
|
]);
|
||||||
$category = aModel::systemPage($where);
|
$category = aModel::systemPage($where);
|
||||||
$category = get_tree_list($category);
|
$category = get_tree_list($category);
|
||||||
$this->assign("category",$category);
|
$this->assign("category",$category);
|
||||||
$this->assign("pid",$pid);
|
$this->assign("pid",$pid);
|
||||||
|
$this->assign("template_list",$themeList);
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,16 +135,21 @@ class Category extends AuthController
|
||||||
*/
|
*/
|
||||||
public function edit(Request $request)
|
public function edit(Request $request)
|
||||||
{
|
{
|
||||||
$where = [
|
$systemConfig = cache('systemConfig');
|
||||||
|
$themeInfoFile = public_path('template'.DIRECTORY_SEPARATOR.$systemConfig['web_template']).'info.json';
|
||||||
|
$themeInfo = json_decode(file_get_contents($themeInfoFile),true);
|
||||||
|
$themeList = $themeInfo['category_list'];
|
||||||
|
$where = Util::postMore([
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'status' => ''
|
'status' => '',
|
||||||
];
|
]);
|
||||||
$category = aModel::systemPage($where);
|
$category = aModel::systemPage($where);
|
||||||
$category = get_tree_list($category);
|
$category = get_tree_list($category);
|
||||||
$info = aModel::get($request->param(['id']));
|
$info = aModel::get($request->param(['id']));
|
||||||
$info->content = DocumentCategoryContent::get($request->param(['id']))->content;
|
$info->content = DocumentCategoryContent::get($request->param(['id']))->content;
|
||||||
$this->assign("category",$category);
|
$this->assign("category",$category);
|
||||||
$this->assign("info",$info);
|
$this->assign("info",$info);
|
||||||
|
$this->assign("template_list",$themeList);
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -60,6 +60,16 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label>主题风格</label>
|
||||||
|
<div class="form-controls">
|
||||||
|
<select name="template" class="form-control">
|
||||||
|
{volist name="template_list" id="vo"}
|
||||||
|
<option value="{$vo.template}">{$vo.name}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group col-md-12" id="page-link-str" style="display: none">
|
<div class="form-group col-md-12" id="page-link-str" style="display: none">
|
||||||
<label>外链</label>
|
<label>外链</label>
|
||||||
<input type="text" class="form-control" name="link_str" placeholder="外链">
|
<input type="text" class="form-control" name="link_str" placeholder="外链">
|
||||||
|
|
@ -189,7 +199,7 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$.post(url="/admin/category/save",$('.add-form').serialize(),function (res) {
|
$.post(url="/admin/category/save",$('.add-form').serialize(),function (res) {
|
||||||
if (res.code == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');setTimeout(function () {location.href='/admin/article/index';},2000)}
|
if (res.code == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');setTimeout(function () {location.href='/admin/category/index';},2000)}
|
||||||
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,16 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label>主题风格</label>
|
||||||
|
<div class="form-controls">
|
||||||
|
<select name="template" class="form-control">
|
||||||
|
{volist name="template_list" id="vo"}
|
||||||
|
<option value="{$vo.template}" {notempty name="info.template"}{if $vo.template == $info.template}selected{/if}{/notempty}>{$vo.name}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group col-md-12" id="page-link-str" {if 3!= $info.type}style="display:none;"{/if}>
|
<div class="form-group col-md-12" id="page-link-str" {if 3!= $info.type}style="display:none;"{/if}>
|
||||||
<label>外链</label>
|
<label>外链</label>
|
||||||
<input type="text" class="form-control" name="link_str" placeholder="外链" value="{$info.link_str}">
|
<input type="text" class="form-control" name="link_str" placeholder="外链" value="{$info.link_str}">
|
||||||
|
|
@ -188,8 +198,8 @@
|
||||||
if (!checkResult) {
|
if (!checkResult) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$.post(url="/admin/category/save",$('.add-form').serialize(),function (res) {
|
$.post(url="/admin/category/save?id={$info.id}",$('.add-form').serialize(),function (res) {
|
||||||
if (res.code == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');setTimeout(function () {location.href='/admin/article/index';},2000)}
|
if (res.code == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');setTimeout(function () {parent.location.reload();},2000)}
|
||||||
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// 模板路径
|
// 模板路径
|
||||||
'taglib_pre_load' => 'app\common\taglib\Zz'
|
'taglib_pre_load' => 'app\common\taglib\Zz',
|
||||||
|
'view_path' => './template/default/',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,28 @@
|
||||||
"title":"默认主题",
|
"title":"默认主题",
|
||||||
"author":"MonkeyCode",
|
"author":"MonkeyCode",
|
||||||
"demo_url":"http://default.lcm.wang/",
|
"demo_url":"http://default.lcm.wang/",
|
||||||
"category_type":[
|
"category_list":[
|
||||||
{
|
{
|
||||||
"默认列表":"list_default.html"
|
"name": "默认列表",
|
||||||
|
"template":"list_default.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"两排列表":"list_double.html"
|
"name": "两排列表",
|
||||||
|
"template":"list_double.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"article_type":[
|
"article_list":[
|
||||||
{
|
{
|
||||||
"普通文章":"page.html"
|
"name": "普通文章",
|
||||||
|
"template":"page.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"关于我们":"page_about.html"
|
"name": "关于我们",
|
||||||
|
"template":"page_about.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"产品文章":"page_product.html"
|
"name": "产品文章",
|
||||||
|
"template":"page_product.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info_file":"全部都是可视化的 没什么可说明的",
|
"info_file":"全部都是可视化的 没什么可说明的",
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,28 @@
|
||||||
"title":"默认主题",
|
"title":"默认主题",
|
||||||
"author":"MonkeyCode",
|
"author":"MonkeyCode",
|
||||||
"demo_url":"http://default.lcm.wang/",
|
"demo_url":"http://default.lcm.wang/",
|
||||||
"category_type":[
|
"category_list":[
|
||||||
{
|
{
|
||||||
"默认列表":"list_default.html"
|
"name": "默认列表",
|
||||||
|
"template":"list_default.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"两排列表":"list_double.html"
|
"name": "两排列表",
|
||||||
|
"template":"list_double.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"article_type":[
|
"article_list":[
|
||||||
{
|
{
|
||||||
"普通文章":"page.html"
|
"name": "普通文章",
|
||||||
|
"template":"page.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"关于我们":"page_about.html"
|
"name": "关于我们",
|
||||||
|
"template":"page_about.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"产品文章":"page_product.html"
|
"name": "产品文章",
|
||||||
|
"template":"page_product.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info_file":"全部都是可视化的 没什么可说明的",
|
"info_file":"全部都是可视化的 没什么可说明的",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue