修复一大波bug

This commit is contained in:
liyukun 2021-11-11 01:37:43 +08:00
parent 208c99931b
commit afeb6558ee
8 changed files with 318 additions and 247 deletions

View File

@ -62,4 +62,37 @@ class Tag extends BaseModel
}
return $this->saveAll($saveAll);
}
/**
* 列表
* @param $where
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 李玉坤
* @date 2021-02-15 23:24
*/
public static function getList($where): array
{
$list = cache('index:tagList');
if ($list){
return json_decode($list,true);
}else{
$tagList = self::systemPage($where);
$list = [];
foreach ($tagList['data'] as $tag){
$list[] = [
"text" => $tag['name'],
"href" => url("/index/article/tag?t=".$tag['name'])->build()
];
}
if ($list){
cache('index:tagList',json_encode($list),24*60*60);
}
}
return $list;
}
}

View File

@ -367,7 +367,10 @@ function tpl_get_list($orderby, $pagesize, $cid, $type, $table = 'article', $whe
break;
case 'tag':
//读取指定tag的文章
$documentListModel = $documentListModel->where('a.keywords', 'like', "%$where%");
$tag = substr(input('t'),0,strpos(input('t'),'.')); //搜索关键词
$tagModel = new \app\common\model\Tag();
$tagList = $tagModel->where('name',$tag)->select()->toArray();
$documentListModel = $documentListModel->where('a.id', 'in', array_column($tagList,'document_id'));
break;
}
$documentListModel = $documentListModel->order($orderby);

View File

