mirror of https://github.com/1099438829/apeblog
This commit is contained in:
parent
509028dc4f
commit
0450e84961
|
|
@ -4,6 +4,7 @@ namespace app\admin\controller;
|
||||||
|
|
||||||
use app\common\model\Document as aModel;
|
use app\common\model\Document as aModel;
|
||||||
use app\common\model\DocumentCategory as cModel;
|
use app\common\model\DocumentCategory as cModel;
|
||||||
|
use app\common\model\DocumentPage;
|
||||||
use app\common\model\Tag as TagModel;
|
use app\common\model\Tag as TagModel;
|
||||||
use app\common\model\DocumentArticle;
|
use app\common\model\DocumentArticle;
|
||||||
use app\common\model\Comment as CommentModel;
|
use app\common\model\Comment as CommentModel;
|
||||||
|
|
@ -208,7 +209,11 @@ class Article extends AuthController
|
||||||
['id', '']
|
['id', '']
|
||||||
]);
|
]);
|
||||||
if ($where['id'] == '') {
|
if ($where['id'] == '') {
|
||||||
return $this->error('数据不存在');
|
$this->error('数据不存在');
|
||||||
|
}
|
||||||
|
$info = (new DocumentArticle())->getInfo($where["id"]);
|
||||||
|
if (empty($info)) {
|
||||||
|
$this->error('数据不存在');
|
||||||
}
|
}
|
||||||
$category = cModel::systemPage($where);
|
$category = cModel::systemPage($where);
|
||||||
$category = get_tree_list($category);
|
$category = get_tree_list($category);
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ namespace app\admin\controller;
|
||||||
|
|
||||||
use app\common\model\Document as aModel;
|
use app\common\model\Document as aModel;
|
||||||
use app\common\model\DocumentCategory as cModel;
|
use app\common\model\DocumentCategory as cModel;
|
||||||
|
use app\common\model\DocumentPage;
|
||||||
use app\common\model\Tag as TagModel;
|
use app\common\model\Tag as TagModel;
|
||||||
use app\common\model\DocumentArticle;
|
use app\common\model\DocumentArticle;
|
||||||
use app\common\model\Comment as CommentModel;
|
use app\common\model\Comment as CommentModel;
|
||||||
|
|
@ -52,6 +53,7 @@ class Page extends AuthController
|
||||||
['page', 1],
|
['page', 1],
|
||||||
['limit', 20],
|
['limit', 20],
|
||||||
]);
|
]);
|
||||||
|
$where["type"] = aModel::DOCUMENT_TYPE_PAGE;
|
||||||
return app("json")->layui(aModel::systemPage($where));
|
return app("json")->layui(aModel::systemPage($where));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,7 +175,6 @@ class Page extends AuthController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增文章
|
* 新增文章
|
||||||
* @param $category_id
|
|
||||||
* @return string
|
* @return string
|
||||||
* @throws DataNotFoundException
|
* @throws DataNotFoundException
|
||||||
* @throws DbException
|
* @throws DbException
|
||||||
|
|
@ -181,44 +182,57 @@ class Page extends AuthController
|
||||||
* @author 李玉坤
|
* @author 李玉坤
|
||||||
* @date 2021-03-10 14:46
|
* @date 2021-03-10 14:46
|
||||||
*/
|
*/
|
||||||
public function add($category_id = '')
|
public function add()
|
||||||
{
|
{
|
||||||
$where = [
|
// 获取页面模板列表
|
||||||
'name' => '',
|
$themeList = [];
|
||||||
'status' => ''
|
$themeDir = public_path('template').system_config('web_template').'/pc/page';
|
||||||
];
|
if ($dh = opendir($themeDir)) {
|
||||||
|
while (($file = readdir($dh)) !== false) {
|
||||||
|
|
||||||
$this->assign("category", $category);
|
if ( $file != "." && $file != "..") {
|
||||||
$this->assign("category_id", $category_id);
|
$themeList[] = $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($dh);
|
||||||
|
}
|
||||||
|
$this->assign("themeList", $themeList);
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑页
|
* 编辑页
|
||||||
* @return string
|
* @return string|void
|
||||||
* @throws \Exception
|
* @throws DataNotFoundException
|
||||||
* @author 李玉坤
|
* @throws DbException
|
||||||
* @date 2021-02-20 17:00
|
* @throws ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
public function edit()
|
public function edit()
|
||||||
{
|
{
|
||||||
$where = Util::postMore([
|
$where = Util::postMore([
|
||||||
['name', ''],
|
|
||||||
['id', '']
|
['id', '']
|
||||||
]);
|
]);
|
||||||
if ($where['id'] == '') {
|
if ($where['id'] == '') {
|
||||||
return $this->error('数据不存在');
|
$this->error('数据不存在');
|
||||||
}
|
}
|
||||||
$category = cModel::systemPage($where);
|
$info = (new DocumentPage())->getInfo($where["id"]);
|
||||||
$category = get_tree_list($category);
|
if (empty($info)) {
|
||||||
$info = aModel::get($where['id']);
|
$this->error('数据不存在');
|
||||||
$content = DocumentArticle::get($where['id']);
|
|
||||||
if ($content) {
|
|
||||||
$info->content = $content->content;
|
|
||||||
} else {
|
|
||||||
$info->content = '';
|
|
||||||
}
|
}
|
||||||
$this->assign("category", $category);
|
// 获取页面模板列表
|
||||||
|
$themeList = [];
|
||||||
|
$themeDir = public_path('template/');
|
||||||
|
$defaultTheme = system_config('web_template');
|
||||||
|
if ($dh = opendir($themeDir.'/'.$defaultTheme.'/pc/page')) {
|
||||||
|
if ((is_dir($themeDir . "/" . $file)) && $file != "." && $file != "..") {
|
||||||
|
while (($file = readdir($dh)) !== false) {
|
||||||
|
$pageList[] = $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir($dh);
|
||||||
|
}
|
||||||
|
$this->assign("themeList", $themeList);
|
||||||
$this->assign("info", $info);
|
$this->assign("info", $info);
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,20 +17,18 @@
|
||||||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
<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">文章设置</a></li>
|
<li><a href="#profile" role="tab" id="profile-tab" data-toggle="tab">文章设置</a></li>
|
||||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
||||||
onclick="history.back(-1);return false;">返 回</a></li>
|
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="myTabContent" class="tab-content">
|
<div id="myTabContent" class="tab-content">
|
||||||
<div class="tab-pane fade active in" id="home">
|
<div class="tab-pane fade active in" id="home">
|
||||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>文章名称</label>
|
<label>文章名称</label>
|
||||||
<input type="text" class="form-control" id="title" name="title" value=""
|
<input type="text" class="form-control" id="title" name="title" value="{$info.title}" placeholder="文章名称"/>
|
||||||
placeholder="文章名称"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>别名</label>
|
<label>别名</label>
|
||||||
<input type="text" class="form-control" id="alias" name="alias" value=""
|
<input type="text" class="form-control" id="alias" name="alias" value="{$info.alias}" placeholder="别名索引"/>
|
||||||
placeholder="别名索引"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="category_id">栏目分类</label>
|
<label for="category_id">栏目分类</label>
|
||||||
|
|
@ -38,9 +36,7 @@
|
||||||
<select name="category_id" id="category_id" class="form-control">
|
<select name="category_id" id="category_id" class="form-control">
|
||||||
<option value="0">请选择</option>
|
<option value="0">请选择</option>
|
||||||
{volist name="category" id="vo"}
|
{volist name="category" id="vo"}
|
||||||
<option value="{$vo.id}"
|
<option value="{$vo.id}">{$vo.html}{$vo.title}</option>
|
||||||
{notempty name="pid" }{if $vo.id==$category_id}selected{/if} {/notempty}
|
|
||||||
>{$vo.html}{$vo.title}</option>
|
|
||||||
{/volist}
|
{/volist}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
<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">文章设置</a></li>
|
<li><a href="#profile" role="tab" id="profile-tab" data-toggle="tab">文章设置</a></li>
|
||||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
||||||
onclick="history.back(-1);return false;">返 回</a></li>
|
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="myTabContent" class="tab-content">
|
<div id="myTabContent" class="tab-content">
|
||||||
<div class="tab-pane fade active in" id="home">
|
<div class="tab-pane fade active in" id="home">
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
<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><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="返回"
|
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
||||||
onclick="history.back(-1);return false;">返 回</a></li>
|
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="myTabContent" class="tab-content">
|
<div id="myTabContent" class="tab-content">
|
||||||
<div class="tab-pane fade active in" id="home">
|
<div class="tab-pane fade active in" id="home">
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
<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><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="返回"
|
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
||||||
onclick="history.back(-1);return false;">返 回</a></li>
|
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="myTabContent" class="tab-content">
|
<div id="myTabContent" class="tab-content">
|
||||||
<div class="tab-pane fade active in" id="home">
|
<div class="tab-pane fade active in" id="home">
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<ul id="myTabs" class="nav nav-tabs" role="tablist">
|
<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 class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
||||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回" onclick="history.back(-1);return false;">返 回</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>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="myTabContent" class="tab-content">
|
<div id="myTabContent" class="tab-content">
|
||||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||||
|
|
@ -23,36 +23,29 @@
|
||||||
<label>页面名称</label>
|
<label>页面名称</label>
|
||||||
<input type="text" class="form-control" id="title" name="title" value="" placeholder="页面名称"/>
|
<input type="text" class="form-control" id="title" name="title" value="" placeholder="页面名称"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group col-md-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-4">
|
||||||
<label>展示模板</label>
|
<label>展示模板</label>
|
||||||
<input class="form-control" name="theme" type="text" placeholder="展示模板">
|
<div class="form-group form-controls">
|
||||||
|
<select name="theme" id="theme" class="form-control">
|
||||||
|
<option value="0">请选择</option>
|
||||||
|
{volist name="themeList" id="vo"}
|
||||||
|
<option value="{$vo}">{$vo}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-4">
|
||||||
<label>URL名称</label>
|
<label>URL名称</label>
|
||||||
<input class="form-control" id="alias" name="alias" type="text" placeholder="URL名称">
|
<input class="form-control" id="alias" name="alias" type="text" placeholder="URL名称">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-xs-4">
|
||||||
|
<label for="abstract">排序</label>
|
||||||
|
<input type="text" class="form-control" name="sort" placeholder="请输入排序" value="99">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="abstract">排序</label>
|
|
||||||
<input type="text" class="form-control" name="sort" placeholder="请输入排序" value="99">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="link_str">外链</label>
|
|
||||||
<input type="text" class="form-control" name="link_str" id="link_str" placeholder="外链">
|
|
||||||
</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关键字">
|
|
||||||
</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描述">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>主图</label>
|
<label>主图</label>
|
||||||
<div class="form-controls">
|
<div class="form-controls">
|
||||||
|
|
@ -70,6 +63,20 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label for="link_str">外链</label>
|
||||||
|
<input type="text" class="form-control" name="link_str" id="link_str" placeholder="外链">
|
||||||
|
</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关键字">
|
||||||
|
</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描述">
|
||||||
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="abstract">摘要</label>
|
<label for="abstract">摘要</label>
|
||||||
<input type="text" class="form-control" name="abstract" id="abstract"
|
<input type="text" class="form-control" name="abstract" id="abstract"
|
||||||
|
|
|
||||||
|
|
@ -1,286 +0,0 @@
|
||||||
<!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">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<div class="card">
|
|
||||||
<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>
|
|
||||||
<div class="card-body">
|
|
||||||
<form class="form-inline searchForm" onsubmit="return false;">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="author">姓名</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" class="form-control" id="author" name="author"
|
|
||||||
placeholder="请输入姓名">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="email">邮箱</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" class="form-control" id="email" name="email" placeholder="邮箱">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="url">网址</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" class="form-control" id="url" name="url" placeholder="网址">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="start_time">操作时间</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<input class="form-control js-datetimepicker" type="text" id="start_time"
|
|
||||||
name="start_time" autocomplete="off" data-side-by-side="true" data-locale="zh-cn"
|
|
||||||
data-format="YYYY-MM-DD" placeholder="开始时间">
|
|
||||||
<span class="input-group-addon">~</span>
|
|
||||||
<input class="form-control js-datetimepicker" type="text" id="end_time" name="end_time"
|
|
||||||
autocomplete="off" data-side-by-side="true" data-locale="zh-cn"
|
|
||||||
data-format="YYYY-MM-DD" placeholder="结束时间">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-success" style="margin: -10px 0 0 10px;" id="search">搜索
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-toolbar clearfix">
|
|
||||||
<div class="toolbar-btn-action">
|
|
||||||
<a class="btn btn-warning" href="#!" onclick="delSelect()"><i class="mdi mdi-window-close"></i>
|
|
||||||
删除</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<table id="tb_departments"></table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{include file="public/footer"/}
|
|
||||||
<script type="text/javascript">
|
|
||||||
var id = GetQueryString("id");
|
|
||||||
$('#tb_departments').bootstrapTable({
|
|
||||||
classes: 'table table-bordered table-hover table-striped',
|
|
||||||
url: '/admin/article/commentList?id=' + id,
|
|
||||||
method: 'post',
|
|
||||||
dataType: 'json', // 因为本示例中是跨域的调用,所以涉及到ajax都采用jsonp,
|
|
||||||
uniqueId: 'id',
|
|
||||||
idField: 'id', // 每行的唯一标识字段
|
|
||||||
toolbar: '#toolbar', // 工具按钮容器
|
|
||||||
showColumns: false, // 是否显示所有的列
|
|
||||||
showRefresh: false, // 是否显示刷新按钮
|
|
||||||
responseHandler: function (res) {
|
|
||||||
return {
|
|
||||||
"total": res.count,
|
|
||||||
"rows": res.data,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
pagination: true,
|
|
||||||
queryParams: function (params) {
|
|
||||||
let temp = toArrayList($(".searchForm").serializeArray());
|
|
||||||
temp['document_id'] = id;
|
|
||||||
temp['limit'] = params.limit;
|
|
||||||
temp['page'] = (params.offset / params.limit) + 1;
|
|
||||||
return temp;
|
|
||||||
},
|
|
||||||
sidePagination: "server",
|
|
||||||
pageNumber: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
pageList: [10, 20, 50, 100],
|
|
||||||
columns: [{
|
|
||||||
checkbox: true, // 是否显示复选框
|
|
||||||
}, {
|
|
||||||
field: 'id',
|
|
||||||
title: 'ID'
|
|
||||||
}, {
|
|
||||||
field: 'author',
|
|
||||||
title: '姓名'
|
|
||||||
}, {
|
|
||||||
field: 'email',
|
|
||||||
title: '邮箱',
|
|
||||||
}, {
|
|
||||||
field: 'url',
|
|
||||||
title: '网址',
|
|
||||||
}, {
|
|
||||||
field: 'status',
|
|
||||||
title: '状态',
|
|
||||||
formatter: function (value, row, index) {
|
|
||||||
if (value == 0) {
|
|
||||||
is_checked = '';
|
|
||||||
} else if (value == 1) {
|
|
||||||
is_checked = 'checked="checked"';
|
|
||||||
}
|
|
||||||
var field = "display";
|
|
||||||
result = '<label class="lyear-switch switch-primary switch-solid lyear-status"><input type="checkbox" ' + is_checked + '><span onClick="updateStatus(' + row.id + ', ' + value + ', \'' + field + '\')"></span></label>';
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
field: 'create_time',
|
|
||||||
title: '留言时间',
|
|
||||||
}, {
|
|
||||||
field: 'operate',
|
|
||||||
title: '操作',
|
|
||||||
formatter: function (value, row, index) {
|
|
||||||
let html = '<a href="#!" class="btn btn-xs btn-default m-r-5 btn-detail" title="详情" data-toggle="tooltip" data-trigger="hover"><i class="mdi mdi-eye-outline"></i></a> \n' +
|
|
||||||
'<a class="btn btn-xs btn-default btn-del" href="#!" title="删除" data-toggle="tooltip" onclick="delOne(' + row.id + ')"><i class="mdi mdi-window-close"></i></a>';
|
|
||||||
return html;
|
|
||||||
},
|
|
||||||
events: {
|
|
||||||
'click .btn-detail': function (event, value, row, index) {
|
|
||||||
//职位描述+任职要求
|
|
||||||
let content = ' <div class="p-lr-15">\n' +
|
|
||||||
' <div class="row show-grid">\n' +
|
|
||||||
' <div class="col-xs-12 col-md-4">姓名:</div>\n' +
|
|
||||||
' <div class="col-xs-12 col-md-8">' + row.author + '</div>\n' +
|
|
||||||
' </div>\n' +
|
|
||||||
' <div class="row show-grid">\n' +
|
|
||||||
' <div class="col-xs-12 col-md-4">网址:</div>\n' +
|
|
||||||
' <div class="col-xs-12 col-md-8">' + row.url + '</div>\n' +
|
|
||||||
' </div>\n' +
|
|
||||||
' <div class="row show-grid">\n' +
|
|
||||||
' <div class="col-xs-12 col-md-4">邮箱:</div>\n' +
|
|
||||||
' <div class="col-xs-12 col-md-8">' + row.email + '</div>\n' +
|
|
||||||
' </div>\n' +
|
|
||||||
' <div class="row show-grid">\n' +
|
|
||||||
' <div class="col-xs-12 col-md-4">评论内容:</div>\n' +
|
|
||||||
' <div class="col-xs-12 col-md-8" style="white-space: pre-wrap;">' + row.content + '</div>\n' +
|
|
||||||
' </div>\n' +
|
|
||||||
' </div>';
|
|
||||||
$.alert({
|
|
||||||
title: '详情',
|
|
||||||
content: content,
|
|
||||||
boxWidth: '50%', //定义弹窗宽度
|
|
||||||
useBootstrap: false, //定义宽度必须设置
|
|
||||||
buttons: {
|
|
||||||
cancel: {
|
|
||||||
text: '关闭',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
onLoadSuccess: function (data) {
|
|
||||||
$("[data-toggle='tooltip']").tooltip();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//搜索
|
|
||||||
$("#search").click(function () {
|
|
||||||
let start_time = $('#start_time').val();
|
|
||||||
let end_time = $('#end_time').val();
|
|
||||||
if (start_time && end_time && start_time > end_time) {
|
|
||||||
alert('开始时间不能大于结束时间');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$("#tb_departments").bootstrapTable('refresh', {query: {page: 1}, pageNumber: 1});
|
|
||||||
});
|
|
||||||
|
|
||||||
function updateStatus(id, value, field) {
|
|
||||||
var newstate = (value == 1) ? 0 : 1; // 发送参数值跟当前参数值相反
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: "/admin/article/commentField?id=" + id,
|
|
||||||
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');
|
|
||||||
} else parent.lightyear.notify('修改失败', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
||||||
},
|
|
||||||
error: function () {
|
|
||||||
parent.lightyear.notify('修改失败', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function delOne(id) {
|
|
||||||
$.confirm({
|
|
||||||
title: '重要提醒!',
|
|
||||||
content: '删除后将不可恢复,请谨慎操作!',
|
|
||||||
backgroundDismiss: true,
|
|
||||||
buttons: {
|
|
||||||
ok: {
|
|
||||||
text: '确认',
|
|
||||||
btnClass: 'btn-danger',
|
|
||||||
action: function () {
|
|
||||||
$.post("/admin/message/del", data = {id: id}, function (res) {
|
|
||||||
if (res.status == 200 || res.code == 200) lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
||||||
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
|
||||||
location.reload();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cancel: {
|
|
||||||
text: '取消',
|
|
||||||
btnClass: 'btn-primary'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function delSelect() {
|
|
||||||
var checkID = "";
|
|
||||||
var selectedItem = $('#tb_departments').bootstrapTable('getSelections');
|
|
||||||
if (selectedItem == "") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
|
||||||
for (var i = 0; i < selectedItem.length; i++) {
|
|
||||||
checkID += selectedItem[i]['id'] + ",";
|
|
||||||
}
|
|
||||||
if (checkID == "") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
|
||||||
$.confirm({
|
|
||||||
title: '重要提醒!',
|
|
||||||
content: '选中项删除后将不可恢复,请谨慎操作!',
|
|
||||||
backgroundDismiss: true,
|
|
||||||
buttons: {
|
|
||||||
ok: {
|
|
||||||
text: '确认',
|
|
||||||
btnClass: 'btn-danger',
|
|
||||||
action: function () {
|
|
||||||
$.post("/admin/message/del", data = {id: checkID}, function (res) {
|
|
||||||
if (res.status == 200 || res.code == 200) {
|
|
||||||
lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
||||||
location.reload();
|
|
||||||
} else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cancel: {
|
|
||||||
text: '取消',
|
|
||||||
btnClass: 'btn-primary'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetQueryString(name) {
|
|
||||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
|
||||||
var r = window.location.search.substr(1).match(reg);
|
|
||||||
if (r != null) return unescape(r[2]);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -15,148 +15,102 @@
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<ul id="myTabs" class="nav nav-tabs" role="tablist">
|
<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 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">文章设置</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>
|
||||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
|
||||||
onclick="history.back(-1);return false;">返 回</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<div id="myTabContent" class="tab-content">
|
<div id="myTabContent" class="tab-content">
|
||||||
<div class="tab-pane fade active in" id="home">
|
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
<div class="form-group col-md-12">
|
||||||
<div class="form-group col-md-12">
|
<label>页面名称</label>
|
||||||
<label>文章名称</label>
|
<input type="text" class="form-control" id="title" name="title" value="" placeholder="页面名称"/>
|
||||||
<input type="hidden" name="id" value="{$info.id}">
|
</div>
|
||||||
<input type="text" class="form-control" id="title" name="title" placeholder="文章名称" value="{$info.title}"/>
|
<div class="form-group col-md-12">
|
||||||
</div>
|
<div class="row">
|
||||||
<div class="form-group col-md-12">
|
<div class="col-xs-4">
|
||||||
<label>别名</label>
|
<label>展示模板</label>
|
||||||
<input type="text" class="form-control" id="alias" name="alias" value="{$info.alias}"
|
<div class="form-group form-controls">
|
||||||
placeholder="别名索引"/>
|
<select name="theme" id="theme" class="form-control">
|
||||||
</div>
|
<option value="0">请选择</option>
|
||||||
<div class="form-group col-md-12">
|
{volist name="themeList" id="vo"}
|
||||||
<label for="category_id">栏目分类</label>
|
<option value="{$vo}" {if $vo == $info.theme}selected{/if}>{$vo}</option>
|
||||||
<div class="form-controls">
|
{/volist}
|
||||||
<select name="category_id" id="category_id" class="form-control">
|
</select>
|
||||||
{volist name="category" id="vo"}
|
</div>
|
||||||
<option value="{$vo.id}" {if $vo.id == $info.category_id}selected{/if}>{$vo.html}{$vo.title}</option>
|
</div>
|
||||||
{/volist}
|
<div class="col-xs-4">
|
||||||
</select>
|
<label>URL名称</label>
|
||||||
|
<input class="form-control" id="alias" name="alias" type="text" value="{$info.alias}" placeholder="URL名称">
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-4">
|
||||||
|
<label for="abstract">排序</label>
|
||||||
|
<input type="text" class="form-control" name="sort" placeholder="请输入排序" value="{$info.sort}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
</div>
|
||||||
<label for="author">作者</label>
|
<div class="form-group col-md-12">
|
||||||
<input type="text" class="form-control" id="author" name="author" placeholder="原作者" value="{$info.author}"/>
|
<label>主图</label>
|
||||||
|
<div class="form-controls">
|
||||||
|
<ul class="list-inline clearfix lyear-uploads-pic">
|
||||||
|
{notempty name="info.cover_path"}
|
||||||
|
<li class="col-xs-4 col-sm-3 col-md-2" id="pic-image" style="display: block;">
|
||||||
|
<figure>
|
||||||
|
<img src="{$info.cover_path}" alt="{$info.cover_path|basename}">
|
||||||
|
<figcaption>
|
||||||
|
<a class="btn btn-round btn-square btn-danger btn-image-delete"
|
||||||
|
href="#!"><i class="mdi mdi-delete"></i></a>
|
||||||
|
</figcaption>
|
||||||
|
</figure>
|
||||||
|
</li>
|
||||||
|
<li class="col-xs-4 col-sm-3 col-md-2" id="pic-upload" style="display: none;">
|
||||||
|
<input type="hidden" class="form-control" name="cover_path" id="cover_path"
|
||||||
|
value="{$info.cover_path}">
|
||||||
|
<input type="file" id="file_cover_path" accept="image/*" style="display: none;"
|
||||||
|
onchange="upload('cover_path')">
|
||||||
|
<a class="pic-add" href="#!" onclick="btnClick('cover_path')"
|
||||||
|
title="上传"></a>
|
||||||
|
</li>
|
||||||
|
{else /}
|
||||||
|
<li class="col-xs-4 col-sm-3 col-md-2" id="pic-image"
|
||||||
|
style="display: none;"></li>
|
||||||
|
<li class="col-xs-4 col-sm-3 col-md-2" id="pic-upload">
|
||||||
|
<input type="hidden" class="form-control" name="cover_path" id="cover_path">
|
||||||
|
<input type="file" id="file_cover_path" accept="image/*" style="display: none;"
|
||||||
|
onchange="upload('cover_path')">
|
||||||
|
<a class="pic-add" href="#!" onclick="btnClick('cover_path')"
|
||||||
|
title="上传"></a>
|
||||||
|
</li>
|
||||||
|
{/notempty}
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
</div>
|
||||||
<label>主图</label>
|
<div class="form-group col-md-12">
|
||||||
<div class="form-controls">
|
<label for="link_str">外链</label>
|
||||||
<ul class="list-inline clearfix lyear-uploads-pic">
|
<input type="text" class="form-control" name="link_str" id="link_str" value="{$info.link_str}" placeholder="外链">
|
||||||
{notempty name="info.cover_path"}
|
</div>
|
||||||
<li class="col-xs-4 col-sm-3 col-md-2" id="pic-image" style="display: block;">
|
<div class="form-group col-md-12">
|
||||||
<figure>
|
<label for="keywords">seo关键字</label>
|
||||||
<img src="{$info.cover_path}" alt="{$info.cover_path|basename}">
|
<input type="text" class="form-control" id="keywords" name="keywords" value="{$info.keywords}" placeholder="请输入seo关键字">
|
||||||
<figcaption>
|
</div>
|
||||||
<a class="btn btn-round btn-square btn-danger btn-image-delete"
|
<div class="form-group col-md-12">
|
||||||
href="#!"><i class="mdi mdi-delete"></i></a>
|
<label for="description">seo描述</label>
|
||||||
</figcaption>
|
<input type="text" class="form-control" name="description" id="description" value="{$info.description}" placeholder="seo描述">
|
||||||
</figure>
|
</div>
|
||||||
</li>
|
<div class="form-group col-md-12">
|
||||||
<li class="col-xs-4 col-sm-3 col-md-2" id="pic-upload" style="display: none;">
|
<label for="abstract">摘要</label>
|
||||||
<input type="hidden" class="form-control" name="cover_path" id="cover_path"
|
<input type="text" class="form-control" name="abstract" id="abstract" value="{$info.abstract}" placeholder="请输入摘要">
|
||||||
value="{$info.cover_path}">
|
</div>
|
||||||
<input type="file" id="file_cover_path" accept="image/*" style="display: none;"
|
<div class="form-group col-md-12">
|
||||||
onchange="upload('cover_path')">
|
<label for="abstract">标签</label>
|
||||||
<a class="pic-add" href="#!" onclick="btnClick('cover_path')"
|
<input class="form-control js-tags-input" type="text" name="tags" data-height="38px" value="{$info.tags}" placeholder="请输入标签">
|
||||||
title="上传"></a>
|
</div>
|
||||||
</li>
|
<div class="form-group col-md-12">
|
||||||
{else /}
|
<label for="content">页面内容</label>
|
||||||
<li class="col-xs-4 col-sm-3 col-md-2" id="pic-image"
|
<textarea id="content" name="content" data-provide="summernote" data-toolbar="full">{$info.content}</textarea>
|
||||||
style="display: none;"></li>
|
</div>
|
||||||
<li class="col-xs-4 col-sm-3 col-md-2" id="pic-upload">
|
<div class="form-group col-md-12">
|
||||||
<input type="hidden" class="form-control" name="cover_path" id="cover_path">
|
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
||||||
<input type="file" id="file_cover_path" accept="image/*" style="display: none;"
|
</button>
|
||||||
onchange="upload('cover_path')">
|
</div>
|
||||||
<a class="pic-add" href="#!" onclick="btnClick('cover_path')"
|
</form>
|
||||||
title="上传"></a>
|
|
||||||
</li>
|
|
||||||
{/notempty}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="abstract">摘要</label>
|
|
||||||
<input type="text" class="form-control" name="abstract" id="abstract"
|
|
||||||
placeholder="请输入摘要" value="{$info.abstract}">
|
|
||||||
</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"
|
|
||||||
placeholder="请输入标签" value="{$info.tags}">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="content">文章内容</label>
|
|
||||||
<textarea id="content" name="content" data-provide="summernote" data-toolbar="full">{$info.content}</textarea>
|
|
||||||
</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 row col-md-2">
|
|
||||||
<div class="col-xs-6">推荐</div>
|
|
||||||
<div class="col-xs-6">
|
|
||||||
<label class="lyear-switch switch-solid switch-primary">
|
|
||||||
<input type="checkbox" name="is_recommend" {if $info.is_recommend}checked{/if}>
|
|
||||||
<span></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row col-md-2">
|
|
||||||
<div class="col-xs-6">热门</div>
|
|
||||||
<div class="col-xs-6">
|
|
||||||
<label class="lyear-switch switch-solid switch-primary">
|
|
||||||
<input type="checkbox" name="is_hot" {if $info.is_hot}checked{/if}>
|
|
||||||
<span></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row col-md-2">
|
|
||||||
<div class="col-xs-6">置顶</div>
|
|
||||||
<div class="col-xs-6">
|
|
||||||
<label class="lyear-switch switch-solid switch-primary">
|
|
||||||
<input type="checkbox" name="is_top" {if $info.is_top}checked{/if}>
|
|
||||||
<span></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="abstract">排序</label>
|
|
||||||
<input type="text" class="form-control" name="sort" placeholder="请输入排序"
|
|
||||||
value="{$info.sort}">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="link_str">外链</label>
|
|
||||||
<input type="text" class="form-control" name="link_str" id="link_str" placeholder="外链"
|
|
||||||
value="{$info.link_str}">
|
|
||||||
</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}">
|
|
||||||
</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}">
|
|
||||||
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,11 @@ use think\db\exception\ModelNotFoundException;
|
||||||
*/
|
*/
|
||||||
class Document extends BaseModel
|
class Document extends BaseModel
|
||||||
{
|
{
|
||||||
|
//文档类型
|
||||||
|
const DOCUMENT_TYPE_ARTICLE = "article";
|
||||||
|
const DOCUMENT_TYPE_PAGE = "page";
|
||||||
|
const DOCUMENT_TYPE_CATEGORY = "product";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
* @param $where
|
* @param $where
|
||||||
|
|
@ -28,6 +33,7 @@ class Document extends BaseModel
|
||||||
public static function systemPage($where): array
|
public static function systemPage($where): array
|
||||||
{
|
{
|
||||||
$model = new self;
|
$model = new self;
|
||||||
|
$model = $model->where("type", "=",$where['type']?:self::DOCUMENT_TYPE_ARTICLE);
|
||||||
if ($where['title'] != '') $model = $model->where("title", "like", "%$where[title]%");
|
if ($where['title'] != '') $model = $model->where("title", "like", "%$where[title]%");
|
||||||
if ($where['start_time'] != '') $model = $model->where("create_time", ">", strtotime($where['start_time'] . " 00:00:00"));
|
if ($where['start_time'] != '') $model = $model->where("create_time", ">", strtotime($where['start_time'] . " 00:00:00"));
|
||||||
if ($where['end_time'] != '') $model = $model->where("create_time", "<", strtotime($where['end_time'] . " 23:59:59"));
|
if ($where['end_time'] != '') $model = $model->where("create_time", "<", strtotime($where['end_time'] . " 23:59:59"));
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
namespace app\common\model;
|
namespace app\common\model;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\model\Document as aModel;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
use think\db\exception\ModelNotFoundException;
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
|
@ -16,23 +17,19 @@ use think\db\exception\ModelNotFoundException;
|
||||||
*/
|
*/
|
||||||
class DocumentArticle extends BaseModel
|
class DocumentArticle extends BaseModel
|
||||||
{
|
{
|
||||||
/**
|
public function getInfo($id)
|
||||||
* 列表
|
|
||||||
* @param $where
|
|
||||||
* @return array
|
|
||||||
* @throws DataNotFoundException
|
|
||||||
* @throws DbException
|
|
||||||
* @throws ModelNotFoundException
|
|
||||||
* @author 李玉坤
|
|
||||||
* @date 2021-02-15 23:24
|
|
||||||
*/
|
|
||||||
public static function systemPage($where): array
|
|
||||||
{
|
{
|
||||||
$model = new self;
|
if (empty($id)){
|
||||||
$count = self::counts($model);
|
return [];
|
||||||
if ($where['page'] && $where['limit']) $model = $model->page((int)$where['page'], (int)$where['limit']);
|
}
|
||||||
$data = $model->select();
|
$info = aModel::alias('a')
|
||||||
if ($data) $data = $data->toArray();
|
->leftJoin('document_article p','a.id = p.id')
|
||||||
return compact('data', 'count');
|
->where("a.id",$id)
|
||||||
|
->where("a.type",Document::DOCUMENT_TYPE_PAGE)
|
||||||
|
->find();
|
||||||
|
if (!$info){
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return $info->toArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\model\Document as aModel;
|
||||||
|
use think\db\exception\DataNotFoundException;
|
||||||
|
use think\db\exception\DbException;
|
||||||
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DocumentPage
|
||||||
|
* @package app\admin\model\system
|
||||||
|
* @author 李玉坤
|
||||||
|
* @date 2021-02-15 23:22
|
||||||
|
*/
|
||||||
|
class DocumentPage extends BaseModel
|
||||||
|
{
|
||||||
|
public function getInfo($id)
|
||||||
|
{
|
||||||
|
if (empty($id)){
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
$info = aModel::alias('a')
|
||||||
|
->leftJoin('document_page p','a.id = p.id')
|
||||||
|
->where("a.id",$id)
|
||||||
|
->where("a.type",Document::DOCUMENT_TYPE_PAGE)
|
||||||
|
->find();
|
||||||
|
if (!$info){
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return $info->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -118,7 +118,11 @@ class Article extends Base
|
||||||
}
|
}
|
||||||
//获取该文章
|
//获取该文章
|
||||||
$documentModel = new Document();
|
$documentModel = new Document();
|
||||||
$article = $documentModel->where('status', 1)->where('id|alias', $id)->find();
|
if (is_numeric($id)){
|
||||||
|
$article = $documentModel->where('status', 1)->where('id', $id)->find();
|
||||||
|
}else{
|
||||||
|
$article = $documentModel->where('status', 1)->where('alias', $id)->find();
|
||||||
|
}
|
||||||
if (!$article) {
|
if (!$article) {
|
||||||
$this->error('文章不存在或已删除!');
|
$this->error('文章不存在或已删除!');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue