mirror of https://github.com/1099438829/apeblog
修复一大波bug
This commit is contained in:
parent
208c99931b
commit
afeb6558ee
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -132,11 +132,10 @@
|
|||
}
|
||||
</style>
|
||||
<script>
|
||||
var tag = TagCloud(
|
||||
$.get("{:url('/index/article/taglist')}",function(data,status){
|
||||
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"}]'
|
||||
),
|
||||
data.data,
|
||||
{},
|
||||
[
|
||||
"#67C23A",
|
||||
|
|
@ -148,8 +147,15 @@
|
|||
"#99CCFF",
|
||||
"#FF9999",
|
||||
"#CC6633",
|
||||
"#67C23A",
|
||||
'#ef5b9c',
|
||||
'#fcaf17',
|
||||
'#009ad6',
|
||||
'#003A8C',
|
||||
'#f36c21'
|
||||
]
|
||||
);
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{ape:advert row="3" type="2"}
|
||||
|
|
|
|||
|
|
@ -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="">搜索</button>
|
||||
|
|
@ -132,11 +132,10 @@
|
|||
}
|
||||
</style>
|
||||
<script>
|
||||
var tag = TagCloud(
|
||||
$.get("{:url('/index/article/taglist')}",function(data,status){
|
||||
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"}]'
|
||||
),
|
||||
data.data,
|
||||
{},
|
||||
[
|
||||
"#67C23A",
|
||||
|
|
@ -148,8 +147,15 @@
|
|||
"#99CCFF",
|
||||
"#FF9999",
|
||||
"#CC6633",
|
||||
"#67C23A",
|
||||
'#ef5b9c',
|
||||
'#fcaf17',
|
||||
'#009ad6',
|
||||
'#003A8C',
|
||||
'#f36c21'
|
||||
]
|
||||
);
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{ape:advert row="3" type="2"}
|
||||
|
|
|
|||
|
|
@ -217,11 +217,10 @@
|
|||
}
|
||||
</style>
|
||||
<script>
|
||||
var tag = TagCloud(
|
||||
$.get("{:url('/index/article/taglist')}",function(data,status){
|
||||
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"}]'
|
||||
),
|
||||
data.data,
|
||||
{},
|
||||
[
|
||||
"#67C23A",
|
||||
|
|
@ -233,8 +232,15 @@
|
|||
"#99CCFF",
|
||||
"#FF9999",
|
||||
"#CC6633",
|
||||
"#67C23A",
|
||||
'#ef5b9c',
|
||||
'#fcaf17',
|
||||
'#009ad6',
|
||||
'#003A8C',
|
||||
'#f36c21'
|
||||
]
|
||||
);
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{ape:advert row="3" type="2"}
|
||||
|
|
|
|||
|
|
@ -32,10 +32,7 @@
|
|||
</ul>
|
||||
</nav>
|
||||
<div class="footer-info">Copyright © {: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">
|
||||
|
|
|
|||
Loading…
Reference in New Issue