mirror of https://github.com/1099438829/apeblog
This commit is contained in:
parent
27f38257dd
commit
9c80b44950
2167
ape_blog.sql
2167
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\DocumentCategoryContent;
|
||||
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 think\facade\Route as Url;
|
||||
|
||||
/**
|
||||
* Class Article
|
||||
|
|
@ -56,7 +52,8 @@ class Category extends AuthController
|
|||
public function save($id="")
|
||||
{
|
||||
$data = Util::postMore([
|
||||
['title',''], ['en_title',''],
|
||||
['title',''],
|
||||
['en_title',''],
|
||||
['type',''],
|
||||
['pid',0],
|
||||
['meta_title',''],
|
||||
|
|
@ -64,6 +61,7 @@ class Category extends AuthController
|
|||
['description',''],
|
||||
['template',''],
|
||||
['link_str',''],
|
||||
['content',''],
|
||||
['sort',0],
|
||||
['display',1]
|
||||
]);
|
||||
|
|
@ -71,9 +69,23 @@ class Category extends AuthController
|
|||
if ($data['type'] == "") return app("json")->fail("类型不能为空");
|
||||
if ($id=="")
|
||||
{
|
||||
$res = aModel::insert($data);
|
||||
}else
|
||||
{ $res = aModel::update($data,['id'=>$id]);
|
||||
$content = $data['content'];
|
||||
unset($data['content']);
|
||||
$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("操作失败");
|
||||
}
|
||||
|
|
@ -98,14 +110,19 @@ class Category extends AuthController
|
|||
*/
|
||||
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' => '',
|
||||
'status' => '',
|
||||
];
|
||||
]);
|
||||
$category = aModel::systemPage($where);
|
||||
$category = get_tree_list($category);
|
||||
$this->assign("category",$category);
|
||||
$this->assign("pid",$pid);
|
||||
$this->assign("template_list",$themeList);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
|
|
@ -118,16 +135,21 @@ class Category extends AuthController
|
|||
*/
|
||||
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' => '',
|
||||
'status' => ''
|
||||
];
|
||||
'status' => '',
|
||||
]);
|
||||
$category = aModel::systemPage($where);
|
||||
$category = get_tree_list($category);
|
||||
$info = aModel::get($request->param(['id']));
|
||||
$info->content = DocumentCategoryContent::get($request->param(['id']))->content;
|
||||
$this->assign("category",$category);
|
||||
$this->assign("info",$info);
|
||||
$this->assign("template_list",$themeList);
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
|
|
@ -60,6 +60,16 @@
|
|||
</select>
|
||||
</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">
|
||||
<label>外链</label>
|
||||
<input type="text" class="form-control" name="link_str" placeholder="外链">
|
||||
|
|
@ -189,7 +199,7 @@
|
|||
return false;
|
||||
}
|
||||
$.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');
|
||||
});
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -60,6 +60,16 @@
|
|||
</select>
|
||||
</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}>
|
||||
<label>外链</label>
|
||||
<input type="text" class="form-control" name="link_str" placeholder="外链" value="{$info.link_str}">
|
||||
|
|
@ -188,8 +198,8 @@
|
|||
if (!checkResult) {
|
||||
return false;
|
||||
}
|
||||
$.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)}
|
||||
$.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 () {parent.location.reload();},2000)}
|
||||
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
});
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
return [
|
||||
// 模板路径
|
||||
'taglib_pre_load' => 'app\common\taglib\Zz'
|
||||
'taglib_pre_load' => 'app\common\taglib\Zz',
|
||||
'view_path' => './template/default/',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,23 +2,28 @@
|
|||
"title":"默认主题",
|
||||
"author":"MonkeyCode",
|
||||
"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":"全部都是可视化的 没什么可说明的",
|
||||
|
|
|
|||
|
|
@ -2,23 +2,28 @@
|
|||
"title":"默认主题",
|
||||
"author":"MonkeyCode",
|
||||
"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":"全部都是可视化的 没什么可说明的",
|
||||
|
|
|
|||
Loading…
Reference in New Issue