@ -5,6 +5,7 @@ use app\common\model\Document;
use app\common\model\DocumentCategory;
use app\common\model\DocumentCategoryContent;
use app\common\model\Comment as commentModel;
use app\common\model\Tag as TagModel;
use app\Request;
use think\facade\Log;
@ -237,6 +238,25 @@ class Article extends Base
return $this->fetch();
}
/**
* 标签列表
* @return mixed
* @author 李玉坤
* @date 2021-11-11 0:27
*/
public function tagList()
{
$where = Util::postMore([
['name',''],
['document_id',''],
['start_time',''],
['end_time',''],
['page',1],
['limit',10]
]);
return app("json")->layui(TagModel::getList($where));
}
/**
* 搜索页面
* @return string

View File

@ -222,191 +222,191 @@
</div>
</div>
<div id="comments" class="responsesWrapper">
<div class="reply-title">发表评论</div>
<div id="respond" class="comment-respond">
<h3 id="reply-title" class="comment-reply-title">
<small>
<a rel="nofollow" id="cancel-comment-reply-link" href="#respond" style="display:none;">
取消回复
</a>
</small>
</h3>
<form action="{:url('/index/article/create_comment')}" method="post"
id="form_comment" class="comment-form">
<div class="comment-user-plane">
<div class="logged-in-as">
<img class="comment-user-avatar" width="48" height="auto" src="__IMG__/avatar.png" alt="">
</div>
<div class="comment_form_textarea_box">
<textarea class="comment_form_textarea" name="content" id="comment" placeholder="发表你的看法" rows="5"></textarea>
<div id="comment_addplane">
<button class="popover-btn popover-btn-face" type="button">
<i class="far fa-smile-wink">
</i>添加表情</button>
<div class="conment-face-plane">
<img class="img-pace" src="__IMG__/face/yun.gif" width="30"
facename="yun">
<img class="img-pace" src="__IMG__/face/youling.gif" width="30"
facename="youling">
<img class="img-pace" src="__IMG__/face/yiwen.gif" width="30"
facename="yiwen">
<img class="img-pace" src="__IMG__/face/yinxian.gif" width="30"
facename="yinxian">
<img class="img-pace" src="__IMG__/face/xigua.gif" width="30"
facename="xigua">
<img class="img-pace" src="__IMG__/face/xieyanxiao.gif"
width="30" facename="xieyanxiao">
<img class="img-pace" src="__IMG__/face/xiaoku.gif" width="30"
facename="xiaoku">
<img class="img-pace" src="__IMG__/face/xiaojiujie.gif"
width="30" facename="xiaojiujie">
<img class="img-pace" src="__IMG__/face/wunai.gif" width="30"
facename="wunai">
<img class="img-pace" src="__IMG__/face/wozuimei.gif" width="30"
facename="wozuimei">
<img class="img-pace" src="__IMG__/face/woshou.gif" width="30"
facename="woshou">
<img class="img-pace" src="__IMG__/face/weiqu.gif" width="30"
facename="weiqu">
<img class="img-pace" src="__IMG__/face/tuosai.gif" width="30"
facename="tuosai">
<img class="img-pace" src="__IMG__/face/touxiao.gif" width="30"
facename="touxiao">
<img class="img-pace" src="__IMG__/face/tiaopi.gif" width="30"
facename="tiaopi">
<img class="img-pace" src="__IMG__/face/shuai.gif" width="30"
facename="shuai">
<img class="img-pace" src="__IMG__/face/shengli.gif" width="30"
facename="shengli">
<img class="img-pace" src="__IMG__/face/se.gif" width="30"
facename="se">
<img class="img-pace" src="__IMG__/face/quantou.gif" width="30"
facename="quantou">
<img class="img-pace" src="__IMG__/face/qinqin.gif" width="30"
facename="qinqin">
<img class="img-pace" src="__IMG__/face/qiang.gif" width="30"
facename="qiang">
<img class="img-pace" src="__IMG__/face/piezui.gif" width="30"
facename="piezui">
<img class="img-pace" src="__IMG__/face/penxue.gif" width="30"
facename="penxue">
<img class="img-pace" src="__IMG__/face/nanguo.gif" width="30"
facename="nanguo">
<img class="img-pace" src="__IMG__/face/liuhan.gif" width="30"
facename="liuhan">
<img class="img-pace" src="__IMG__/face/lenghan.gif" width="30"
facename="lenghan">
<img class="img-pace" src="__IMG__/face/leiben.gif" width="30"
facename="leiben">
<img class="img-pace" src="__IMG__/face/ku.gif" width="30"
facename="ku">
<img class="img-pace" src="__IMG__/face/koubi.gif" width="30"
facename="koubi">
<img class="img-pace" src="__IMG__/face/keai.gif" width="30"
facename="keai">
<img class="img-pace" src="__IMG__/face/jingkong.gif" width="30"
facename="jingkong">
<img class="img-pace" src="__IMG__/face/jie.gif" width="30"
facename="jie">
<img class="img-pace" src="__IMG__/face/huaixiao.gif" width="30"
facename="huaixiao">
<img class="img-pace" src="__IMG__/face/hanxiao.gif" width="30"
facename="hanxiao">
<img class="img-pace" src="__IMG__/face/haixiu.gif" width="30"
facename="haixiu">
<img class="img-pace" src="__IMG__/face/guzhang.gif" width="30"
facename="guzhang">
<img class="img-pace" src="__IMG__/face/ganga.gif" width="30"
facename="ganga">
<img class="img-pace" src="__IMG__/face/fadai.gif" width="30"
facename="fadai">
<img class="img-pace" src="__IMG__/face/doge.gif" width="30"
facename="doge">
<img class="img-pace" src="__IMG__/face/dabing.gif" width="30"
facename="dabing">
<img class="img-pace" src="__IMG__/face/ciya.gif" width="30"
facename="ciya">
<img class="img-pace" src="__IMG__/face/caidao.gif" width="30"
facename="caidao">
<img class="img-pace" src="__IMG__/face/cahan.gif" width="30"
facename="cahan">
<img class="img-pace" src="__IMG__/face/bizui.gif" width="30"
facename="bizui">
<img class="img-pace" src="__IMG__/face/baoquan.gif" width="30"
facename="baoquan">
<img class="img-pace" src="__IMG__/face/aoman.gif" width="30"
facename="aoman">
<img class="img-pace" src="__IMG__/face/aixin.gif" width="30"
facename="aixin">
<img class="img-pace" src="__IMG__/face/OK.gif" width="30"
facename="OK">
</div>
</div>
<div class="reply-title">发表评论</div>
<div id="respond" class="comment-respond">
<h3 id="reply-title" class="comment-reply-title">
<small>
<a rel="nofollow" id="cancel-comment-reply-link" href="#respond" style="display:none;">
取消回复
</a>
</small>
</h3>
<form action="{:url('/index/article/create_comment')}" method="post"
id="form_comment" class="comment-form">
<div class="comment-user-plane">
<div class="logged-in-as">
<img class="comment-user-avatar" width="48" height="auto" src="__IMG__/avatar.png" alt="">
</div>
<div class="comment_form_textarea_box">
<textarea class="comment_form_textarea" name="content" id="comment" placeholder="发表你的看法" rows="5"></textarea>
<div id="comment_addplane">
<button class="popover-btn popover-btn-face" type="button">
<i class="far fa-smile-wink">
</i>添加表情</button>
<div class="conment-face-plane">
<img class="img-pace" src="__IMG__/face/yun.gif" width="30"
facename="yun">
<img class="img-pace" src="__IMG__/face/youling.gif" width="30"
facename="youling">
<img class="img-pace" src="__IMG__/face/yiwen.gif" width="30"
facename="yiwen">
<img class="img-pace" src="__IMG__/face/yinxian.gif" width="30"
facename="yinxian">
<img class="img-pace" src="__IMG__/face/xigua.gif" width="30"
facename="xigua">
<img class="img-pace" src="__IMG__/face/xieyanxiao.gif"
width="30" facename="xieyanxiao">
<img class="img-pace" src="__IMG__/face/xiaoku.gif" width="30"
facename="xiaoku">
<img class="img-pace" src="__IMG__/face/xiaojiujie.gif"
width="30" facename="xiaojiujie">
<img class="img-pace" src="__IMG__/face/wunai.gif" width="30"
facename="wunai">
<img class="img-pace" src="__IMG__/face/wozuimei.gif" width="30"
facename="wozuimei">
<img class="img-pace" src="__IMG__/face/woshou.gif" width="30"
facename="woshou">
<img class="img-pace" src="__IMG__/face/weiqu.gif" width="30"
facename="weiqu">
<img class="img-pace" src="__IMG__/face/tuosai.gif" width="30"
facename="tuosai">
<img class="img-pace" src="__IMG__/face/touxiao.gif" width="30"
facename="touxiao">
<img class="img-pace" src="__IMG__/face/tiaopi.gif" width="30"
facename="tiaopi">
<img class="img-pace" src="__IMG__/face/shuai.gif" width="30"
facename="shuai">
<img class="img-pace" src="__IMG__/face/shengli.gif" width="30"
facename="shengli">
<img class="img-pace" src="__IMG__/face/se.gif" width="30"
facename="se">
<img class="img-pace" src="__IMG__/face/quantou.gif" width="30"
facename="quantou">
<img class="img-pace" src="__IMG__/face/qinqin.gif" width="30"
facename="qinqin">
<img class="img-pace" src="__IMG__/face/qiang.gif" width="30"
facename="qiang">
<img class="img-pace" src="__IMG__/face/piezui.gif" width="30"
facename="piezui">
<img class="img-pace" src="__IMG__/face/penxue.gif" width="30"
facename="penxue">
<img class="img-pace" src="__IMG__/face/nanguo.gif" width="30"
facename="nanguo">
<img class="img-pace" src="__IMG__/face/liuhan.gif" width="30"
facename="liuhan">
<img class="img-pace" src="__IMG__/face/lenghan.gif" width="30"
facename="lenghan">
<img class="img-pace" src="__IMG__/face/leiben.gif" width="30"
facename="leiben">
<img class="img-pace" src="__IMG__/face/ku.gif" width="30"
facename="ku">
<img class="img-pace" src="__IMG__/face/koubi.gif" width="30"
facename="koubi">
<img class="img-pace" src="__IMG__/face/keai.gif" width="30"
facename="keai">
<img class="img-pace" src="__IMG__/face/jingkong.gif" width="30"
facename="jingkong">
<img class="img-pace" src="__IMG__/face/jie.gif" width="30"
facename="jie">
<img class="img-pace" src="__IMG__/face/huaixiao.gif" width="30"
facename="huaixiao">
<img class="img-pace" src="__IMG__/face/hanxiao.gif" width="30"
facename="hanxiao">
<img class="img-pace" src="__IMG__/face/haixiu.gif" width="30"
facename="haixiu">
<img class="img-pace" src="__IMG__/face/guzhang.gif" width="30"
facename="guzhang">
<img class="img-pace" src="__IMG__/face/ganga.gif" width="30"
facename="ganga">
<img class="img-pace" src="__IMG__/face/fadai.gif" width="30"
facename="fadai">
<img class="img-pace" src="__IMG__/face/doge.gif" width="30"
facename="doge">
<img class="img-pace" src="__IMG__/face/dabing.gif" width="30"
facename="dabing">
<img class="img-pace" src="__IMG__/face/ciya.gif" width="30"
facename="ciya">
<img class="img-pace" src="__IMG__/face/caidao.gif" width="30"
facename="caidao">
<img class="img-pace" src="__IMG__/face/cahan.gif" width="30"
facename="cahan">
<img class="img-pace" src="__IMG__/face/bizui.gif" width="30"
facename="bizui">
<img class="img-pace" src="__IMG__/face/baoquan.gif" width="30"
facename="baoquan">
<img class="img-pace" src="__IMG__/face/aoman.gif" width="30"
facename="aoman">
<img class="img-pace" src="__IMG__/face/aixin.gif" width="30"
facename="aixin">
<img class="img-pace" src="__IMG__/face/OK.gif" width="30"
facename="OK">
</div>
</div>
<div class="comment_userinput">
<div class="comment-form-author">
<input id="author" name="author" placeholder="昵称(*)" type="text" value="" size="30" class="required" />
</div>
<div class="comment-form-email">
<input id="email" name="email" type="text" placeholder="邮箱(*)" value="" class="required" />
</div>
<div class="comment-form-url">
<input id="url" placeholder="网址" name="url" type="text" value="" size="30" />
</div>
</div>
<div style="display: none" class="comment-form-cookies-consent">
<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" checked="checked" />
</div>
<div class="form-submit">
<div style="text-align: right">
<input name="submit" type="submit" id="submit" class="button primary-btn" value="发表评论">
</div>
<input type="hidden" name="document_id" value="{$apeField['id']}" id="comment_document_id">
<input type="hidden" name="pid" id="comment_pid" value="0">
</div>
</form>
</div>
</div>
<!-- #respond -->
<meta content="UserComments:0" itemprop="interactionCount">
<h3 class="comments-title">共有<span class="commentCount">0</span>条评论</h3>
<div class="comment-sofa">
<i class="fas fa-couch">
</i>
沙发空余
<div class="comment_userinput">
<div class="comment-form-author">
<input id="author" name="author" placeholder="昵称(*)" type="text" value="" size="30" class="required" />
</div>
<script type='text/javascript' src='__JS__/comment-reply.min.js'></script>
<script type='text/javascript'>
$("body").on("click", ".comment-reply-link",
function(e) {
addComment.moveForm("li-comment-" + $(this).attr("data-commentid"), $(this).attr("data-commentid"), "respond", $(this).attr("data-postid"));
console.log("li-comment-" + $(this).attr("data-commentid"), $(this).attr("data-commentid"), "respond", $(this).attr("data-postid"));
e.stopPropagation();
return false;
});
$(document).click(function(e) {
$(".conment-face-plane").css("opacity", "0");
$(".conment-face-plane").css("visibility", "hidden");
e.stopPropagation();
});
$("body").on("click", ".img-pace",
function(e) {
$(".comment_form_textarea").val($(".comment_form_textarea").val() + "[f=" + $(this).attr("facename") + "]");
});
$("body").on("click", ".popover-btn-face",
function(e) {
if ($(".conment-face-plane").css("visibility") == "visible") {
$(".conment-face-plane").css("opacity", "0");
$(".conment-face-plane").css("visibility", "hidden");
} else {
$(".conment-face-plane").css("opacity", "1");
$(".conment-face-plane").css("visibility", "visible");
}
e.stopPropagation();
});
</script>
<nav class="comment-navigation pages"></nav>
</div>
<div class="comment-form-email">
<input id="email" name="email" type="text" placeholder="邮箱(*)" value="" class="required" />
</div>
<div class="comment-form-url">
<input id="url" placeholder="网址" name="url" type="text" value="" size="30" />
</div>
</div>
<div style="display: none" class="comment-form-cookies-consent">
<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" checked="checked" />
</div>
<div class="form-submit">
<div style="text-align: right">
<input name="submit" type="submit" id="submit" class="button primary-btn" value="发表评论">
</div>
<input type="hidden" name="document_id" value="{$apeField['id']}" id="comment_document_id">
<input type="hidden" name="pid" id="comment_pid" value="0">
</div>
</form>
</div>
<!-- #respond -->
<meta content="UserComments:0" itemprop="interactionCount">
<h3 class="comments-title">共有<span class="commentCount">0</span>条评论</h3>
<div class="comment-sofa">
<i class="fas fa-couch">
</i>
沙发空余
</div>
<script type='text/javascript' src='__JS__/comment-reply.min.js'></script>
<script type='text/javascript'>
$("body").on("click", ".comment-reply-link",
function(e) {
addComment.moveForm("li-comment-" + $(this).attr("data-commentid"), $(this).attr("data-commentid"), "respond", $(this).attr("data-postid"));
console.log("li-comment-" + $(this).attr("data-commentid"), $(this).attr("data-commentid"), "respond", $(this).attr("data-postid"));
e.stopPropagation();
return false;
});
$(document).click(function(e) {
$(".conment-face-plane").css("opacity", "0");
$(".conment-face-plane").css("visibility", "hidden");
e.stopPropagation();
});
$("body").on("click", ".img-pace",
function(e) {
$(".comment_form_textarea").val($(".comment_form_textarea").val() + "[f=" + $(this).attr("facename") + "]");
});
$("body").on("click", ".popover-btn-face",
function(e) {
if ($(".conment-face-plane").css("visibility") == "visible") {
$(".conment-face-plane").css("opacity", "0");
$(".conment-face-plane").css("visibility", "hidden");
} else {
$(".conment-face-plane").css("opacity", "1");
$(".conment-face-plane").css("visibility", "visible");
}
e.stopPropagation();
});
</script>
<nav class="comment-navigation pages"></nav>
</div>
</div>
<div class="sidebar">
<div class="sidebar-box-list">

View File

@ -131,26 +131,32 @@
z-index: 100 !important;
}
</style>
<script>
var tag = TagCloud(
".corepress-tag-container-tag1",
JSON.parse(
'[{"text":"WordPress","href":"https:\/\/www.lovestu.com\/tag\/wordpress"},{"text":"WordPress\u7248\u672c","href":"https:\/\/www.lovestu.com\/tag\/wordpress%e7%89%88%e6%9c%ac"},{"text":"\u4e3b\u9898","href":"https:\/\/www.lovestu.com\/tag\/%e4%b8%bb%e9%a2%98"},{"text":"\u4ee3\u7801","href":"https:\/\/www.lovestu.com\/tag\/code"},{"text":"\u4f7f\u7528\u6559\u7a0b","href":"https:\/\/www.lovestu.com\/tag\/tutorial"}]'
),
{},
[
"#67C23A",
"#E6A23C",
"#F56C6C",
"#909399",
"#CC9966",
"#FF6666",
"#99CCFF",
"#FF9999",
"#CC6633",
]
);
</script>
<script>
$.get("{:url('/index/article/taglist')}",function(data,status){
TagCloud(
".corepress-tag-container-tag1",
data.data,
{},
[
"#67C23A",
"#E6A23C",
"#F56C6C",
"#909399",
"#CC9966",
"#FF6666",
"#99CCFF",
"#FF9999",
"#CC6633",
"#67C23A",
'#ef5b9c',
'#fcaf17',
'#009ad6',
'#003A8C',
'#f36c21'
]
);
});
</script>
</div>
{ape:advert row="3" type="2"}
<div class="aside-box">

View File

@ -17,10 +17,10 @@
<div class="post-main">
<div class="post-list-page-plane">
<div class="list-plane-title">
<div>标签内容:{$kw}</div>
<div>标签内容:{$tag}</div>
</div>
<ul class="post-list">
{ape:list pagesize="10" type="where"}
{ape:list pagesize="10" type="tag"}
<li class="post-item">
<div class="post-item-container">
<div class="post-item-thumbnail">
@ -76,7 +76,7 @@
<div class="aside-box">
<form class="search-form" action="{:url('/index/article/search')}" method="get" role="search">
<div class="search-form-input-plane">
<input type="text" class="search-keyword" name="kw" placeholder="搜索内容" value="{$kw}"/>
<input type="text" class="search-keyword" name="kw" placeholder="搜索内容"/>
</div>
<div>
<button type="submit" class="search-submit" value="&#xf002;">搜索</button>
@ -131,26 +131,32 @@
z-index: 100 !important;
}
</style>
<script>
var tag = TagCloud(
".corepress-tag-container-tag1",
JSON.parse(
'[{"text":"WordPress","href":"https:\/\/www.lovestu.com\/tag\/wordpress"},{"text":"WordPress\u7248\u672c","href":"https:\/\/www.lovestu.com\/tag\/wordpress%e7%89%88%e6%9c%ac"},{"text":"\u4e3b\u9898","href":"https:\/\/www.lovestu.com\/tag\/%e4%b8%bb%e9%a2%98"},{"text":"\u4ee3\u7801","href":"https:\/\/www.lovestu.com\/tag\/code"},{"text":"\u4f7f\u7528\u6559\u7a0b","href":"https:\/\/www.lovestu.com\/tag\/tutorial"}]'
),
{},
[
"#67C23A",
"#E6A23C",
"#F56C6C",
"#909399",
"#CC9966",
"#FF6666",
"#99CCFF",
"#FF9999",
"#CC6633",
]
);
</script>
<script>
$.get("{:url('/index/article/taglist')}",function(data,status){
TagCloud(
".corepress-tag-container-tag1",
data.data,
{},
[
"#67C23A",
"#E6A23C",
"#F56C6C",
"#909399",
"#CC9966",
"#FF6666",
"#99CCFF",
"#FF9999",
"#CC6633",
"#67C23A",
'#ef5b9c',
'#fcaf17',
'#009ad6',
'#003A8C',
'#f36c21'
]
);
});
</script>
</div>
{ape:advert row="3" type="2"}
<div class="aside-box">

View File

@ -217,24 +217,30 @@
}
</style>
<script>
var tag = TagCloud(
".corepress-tag-container-tag1",
JSON.parse(
'[{"text":"WordPress","href":"https:\/\/www.lovestu.com\/tag\/wordpress"},{"text":"WordPress\u7248\u672c","href":"https:\/\/www.lovestu.com\/tag\/wordpress%e7%89%88%e6%9c%ac"},{"text":"\u4e3b\u9898","href":"https:\/\/www.lovestu.com\/tag\/%e4%b8%bb%e9%a2%98"},{"text":"\u4ee3\u7801","href":"https:\/\/www.lovestu.com\/tag\/code"},{"text":"\u4f7f\u7528\u6559\u7a0b","href":"https:\/\/www.lovestu.com\/tag\/tutorial"}]'
),
{},
[
"#67C23A",
"#E6A23C",
"#F56C6C",
"#909399",
"#CC9966",
"#FF6666",
"#99CCFF",
"#FF9999",
"#CC6633",
]
);
$.get("{:url('/index/article/taglist')}",function(data,status){
TagCloud(
".corepress-tag-container-tag1",
data.data,
{},
[
"#67C23A",
"#E6A23C",
"#F56C6C",
"#909399",
"#CC9966",
"#FF6666",
"#99CCFF",
"#FF9999",
"#CC6633",
"#67C23A",
'#ef5b9c',
'#fcaf17',
'#009ad6',
'#003A8C',
'#f36c21'
]
);
});
</script>
</div>
{ape:advert row="3" type="2"}

View File

@ -32,10 +32,7 @@
</ul>
</nav>
<div class="footer-info">Copyright &copy; {:web_config("copyright")}</div>
<div class="footer-info">
<span class="footer-icp"><img class="ipc-icon" src="__IMG__/icp.svg" alt=""/><a href="javascript:;" target="_blank">{:web_config("icp")}</a></span>
<span class="footer-icp"><img class="ipc-icon" src="__IMG__/police.svg" alt=""/><a href="javascript:;" target="_blank">{:web_config("icp")}</a></span>
</div>
<div class="footer-info"><span class="footer-icp">{:web_config("icp")}</span></div>
</div>
</div>
<div class="footer-details footer-right">