mirror of https://github.com/1099438829/apeblog
Merge branch 'master' of https://gitee.com/muziys/apeblog
# Conflicts: # app/admin/controller/Category.php # app/admin/view/category/add.html # app/admin/view/category/edit.html
This commit is contained in:
commit
40c40f78ee
2201
ape_blog.sql
2201
ape_blog.sql
File diff suppressed because one or more lines are too long
|
|
@ -56,8 +56,7 @@ class Category extends AuthController
|
|||
public function save($id="")
|
||||
{
|
||||
$data = Util::postMore([
|
||||
['title',''],
|
||||
['en_title',''],
|
||||
['title',''], ['en_title',''],
|
||||
['type',''],
|
||||
['pid',0],
|
||||
['meta_title',''],
|
||||
|
|
@ -74,8 +73,7 @@ class Category extends AuthController
|
|||
{
|
||||
$res = aModel::insert($data);
|
||||
}else
|
||||
{
|
||||
$res = aModel::update($data,['id'=>$id]);
|
||||
{ $res = aModel::update($data,['id'=>$id]);
|
||||
}
|
||||
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -223,6 +223,8 @@ class SystemConfig extends AuthController
|
|||
$data['update_time'] = time();
|
||||
$res = cModel::update($data,['id'=>$id]);
|
||||
}
|
||||
//修改完需要更新缓存
|
||||
cache('systemConfig',null);//清除缓存
|
||||
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\model\SystemConfig as cModel;
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
|
||||
/**
|
||||
* Class Theme
|
||||
* @package app\admin\controller\system
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:20
|
||||
*/
|
||||
class Theme extends AuthController
|
||||
{
|
||||
/**
|
||||
* 主题列表
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-17 11:40
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$themeList = [];
|
||||
// 寻找有多少主题
|
||||
$themeDir = public_path('template/');
|
||||
$defaultTheme = system_config('web_template');
|
||||
if($dh = opendir($themeDir)){
|
||||
while (($file = readdir($dh)) !== false){
|
||||
if((is_dir($themeDir."/".$file)) && $file!="." && $file!=".."){
|
||||
$themeInfoFile = $themeDir."/".$file.'/info.json';
|
||||
if(!file_exists($themeInfoFile)){
|
||||
//主题信息不存在则跳过
|
||||
continue;
|
||||
}
|
||||
$info = json_decode(file_get_contents($themeInfoFile),true);
|
||||
unset($themeInfoFile);
|
||||
$info['root_dir'] = $themeDir."/".$file.'/';
|
||||
$info['dir_name'] = $file;
|
||||
$info['preview_file'] = file_cdn($themeDir."/".$file.'/'. $info['preview_file']);
|
||||
$info['is_default'] = $file == $defaultTheme?1:0;//检查是不是默认主题
|
||||
$themeList[] = $info;
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
$this->assign("theme_list",$themeList);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新主题
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-17 11:40
|
||||
*/
|
||||
public function change_theme()
|
||||
{
|
||||
$data = Util::postMore([
|
||||
['value',''],
|
||||
]);
|
||||
if ($data['value'] == "") return app("json")->fail("主题不能为空");
|
||||
$res = cModel::update($data,['form_name'=>'web_template']);
|
||||
cache('systemConfig',null);//清除缓存
|
||||
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4>基本样式</h4>
|
||||
<h4>添加文章</h4>
|
||||
<ul class="card-actions">
|
||||
<li>
|
||||
<button type="button" data-toggle="tooltip" title="" data-original-title="返回" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<title>添加文章 - {:system_config("title")}后台管理系统</title>
|
||||
<title>编辑文章 - {:system_config("title")}后台管理系统</title>
|
||||
{include file="public/header" /}
|
||||
<!--标签插件-->
|
||||
<link rel="stylesheet" href="__ADMIN_PATH__js/jquery-tags-input/jquery.tagsinput.min.css">
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4>基本样式</h4>
|
||||
<h4>编辑文章</h4>
|
||||
<ul class="card-actions">
|
||||
<li>
|
||||
<button type="button" data-toggle="tooltip" title="" data-original-title="返回" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
btnClass: 'btn-primary',
|
||||
action: function(){
|
||||
$.post(url="/admin/category/del",data={"id":row.id},function (res) {
|
||||
if (res.status == 200) {parent.lightyear.notify('删除成功', 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');$(".tree-table").bootstrapTable('refresh');}
|
||||
if (res.status == 200) {parent.lightyear.notify('删除成功', 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');$("#tree-table").bootstrapTable('refresh');}
|
||||
else parent.lightyear.notify('删除失败', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
});
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@
|
|||
data: {field: field, value: newstate},
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.status == 200) {parent.lightyear.notify('修改成功', 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');$(".tree-table").bootstrapTable('refresh');}
|
||||
if (res.status == 200) {parent.lightyear.notify('修改成功', 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');$("#tree-table").bootstrapTable('refresh');}
|
||||
else parent.lightyear.notify('修改失败', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
},
|
||||
error: function () {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<title>主题管理 - {:system_config("title")}后台管理系统</title>
|
||||
{include file="public/header" /}
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid p-t-15">
|
||||
<div class="row">
|
||||
{notempty name="theme_list"}
|
||||
{volist name="theme_list" id="vo"}
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
|
||||
<div class="card">
|
||||
<div class="card-header"><h4>{$vo.title}</h4></div>
|
||||
<div class="card-body clearfix lyear-uploads-pic">
|
||||
<figure>
|
||||
<img src="{$vo.preview_file}" alt="{$vo.title}">
|
||||
<figcaption class="pic-tool">
|
||||
{if !$vo.is_default}
|
||||
<a class="btn btn-round btn-square btn-primary btn-set" data-value="{$vo.dir_name}" href="#!" title="启用"><i class="mdi mdi-settings"></i></a>
|
||||
{/if}
|
||||
</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/volist}
|
||||
{else /}
|
||||
<div class="col-md-12"><span>暂无主题</span></div>
|
||||
{/notempty}
|
||||
</div>
|
||||
</div>
|
||||
{include file="public/footer"/}
|
||||
<script type="text/javascript">
|
||||
$(".btn-set").click(function () {
|
||||
let value = $(this).data('value');
|
||||
// 检验不通过终止执行
|
||||
if (!value) {
|
||||
lightyear.notify('主题值不能为空', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
return false;
|
||||
}
|
||||
$.post(url="/admin/theme/change_theme",{value:value},function (res) {
|
||||
if (res.code == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');setTimeout(function () {location.reload();},2000)}
|
||||
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
});
|
||||
return true;
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -155,6 +155,7 @@ if (!function_exists('file_cdn'))
|
|||
//是网址开头的不处理
|
||||
return $path;
|
||||
}
|
||||
$path = str_replace(public_path(),'',$path);
|
||||
if (!(substr($path, 0,1) == '/')){
|
||||
//统一路径
|
||||
$path = '/'.$path;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"title":"默认主题",
|
||||
"author":"MonkeyCode",
|
||||
"demo_url":"http://default.lcm.wang/",
|
||||
"category_type":[
|
||||
{
|
||||
"默认列表":"list_default.html"
|
||||
},
|
||||
{
|
||||
"两排列表":"list_double.html"
|
||||
}
|
||||
],
|
||||
"article_type":[
|
||||
{
|
||||
"普通文章":"page.html"
|
||||
},
|
||||
{
|
||||
"关于我们":"page_about.html"
|
||||
},
|
||||
{
|
||||
"产品文章":"page_product.html"
|
||||
}
|
||||
],
|
||||
"info_file":"全部都是可视化的 没什么可说明的",
|
||||
"update_url":"http://www.lcm.wang/",
|
||||
"preview_file":"preview.jpg",
|
||||
"versions":"1.0"
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 559 KiB |
|
|
@ -22,7 +22,6 @@
|
|||
}
|
||||
],
|
||||
"info_file":"全部都是可视化的 没什么可说明的",
|
||||
"set_file":"set.php",
|
||||
"update_url":"http://www.lcm.wang/",
|
||||
"preview_file":"preview.jpg",
|
||||
"versions":"1.0"
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
这里是教你如何设置主题
|
||||
Loading…
Reference in New Issue