mirror of https://github.com/1099438829/apeblog
一大波修复和优化
This commit is contained in:
parent
c491923d38
commit
e0d951cc27
|
|
@ -2,21 +2,21 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\Admin as aModel;
|
||||
use app\common\model\AdminRole as rModel;
|
||||
use app\common\model\User as userModel;
|
||||
use app\Request;
|
||||
use app\admin\extend\Util as Util;
|
||||
use FormBuilder\Exception\FormBuilderException;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\Exception;
|
||||
use think\facade\Db;
|
||||
use think\facade\Route as Url;
|
||||
use think\Facade\Log;
|
||||
use think\facade\Route as Url;
|
||||
|
||||
/**
|
||||
* 账号管理
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\AdminAuth as aModel;
|
||||
use app\Request;
|
||||
use Exception;
|
||||
use FormBuilder\Exception\FormBuilderException;
|
||||
use app\admin\extend\Util as Util;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\AdminLog as lModel;
|
||||
use app\Request;
|
||||
use app\admin\extend\Util as Util;
|
||||
use Exception;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\model\AdminRole as rModel;
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\AdminAuth as aModel;
|
||||
use app\common\model\AdminRole as rModel;
|
||||
use app\Request;
|
||||
use FormBuilder\Exception\FormBuilderException;
|
||||
use app\admin\extend\Util as Util;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
|
|
|||
|
|
@ -2,18 +2,13 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\Comment as CommentModel;
|
||||
use app\common\model\Document;
|
||||
use app\common\model\DocumentCategory as cModel;
|
||||
use app\common\model\Tag as TagModel;
|
||||
use app\common\model\DocumentArticle;
|
||||
use app\common\model\Comment as CommentModel;
|
||||
use app\admin\extend\Util as Util;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\Exception;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* Class Article
|
||||
|
|
@ -73,7 +68,7 @@ class Article extends AuthController
|
|||
* @author 木子的忧伤
|
||||
* @date 2021-02-28 22:43
|
||||
*/
|
||||
public function save($id = "")
|
||||
public function save()
|
||||
{
|
||||
$data = Util::postMore([
|
||||
['id', ''],
|
||||
|
|
@ -98,7 +93,6 @@ class Article extends AuthController
|
|||
['author', $this->adminInfo['nickname']],
|
||||
['uid', $this->adminId],
|
||||
]);
|
||||
|
||||
if ($data['title'] == "") return app("json")->fail("文章名称不能为空");
|
||||
if ($data['category_id'] == "") return app("json")->fail("栏目分类不能为空");
|
||||
if ($data['cover_path'] == "") return app("json")->fail("主图不能为空");
|
||||
|
|
@ -155,8 +149,7 @@ class Article extends AuthController
|
|||
*/
|
||||
public function edit()
|
||||
{
|
||||
$where = Util::postMore([
|
||||
['name', ''],
|
||||
$where = Util::getMore([
|
||||
['id', '']
|
||||
]);
|
||||
if ($where['id'] == '') {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\constant\Data;
|
||||
use app\common\model\DocumentCategory as aModel;
|
||||
use app\common\model\DocumentCategoryContent;
|
||||
use app\Request;
|
||||
use app\admin\extend\Util as Util;
|
||||
use Exception;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
|
|
@ -54,30 +53,29 @@ class Category extends AuthController
|
|||
* @param $id
|
||||
* @return
|
||||
*/
|
||||
public function save($id = "")
|
||||
public function save()
|
||||
{
|
||||
$data = Util::postMore([
|
||||
['id', ''],
|
||||
['title', ''],
|
||||
['alias', ''],
|
||||
['type', ''],
|
||||
['pid', 0],
|
||||
['meta_title', ''],
|
||||
['keywords', ''],
|
||||
['description', ''],
|
||||
['template', ''],
|
||||
['link_str', ''],
|
||||
['sort', 0],
|
||||
['status', 1]
|
||||
]);
|
||||
if ($data['title'] == "") return app("json")->fail("分类名称不能为空");
|
||||
if ($data['type'] == "") return app("json")->fail("类型不能为空");
|
||||
if ($data['template'] == "") return app("json")->fail("模板不能为空");
|
||||
//判断是否写了别名,没写则需要生成
|
||||
if ($data['alias'] == "") $data['alias'] = get_rand_str(8);
|
||||
if ($id == "") {
|
||||
if ($data['id'] == "") {
|
||||
$model = new aModel();
|
||||
$res = $model->insert($data);
|
||||
} else {
|
||||
$res = aModel::update($data, ['id' => $id]);
|
||||
$res = aModel::update($data, ['id' => $data['id']]);
|
||||
}
|
||||
cache(Data::DATA_DOCUMENT_CATEGORY_LIST, null);
|
||||
return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败");
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\extend\Database;
|
||||
use app\Request;
|
||||
use Exception;
|
||||
use FilesystemIterator;
|
||||
|
|
@ -16,8 +18,6 @@ use think\db\exception\DataNotFoundException;
|
|||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\facade\Db;
|
||||
use app\common\extend\Database;
|
||||
use app\admin\extend\Util as Util;
|
||||
|
||||
/*
|
||||
* 数据库备份还原控制器
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
namespace app\admin\controller;
|
||||
|
||||
|
||||
use app\common\model\Attachment;
|
||||
use app\admin\extend\storage\QcloudCoService;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\Attachment;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\constant\Data;
|
||||
use app\common\model\FriendLink as aModel;
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\Request;
|
||||
use app\admin\extend\Util as Util;
|
||||
use Exception;
|
||||
use FormBuilder\Exception\FormBuilderException;
|
||||
use FormBuilder\Factory\Elm;
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
namespace app\admin\controller;
|
||||
|
||||
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\Attachment;
|
||||
use app\common\model\AttachmentCategory;
|
||||
use Exception;
|
||||
use FormBuilder\Exception\FormBuilderException;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\admin\extend\Util as Util;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ use app\common\model\Document;
|
|||
use app\common\model\Document as DocumentModel;
|
||||
use app\common\model\DocumentCategory;
|
||||
use app\common\model\DocumentCategory as DocumentCategoryModel;
|
||||
use app\common\model\FriendLink;
|
||||
use app\common\model\MessageForm;
|
||||
use app\common\model\User;
|
||||
use Exception;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use \app\common\model\User;
|
||||
use \app\common\model\FriendLink;
|
||||
|
||||
class Index extends AuthController
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\InvitationCode as aModel;
|
||||
use app\Request;
|
||||
use app\admin\extend\Util as Util;
|
||||
use Exception;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\model\Admin as adminModel;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\Admin as adminModel;
|
||||
use Exception;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\MessageForm as aModel;
|
||||
use app\Request;
|
||||
use app\admin\extend\Util as Util;
|
||||
use Exception;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
|
|
|
|||
|
|
@ -3,17 +3,16 @@
|
|||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\constant\Data;
|
||||
use app\common\model\Nav as aModel;
|
||||
use app\Request;
|
||||
use app\admin\extend\Util as Util;
|
||||
use Exception;
|
||||
use FormBuilder\Exception\FormBuilderException;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\facade\Route as Url;
|
||||
|
||||
/**
|
||||
* Class Nav
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\model\Document;
|
||||
use app\common\model\Comment as CommentModel;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\Comment as CommentModel;
|
||||
use app\common\model\Document;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\constant\Data;
|
||||
use app\common\model\SystemConfig as cModel;
|
||||
use app\common\model\SystemConfigTab as tModel;
|
||||
|
|
@ -9,8 +11,6 @@ use app\Request;
|
|||
use Exception;
|
||||
use FormBuilder\Exception\FormBuilderException;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\admin\extend\Util as Util;
|
||||
use Psr\SimpleCache\InvalidArgumentException;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
namespace app\admin\controller;
|
||||
|
||||
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\SystemConfig as cModel;
|
||||
use app\common\model\SystemConfigTab as tModel;
|
||||
use app\Request;
|
||||
use FormBuilder\Exception\FormBuilderException;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\SystemConfigTab as tModel;
|
||||
use app\common\model\SystemConfig as cModel;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\Request;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\Request;
|
||||
|
||||
/**
|
||||
* Trait TemplateTrait
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\model\SystemConfig as cModel;
|
||||
use app\Request;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\SystemConfig as cModel;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use app\admin\extend\Util as Util;
|
||||
use app\common\model\User as aModel;
|
||||
use app\Request;
|
||||
use app\admin\extend\Util as Util;
|
||||
use Exception;
|
||||
use FormBuilder\Exception\FormBuilderException;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\extend\FormBuilder as Form;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
<div class="tab-pane fade active in" id="home">
|
||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||
<div class="form-group col-md-12">
|
||||
<label>文章名称</label>
|
||||
<input type="text" class="form-control" id="title" name="title" value="{$info.title}" placeholder="文章名称"/>
|
||||
<label for="title">文章名称</label>
|
||||
<input type="text" class="form-control" id="title" name="title" placeholder="文章名称"/>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>别名</label>
|
||||
<input type="text" class="form-control" id="alias" name="alias" value="{$info.alias}" placeholder="别名索引"/>
|
||||
<label for="alias">别名</label>
|
||||
<input type="text" class="form-control" id="alias" name="alias" placeholder="别名索引"/>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="category_id">栏目分类</label>
|
||||
|
|
@ -69,8 +69,8 @@
|
|||
placeholder="请输入摘要">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="abstract">标签</label>
|
||||
<input class="form-control js-tags-input" type="text" name="tags" data-height="38px"
|
||||
<label for="tags">标签</label>
|
||||
<input class="form-control js-tags-input" id="tags" type="text" name="tags" data-height="38px"
|
||||
placeholder="请输入标签">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
|
|
@ -113,8 +113,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="abstract">排序</label>
|
||||
<input type="text" class="form-control" name="sort" placeholder="请输入排序" value="99">
|
||||
<label for="sort">排序</label>
|
||||
<input type="text" class="form-control" id="sort" name="sort" placeholder="请输入排序" value="99">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="link_str">外链</label>
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
<div class="tab-pane fade active in" id="home">
|
||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||
<div class="form-group col-md-12">
|
||||
<label>文章名称</label>
|
||||
<label for="title">文章名称</label>
|
||||
<input type="hidden" name="id" value="{$info.id}">
|
||||
<input type="text" class="form-control" id="title" name="title" placeholder="文章名称" value="{$info.title}"/>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>别名</label>
|
||||
<label for="alias">别名</label>
|
||||
<input type="text" class="form-control" id="alias" name="alias" value="{$info.alias}"
|
||||
placeholder="别名索引"/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,66 +3,42 @@
|
|||
<head>
|
||||
<title>添加分类 - {:system_config('title')}后台管理系统</title>
|
||||
{include file="public/header" /}
|
||||
<!--标签插件-->
|
||||
<link rel="stylesheet" href="/static/admin/js/jquery-tags-input/jquery.tagsinput.min.css">
|
||||
<!--富文本输入框-->
|
||||
<link rel="stylesheet" href="/static/admin/js/summernote/summernote.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<ul id="myTabs" class="nav nav-tabs" role="tablist">
|
||||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
||||
<li><a href="#profile" role="tab" id="profile-tab" data-toggle="tab">SEO设置</a></li>
|
||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
||||
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
||||
<div class="card-header">
|
||||
<h4>基本信息</h4>
|
||||
<ul class="card-actions">
|
||||
<li>
|
||||
<button type="button" data-toggle="tooltip" title="" data-original-title="返回"
|
||||
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></button>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="home">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||
<div class="form-group col-md-12">
|
||||
<label>分类名称</label>
|
||||
<input type="text" class="form-control" id="title" name="title" value=""
|
||||
placeholder="分类名称"/>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>别名</label>
|
||||
<input type="text" class="form-control" id="alias" name="alias" value=""
|
||||
placeholder="别名"/>
|
||||
<label for="title">分类名称</label>
|
||||
<input type="text" class="form-control" id="title" name="title" value="" placeholder="分类名称"/>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<label for="pid">上级分类</label>
|
||||
<div class="form-controls">
|
||||
<select name="pid" id="pid" class="form-control">
|
||||
<option value="">请选择</option>
|
||||
<option value="0">顶级分类</option>
|
||||
{volist name="category" id="vo"}
|
||||
<option value="{$vo.id}" {notempty name="pid" }{if $vo.id== $pid}selected{
|
||||
/if}{/notempty}>{$vo.html}{$vo.title}</option>
|
||||
<option value="{$vo.id}" {notempty name="pid" }{if $vo.id== $pid}selected{/if}{/notempty}>{$vo.html}{$vo.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>排序</label>
|
||||
<input type="text" class="form-control" name="sort" placeholder="请输入排序">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>属性</label>
|
||||
<div class="form-controls">
|
||||
<select name="type" id="type" class="form-control">
|
||||
<!-- <option value="0">请选择</option>-->
|
||||
<option value="1">列表</option>
|
||||
<option value="2">单页</option>
|
||||
<option value="3">外联</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>主题风格</label>
|
||||
<div class="form-controls">
|
||||
<div class="col-xs-3">
|
||||
<label>展示模板</label>
|
||||
<div class="form-group form-controls">
|
||||
<select name="template" class="form-control">
|
||||
{volist name="template_list" id="vo"}
|
||||
<option value="{$vo.template}">{$vo.name}</option>
|
||||
|
|
@ -70,36 +46,27 @@
|
|||
</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="外链">
|
||||
<div class="col-xs-3">
|
||||
<label for="alias">URL名称</label>
|
||||
<input class="form-control" id="alias" name="alias" type="text" placeholder="URL名称">
|
||||
</div>
|
||||
<div class="form-group col-md-12" id="page-content" style="display: none">
|
||||
<label>单页内容</label>
|
||||
<textarea id="content" name="content" data-provide="summernote" data-min-height="480"></textarea>
|
||||
<div class="col-xs-3">
|
||||
<label for="sort">排序</label>
|
||||
<input type="text" class="form-control" id="sort" name="sort" placeholder="请输入排序" value="99">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="profile">
|
||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="meta_title">seo标题</label>
|
||||
<input type="text" class="form-control" id="meta_title" name="meta_title"
|
||||
placeholder="请输入seo关键字">
|
||||
<input type="text" class="form-control" id="meta_title" name="meta_title" placeholder="请输入seo关键字">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="keywords">seo关键字</label>
|
||||
<input type="text" class="form-control" id="keywords" name="keywords"
|
||||
placeholder="请输入seo关键字">
|
||||
<input type="text" class="form-control" id="keywords" name="keywords" placeholder="请输入seo关键字">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="description">seo描述</label>
|
||||
<input type="text" class="form-control" name="description" id="description"
|
||||
placeholder="seo描述">
|
||||
<input type="text" class="form-control" name="description" id="description" placeholder="seo描述">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
||||
|
|
@ -110,109 +77,10 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{include file="public/footer"/}
|
||||
<!--select2-->
|
||||
<script type="text/javascript" src="/static/admin/js/select2.min.js"></script>
|
||||
<!--富文本输入框-->
|
||||
<script type="text/javascript" src="/static/admin/js/summernote/summernote.min.js"></script>
|
||||
<script type="text/javascript" src="/static/admin/js/summernote/lang/summernote-zh-CN.min.js"></script>
|
||||
<!--标签-->
|
||||
<script src="/static/admin/js/jquery-tags-input/jquery.tagsinput.min.js"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#tag').select2();
|
||||
});
|
||||
$(document).ready(function(){
|
||||
$('[data-provide="summernote"]').each(function() {
|
||||
var options = {
|
||||
dialogsInBody: true,
|
||||
lang: 'zh-CN',
|
||||
dialogsFade: true
|
||||
};
|
||||
var config = {};
|
||||
$.each( $(this).data(), function(key, value){
|
||||
key = key.replace(/-([a-z])/g, function(x){return x[1].toUpperCase();});
|
||||
if ( key == 'provide' ) {
|
||||
return;
|
||||
}
|
||||
config[key] = value;
|
||||
});
|
||||
|
||||
options = $.extend(options, config);
|
||||
options.toolbar = [
|
||||
// [groupName, [list of button]]
|
||||
['para_style', ['style']],
|
||||
['style', ['bold', 'italic', 'underline', 'clear']],
|
||||
['font', ['strikethrough', 'superscript', 'subscript']],
|
||||
['fontsize', ['fontname', 'fontsize', 'height']],
|
||||
['color', ['color']],
|
||||
['para', ['ul', 'ol', 'paragraph', 'hr']],
|
||||
['table', ['table']],
|
||||
['insert', ['link', 'picture', 'video']],
|
||||
['do', ['undo', 'redo']],
|
||||
['misc', ['fullscreen', 'codeview']]
|
||||
];
|
||||
$(this).summernote(options);
|
||||
});
|
||||
|
||||
$(document).on('click', '[data-summernote-edit]', function(){
|
||||
var target = $(this).data('summernote-edit');
|
||||
$(target).summernote({focus: true});
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click', '[data-summernote-save]', function(){
|
||||
var target = $(this).data('summernote-save');
|
||||
var markup = $(target).summernote('code');
|
||||
$(target).summernote('destroy');
|
||||
alert('修改完成');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 选择文件
|
||||
* @param inputName
|
||||
*/
|
||||
function btnClick(inputName) {
|
||||
$("#file_" + inputName).click()
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步上传
|
||||
* @param inputName
|
||||
*/
|
||||
function upload(inputName) {
|
||||
var formData = new FormData();
|
||||
formData.append("type", 'image');
|
||||
formData.append("file", $("#file_" + inputName)[0].files[0]);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/admin/file/upload',
|
||||
data: formData,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (res) {
|
||||
if (res.code == 200) {
|
||||
$("#" + inputName).val(res.data.filePath);
|
||||
let html = ' <figure>\n' +
|
||||
' <img src="' + res.data.filePath + '" alt="' + res.data.name + '">\n' +
|
||||
' <figcaption>\n' +
|
||||
' <a class="btn btn-round btn-square btn-danger btn-image-delete" href="#!"><i class="mdi mdi-delete"></i></a>\n' +
|
||||
' </figcaption>\n' +
|
||||
' </figure>';
|
||||
$('#pic-image').html(html);
|
||||
$('#pic-image').show().next('li').hide();
|
||||
} else {
|
||||
lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(".add-form").submit(function () {
|
||||
let Arr = $('.add-form').serializeArray();
|
||||
let checkResult = true;
|
||||
|
|
@ -224,6 +92,11 @@
|
|||
throw "分类名称不能为空";
|
||||
}
|
||||
break;
|
||||
case 'template':
|
||||
if (!item.value) {
|
||||
throw "展示模板不能为空";
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
lightyear.notify(error, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
|
|
@ -245,37 +118,6 @@
|
|||
});
|
||||
return true;
|
||||
})
|
||||
|
||||
//删除事件
|
||||
$('body').on('click', '.btn-image-delete', function () {
|
||||
$('#pic-image').hide().next('li').show();
|
||||
$('#cover_path').val('');
|
||||
})
|
||||
|
||||
// 切换类型选择事件
|
||||
$("body").on("change", "#type", function () {
|
||||
let type = parseInt($(this).val());
|
||||
switch (type) {
|
||||
case 1:
|
||||
//普通
|
||||
$('#page-link-str').hide().children('input').val();
|
||||
$('#page-content').hide().children('textarea').val();
|
||||
break;
|
||||
case 2:
|
||||
$('#page-content').show();
|
||||
$('#page-link-str').hide().children('input').val();
|
||||
break;
|
||||
case 3:
|
||||
//单页
|
||||
//外联
|
||||
$('#page-link-str').show();
|
||||
$('#page-content').hide().children('textarea').val();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -3,113 +3,71 @@
|
|||
<head>
|
||||
<title>添加文章 - {:system_config('title')}后台管理系统</title>
|
||||
{include file="public/header" /}
|
||||
<!--标签插件-->
|
||||
<link rel="stylesheet" href="/static/admin/js/jquery-tags-input/jquery.tagsinput.min.css">
|
||||
<!--富文本输入框-->
|
||||
<link rel="stylesheet" href="/static/admin/js/summernote/summernote.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<ul id="myTabs" class="nav nav-tabs" role="tablist">
|
||||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
||||
<li><a href="#profile" role="tab" id="profile-tab" data-toggle="tab">SEO设置</a></li>
|
||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
||||
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
||||
<div class="card-header">
|
||||
<h4>基本信息</h4>
|
||||
<ul class="card-actions">
|
||||
<li>
|
||||
<button type="button" data-toggle="tooltip" title="" data-original-title="返回"
|
||||
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></button>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="home">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||
<div class="form-group col-md-12">
|
||||
<label>分类名称</label>
|
||||
<input type="text" class="form-control" id="title" name="title" value="{$info.title}"
|
||||
placeholder="分类名称"/>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>别名</label>
|
||||
<input type="text" class="form-control" id="alias" name="alias"
|
||||
value="{$info.alias}" placeholder="别名"/>
|
||||
<label for="title">分类名称</label>
|
||||
<input type="hidden" name="id" value="{$info.id}">
|
||||
<input type="text" class="form-control" id="title" name="title" value="{$info.title}" placeholder="分类名称"/>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<label for="pid">上级分类</label>
|
||||
<div class="form-controls">
|
||||
<select name="pid" id="pid" class="form-control">
|
||||
<option value="">请选择</option>
|
||||
<option value="0">顶级分类</option>
|
||||
{volist name="category" id="vo"}
|
||||
<option value="{$vo.id}" {if $vo.id== $info.pid}selected{
|
||||
/if}>{$vo.html}{$vo.title}</option>
|
||||
<option value="{$vo.id}" {notempty name="pid" }{if $vo.id== $pid}selected{/if}{/notempty}>{$vo.html}{$vo.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>排序</label>
|
||||
<input type="text" class="form-control" name="sort" placeholder="请输入排序"
|
||||
value="{$info.sort}">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>属性</label>
|
||||
<div class="form-controls">
|
||||
<select name="type" id="type" class="form-control">
|
||||
<option value="0" {if 0== $info.type}selected{
|
||||
/if}>请选择</option>
|
||||
<option value="1" {if 1== $info.type}selected{
|
||||
/if}>列表</option>
|
||||
<option value="2" {if 2== $info.type}selected{
|
||||
/if}>单页</option>
|
||||
<option value="3" {if 3== $info.type}selected{
|
||||
/if}>外联</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>主题风格</label>
|
||||
<div class="form-controls">
|
||||
<div class="col-xs-3">
|
||||
<label>展示模板</label>
|
||||
<div class="form-group 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>
|
||||
<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}">
|
||||
<div class="col-xs-3">
|
||||
<label for="alias">URL名称</label>
|
||||
<input class="form-control" id="alias" name="alias" type="text" value="{$info.alias}" placeholder="URL名称">
|
||||
</div>
|
||||
<div class="form-group col-md-12" id="page-content" {if
|
||||
2!=$info.type}style="display:none;"{/if}>
|
||||
<label>单页内容</label>
|
||||
<textarea id="content" name="content" data-min-height="480" data-provide="summernote">{$info.content}</textarea>
|
||||
<div class="col-xs-3">
|
||||
<label for="sort">排序</label>
|
||||
<input type="text" class="form-control" id="sort" name="sort" placeholder="请输入排序" value="{$info.sort}">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="profile">
|
||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="meta_title">seo标题</label>
|
||||
<input type="text" class="form-control" id="meta_title" name="meta_title"
|
||||
placeholder="请输入seo关键字" value="{$info.meta_title}">
|
||||
<input type="text" class="form-control" id="meta_title" name="meta_title" placeholder="请输入seo关键字" value="{$info.meta_title}">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="keywords">seo关键字</label>
|
||||
<input type="text" class="form-control" id="keywords" name="keywords"
|
||||
placeholder="请输入seo关键字" value="{$info.keywords}">
|
||||
<input type="text" class="form-control" id="keywords" name="keywords" placeholder="请输入seo关键字" value="{$info.keywords}">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="description">seo描述</label>
|
||||
<input type="text" class="form-control" name="description" id="description"
|
||||
placeholder="seo描述" value="{$info.description}">
|
||||
<input type="text" class="form-control" name="description" id="description" placeholder="seo描述" value="{$info.description}">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
||||
|
|
@ -120,109 +78,10 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{include file="public/footer"/}
|
||||
<!--select2-->
|
||||
<script type="text/javascript" src="/static/admin/js/select2.min.js"></script>
|
||||
<!--富文本输入框-->
|
||||
<script type="text/javascript" src="/static/admin/js/summernote/summernote.min.js"></script>
|
||||
<script type="text/javascript" src="/static/admin/js/summernote/lang/summernote-zh-CN.min.js"></script>
|
||||
<!--标签-->
|
||||
<script src="/static/admin/js/jquery-tags-input/jquery.tagsinput.min.js"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#tag').select2();
|
||||
});
|
||||
$(document).ready(function(){
|
||||
$('[data-provide="summernote"]').each(function() {
|
||||
var options = {
|
||||
dialogsInBody: true,
|
||||
lang: 'zh-CN',
|
||||
dialogsFade: true
|
||||
};
|
||||
var config = {};
|
||||
$.each( $(this).data(), function(key, value){
|
||||
key = key.replace(/-([a-z])/g, function(x){return x[1].toUpperCase();});
|
||||
if ( key == 'provide' ) {
|
||||
return;
|
||||
}
|
||||
config[key] = value;
|
||||
});
|
||||
|
||||
options = $.extend(options, config);
|
||||
options.toolbar = [
|
||||
// [groupName, [list of button]]
|
||||
['para_style', ['style']],
|
||||
['style', ['bold', 'italic', 'underline', 'clear']],
|
||||
['font', ['strikethrough', 'superscript', 'subscript']],
|
||||
['fontsize', ['fontname', 'fontsize', 'height']],
|
||||
['color', ['color']],
|
||||
['para', ['ul', 'ol', 'paragraph', 'hr']],
|
||||
['table', ['table']],
|
||||
['insert', ['link', 'picture', 'video']],
|
||||
['do', ['undo', 'redo']],
|
||||
['misc', ['fullscreen', 'codeview']]
|
||||
];
|
||||
$(this).summernote(options);
|
||||
});
|
||||
|
||||
$(document).on('click', '[data-summernote-edit]', function(){
|
||||
var target = $(this).data('summernote-edit');
|
||||
$(target).summernote({focus: true});
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click', '[data-summernote-save]', function(){
|
||||
var target = $(this).data('summernote-save');
|
||||
var markup = $(target).summernote('code');
|
||||
$(target).summernote('destroy');
|
||||
alert('修改完成');
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 选择文件
|
||||
* @param inputName
|
||||
*/
|
||||
function btnClick(inputName) {
|
||||
$("#file_" + inputName).click()
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步上传
|
||||
* @param inputName
|
||||
*/
|
||||
function upload(inputName) {
|
||||
var formData = new FormData();
|
||||
formData.append("type", 'image');
|
||||
formData.append("file", $("#file_" + inputName)[0].files[0]);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/admin/file/upload',
|
||||
data: formData,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (res) {
|
||||
if (res.code == 200) {
|
||||
$("#" + inputName).val(res.data.filePath);
|
||||
let html = ' <figure>\n' +
|
||||
' <img src="' + res.data.filePath + '" alt="' + res.data.name + '">\n' +
|
||||
' <figcaption>\n' +
|
||||
' <a class="btn btn-round btn-square btn-danger btn-image-delete" href="#!"><i class="mdi mdi-delete"></i></a>\n' +
|
||||
' </figcaption>\n' +
|
||||
' </figure>';
|
||||
$('#pic-image').html(html);
|
||||
$('#pic-image').show().next('li').hide();
|
||||
} else {
|
||||
lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(".add-form").submit(function () {
|
||||
let Arr = $('.add-form').serializeArray();
|
||||
let checkResult = true;
|
||||
|
|
@ -234,6 +93,11 @@
|
|||
throw "分类名称不能为空";
|
||||
}
|
||||
break;
|
||||
case 'template':
|
||||
if (!item.value) {
|
||||
throw "展示模板不能为空";
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
lightyear.notify(error, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
|
|
@ -245,47 +109,16 @@
|
|||
if (!checkResult) {
|
||||
return false;
|
||||
}
|
||||
$.post(url = "/admin/category/save?id={$info.id}", $('.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 () {
|
||||
parent.location.reload();
|
||||
location.href = '/admin/category/index';
|
||||
}, 2000)
|
||||
} else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
});
|
||||
return true;
|
||||
})
|
||||
|
||||
//删除事件
|
||||
$('body').on('click', '.btn-image-delete', function () {
|
||||
$('#pic-image').hide().next('li').show();
|
||||
$('#cover_path').val('');
|
||||
})
|
||||
|
||||
// 切换类型选择事件
|
||||
$("body").on("change", "#type", function () {
|
||||
let type = parseInt($(this).val());
|
||||
switch (type) {
|
||||
case 1:
|
||||
//普通
|
||||
$('#page-link-str').hide().children('input').val();
|
||||
$('#page-content').hide().children('textarea').val();
|
||||
break;
|
||||
case 2:
|
||||
$('#page-content').show();
|
||||
$('#page-link-str').hide().children('input').val();
|
||||
break;
|
||||
case 3:
|
||||
//单页
|
||||
//外联
|
||||
$('#page-link-str').show();
|
||||
$('#page-content').hide().children('textarea').val();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -59,14 +59,14 @@ class Document extends BaseModel
|
|||
* @param string $status
|
||||
* @return array
|
||||
*/
|
||||
public function getInfo($id,$type= self::DOCUMENT_TYPE_ARTICLE,$status = ''): array
|
||||
public function getInfo($id,$type= self::DOCUMENT_TYPE_ARTICLE,$status = 1): array
|
||||
{
|
||||
if (empty($id)){
|
||||
return [];
|
||||
}
|
||||
$model = self::alias('a')
|
||||
->leftJoin('document_article p','a.id = p.id')
|
||||
->where("a.type",Document::DOCUMENT_TYPE_PAGE);
|
||||
->field("a.*,p.content")
|
||||
->leftJoin('document_article p','a.id = p.id');
|
||||
if (is_numeric($id)){
|
||||
$model->where("a.id",$id);
|
||||
}else{
|
||||
|
|
@ -102,6 +102,12 @@ class Document extends BaseModel
|
|||
if ($data['is_hot']) $data['is_hot'] = 1;
|
||||
if ($data['display']) $data['display'] = 1;
|
||||
if ($data['is_top']) $data['is_top'] = 1;
|
||||
//判断是否主键冲突
|
||||
$info = $this->where("alias",$data['alias'])->find();
|
||||
if ($info && (!empty($data['id']) && $info->id != $data['id'] )){
|
||||
self::setErrorInfo("别名已存在,请修改后重试");
|
||||
return false;
|
||||
}
|
||||
// 启动事务
|
||||
Db::startTrans();
|
||||
if (empty($data['id'])) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue