diff --git a/app/admin/controller/Category.php b/app/admin/controller/Category.php index 31851bb..fce504c 100644 --- a/app/admin/controller/Category.php +++ b/app/admin/controller/Category.php @@ -19,6 +19,11 @@ use think\facade\Route as Url; */ class Category extends AuthController { + protected function initialize() + { + parent::initialize(); + $this->model = new aModel(); + } /** * 分类 * @return string @@ -57,31 +62,25 @@ class Category extends AuthController { $data = Util::postMore([ ['title',''], + ['en_title',''], ['pid',0], - ['title_en',''], - ['module',''], - ['controller',''], - ['action',''], - ['params',''], - ['rank',0], - ['is_menu',1], - ['status',1] + ['type',''], + ['sort',''], + ['meta_title',''], + ['keywords',''], + ['description',0], + ['link_str',1], + ['display',1] ]); - if ($data['name'] == "") return app("json")->fail("权限名称不能为空"); - if ($data['pid'] == "") return app("json")->fail("上级归属不能为空"); - if ($data['module'] == "") return app("json")->fail("模块名不能为空"); - if ($data['controller'] == "") return app("json")->fail("控制器名不能为空"); - if ($data['action'] == "") return app("json")->fail("方法名不能为空"); - $data['path'] = '/'.$data['module'].'/'.$data['controller'].'/'.$data['action']; + if ($data['title'] == "") return app("json")->fail("分类名称不能为空"); if ($id=="") { $data['create_user'] = $this->adminId; - $data['create_time'] = time(); - $res = aModel::insert($data); + $model = new aModel(); + $res = $model->save($data); }else { $data['update_user'] = $this->adminId; - $data['update_time'] = time(); $res = aModel::update($data,['id'=>$id]); } return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败"); diff --git a/app/admin/controller/SystemConfig.php b/app/admin/controller/SystemConfig.php index 3813410..ede4156 100644 --- a/app/admin/controller/SystemConfig.php +++ b/app/admin/controller/SystemConfig.php @@ -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("操作失败"); } diff --git a/app/admin/controller/Theme.php b/app/admin/controller/Theme.php new file mode 100644 index 0000000..08ba7fc --- /dev/null +++ b/app/admin/controller/Theme.php @@ -0,0 +1,70 @@ +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("操作失败"); + } +} \ No newline at end of file diff --git a/app/admin/view/article/add.html b/app/admin/view/article/add.html index 63aa8bb..0ff0050 100644 --- a/app/admin/view/article/add.html +++ b/app/admin/view/article/add.html @@ -11,7 +11,7 @@
-

基本样式

+

添加文章

  • diff --git a/app/admin/view/article/edit.html b/app/admin/view/article/edit.html index f9e989e..d07b335 100644 --- a/app/admin/view/article/edit.html +++ b/app/admin/view/article/edit.html @@ -1,7 +1,7 @@ - 添加文章 - {:system_config("title")}后台管理系统 + 编辑文章 - {:system_config("title")}后台管理系统 {include file="public/header" /} @@ -11,7 +11,7 @@
    -

    基本样式

    +

    编辑文章

    • diff --git a/app/admin/view/category/add.html b/app/admin/view/category/add.html index 16c939c..83dfcfe 100644 --- a/app/admin/view/category/add.html +++ b/app/admin/view/category/add.html @@ -11,7 +11,7 @@
      -

      基本样式

      +

      添加分类

      • @@ -38,7 +38,7 @@
        - - - - +
      @@ -177,6 +177,11 @@ throw "分类名称不能为空"; } break; + case 'type': + if (!item.value) { + throw "请选择属性"; + } + break; } } catch (error) { lightyear.notify(error, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center'); @@ -188,8 +193,8 @@ if (!checkResult) { return false; } - $.post(url="/admin/article/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",$('.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/category/index';},2000)} else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center'); }); return true; diff --git a/app/admin/view/category/edit.html b/app/admin/view/category/edit.html index 2e1cc00..7ce59d7 100644 --- a/app/admin/view/category/edit.html +++ b/app/admin/view/category/edit.html @@ -1,7 +1,7 @@ - 添加文章 - {:system_config("title")}后台管理系统 + 修改分类 - {:system_config("title")}后台管理系统 {include file="public/header" /} @@ -11,7 +11,7 @@
      -

      基本样式

      +

      修改分类

      • @@ -49,10 +49,9 @@
      @@ -177,6 +176,11 @@ throw "分类名称不能为空"; } break; + case 'type': + if (!item.value) { + throw "请选择属性"; + } + break; } } catch (error) { lightyear.notify(error, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center'); @@ -188,8 +192,8 @@ if (!checkResult) { return false; } - $.post(url="/admin/article/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",$('.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/category/index';},2000)} else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center'); }); return true; diff --git a/app/admin/view/category/index.html b/app/admin/view/category/index.html index 7b58915..bd3341b 100644 --- a/app/admin/view/category/index.html +++ b/app/admin/view/category/index.html @@ -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 () { diff --git a/app/admin/view/theme/index.html b/app/admin/view/theme/index.html new file mode 100644 index 0000000..35415ff --- /dev/null +++ b/app/admin/view/theme/index.html @@ -0,0 +1,50 @@ + + + + 主题管理 - {:system_config("title")}后台管理系统 + {include file="public/header" /} + + +
      +
      + {notempty name="theme_list"} + {volist name="theme_list" id="vo"} +
      +
      +

      {$vo.title}

      +
      +
      + {$vo.title} +
      + {if !$vo.is_default} + + {/if} +
      +
      +
      +
      +
      + {/volist} + {else /} +
      暂无主题
      + {/notempty} +
      +
      +{include file="public/footer"/} + + + \ No newline at end of file diff --git a/app/common.php b/app/common.php index d59b52d..601db52 100644 --- a/app/common.php +++ b/app/common.php @@ -155,6 +155,7 @@ if (!function_exists('file_cdn')) //是网址开头的不处理 return $path; } + $path = str_replace(public_path(),'',$path); if (!(substr($path, 0,1) == '/')){ //统一路径 $path = '/'.$path; diff --git a/public/template/blog/info.json b/public/template/blog/info.json new file mode 100644 index 0000000..b42edd2 --- /dev/null +++ b/public/template/blog/info.json @@ -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" +} \ No newline at end of file diff --git a/public/template/blog/preview.jpg b/public/template/blog/preview.jpg new file mode 100644 index 0000000..33e5953 Binary files /dev/null and b/public/template/blog/preview.jpg differ diff --git a/public/template/default/info.json b/public/template/default/info.json index 16d9a3b..b42edd2 100644 --- a/public/template/default/info.json +++ b/public/template/default/info.json @@ -22,7 +22,6 @@ } ], "info_file":"全部都是可视化的 没什么可说明的", - "set_file":"set.php", "update_url":"http://www.lcm.wang/", "preview_file":"preview.jpg", "versions":"1.0" diff --git a/public/template/default/set.php b/public/template/default/set.php deleted file mode 100644 index 5436ef0..0000000 --- a/public/template/default/set.php +++ /dev/null @@ -1 +0,0 @@ -这里是教你如何设置主题