mirror of https://github.com/1099438829/apeblog
修正相关内容
This commit is contained in:
parent
73505e1431
commit
fc02fa7a43
|
|
@ -17,6 +17,8 @@ class Ape extends TagLib{
|
||||||
'advert'=> ['attr' => 'type,row,void', 'close' => 1],
|
'advert'=> ['attr' => 'type,row,void', 'close' => 1],
|
||||||
'sql'=> ['attr' => 'sql', 'close' => 1],
|
'sql'=> ['attr' => 'sql', 'close' => 1],
|
||||||
'article'=> ['attr' => 'id,void,model', 'close' => 1],
|
'article'=> ['attr' => 'id,void,model', 'close' => 1],
|
||||||
|
'comment'=> ['attr' => 'id,void,orderby,pagesize', 'close' => 1],
|
||||||
|
'relevant'=> ['attr' => 'id,model,void,row', 'close' => 1],
|
||||||
'tags'=> ['attr' => 'tags,void', 'close' => 1],
|
'tags'=> ['attr' => 'tags,void', 'close' => 1],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -180,7 +182,7 @@ class Ape extends TagLib{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* poster
|
* tagBanner
|
||||||
*/
|
*/
|
||||||
public function tagBanner($tag,$content)
|
public function tagBanner($tag,$content)
|
||||||
{
|
{
|
||||||
|
|
@ -280,4 +282,55 @@ class Ape extends TagLib{
|
||||||
return $parse;
|
return $parse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章回复列表
|
||||||
|
* @param $tag
|
||||||
|
* @param $content
|
||||||
|
* @return bool|string
|
||||||
|
* @author 李玉坤
|
||||||
|
* @date 2021-11-27 23:44
|
||||||
|
*/
|
||||||
|
public function tagComment($tag,$content)
|
||||||
|
{
|
||||||
|
if(!isset($tag['id'])){
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
$documentId = $tag['id'];
|
||||||
|
$void=isset($tag['void'])?$tag['void']:'field';
|
||||||
|
$orderBy=isset($tag['orderby'])?$tag['orderby']:'sort asc,create_time desc';
|
||||||
|
$pageSize=isset($tag['pagesize'])?$tag['pagesize']:15;
|
||||||
|
$parse = '<?php ';
|
||||||
|
$parse .= '$__TAG_LIST__ ='."tpl_get_comment_list($documentId,$orderBy,$pageSize);";
|
||||||
|
$parse .= ' ?>';
|
||||||
|
$parse .= '{volist name="$__LIST__" id="'.$void.'"}';
|
||||||
|
$parse .= $content;
|
||||||
|
$parse .= '{/volist}';
|
||||||
|
return $parse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章推荐列表
|
||||||
|
* @param $tag
|
||||||
|
* @param $content
|
||||||
|
* @return string
|
||||||
|
* @author 李玉坤
|
||||||
|
* @date 2021-11-28 0:52
|
||||||
|
*/
|
||||||
|
public function tagRelevant($tag,$content)
|
||||||
|
{
|
||||||
|
if(!isset($tag['id'])){
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
$documentId = $tag['id'];
|
||||||
|
$void=isset($tag['void'])?$tag['void']:'field';
|
||||||
|
$row=isset($tag['row'])?$tag['row']:100;
|
||||||
|
$model=isset($tag['model'])?$tag['model']:'article';
|
||||||
|
$parse = '<?php ';
|
||||||
|
$parse .= '$__LIST__ ='."tpl_get_relevant_list($documentId,$row,'$model');";
|
||||||
|
$parse .= ' ?>';
|
||||||
|
$parse .= '{volist name="$__LIST__" id="'.$void.'"}';
|
||||||
|
$parse .= $content;
|
||||||
|
$parse .= '{/volist}';
|
||||||
|
return $parse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -282,7 +282,6 @@ function tpl_get_prenext($get, $cid = false, $none)
|
||||||
if (!$get) {
|
if (!$get) {
|
||||||
$get = 'next';
|
$get = 'next';
|
||||||
}
|
}
|
||||||
|
|
||||||
$document = Document::where('display', 1)->where('status', 1);
|
$document = Document::where('display', 1)->where('status', 1);
|
||||||
$document = $get == 'pre' ? $document->where("id", '<', $id) : $document->where("id", '>', $id);
|
$document = $get == 'pre' ? $document->where("id", '<', $id) : $document->where("id", '>', $id);
|
||||||
|
|
||||||
|
|
@ -664,6 +663,88 @@ function tpl_get_position($dc, $positionList = array())
|
||||||
return tpl_get_position($parentDc, $positionList);
|
return tpl_get_position($parentDc, $positionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文章评论列表
|
||||||
|
* @param $documentId
|
||||||
|
* @param $orderBy
|
||||||
|
* @param $pageSize
|
||||||
|
* @return array
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @author 李玉坤
|
||||||
|
* @date 2021-11-28 0:51
|
||||||
|
*/
|
||||||
|
function tpl_get_comment_list($documentId,$orderBy, $pageSize)
|
||||||
|
{
|
||||||
|
$commentList = \app\common\model\Comment::where('document_id',$documentId)->where('status', 1)->order($orderBy);
|
||||||
|
//获取当前请求的请求参数,以确定分页是否要带上这些请求参数
|
||||||
|
$query = request()->query();
|
||||||
|
if ($query) {
|
||||||
|
$commentList = $commentList->paginate($pageSize, false, ['query' => getRouteQuery()]);
|
||||||
|
} else {
|
||||||
|
$commentList = $commentList->paginate($pageSize);
|
||||||
|
}
|
||||||
|
$lists = [];
|
||||||
|
foreach ($commentList as $key => $item) {
|
||||||
|
//生成文章url
|
||||||
|
$item['url'] = aurl($item);
|
||||||
|
$lists[$key] = $item;
|
||||||
|
}
|
||||||
|
$re = [
|
||||||
|
'model' => $commentList,
|
||||||
|
'lists' => $lists
|
||||||
|
];
|
||||||
|
return $re;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文章相关文章
|
||||||
|
* @param $documentId
|
||||||
|
* @param $row
|
||||||
|
* @param string $table
|
||||||
|
* @return Document[]|array|\think\Collection
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @author 李玉坤
|
||||||
|
* @date 2021-11-28 1:02
|
||||||
|
*/
|
||||||
|
function tpl_get_relevant_list($documentId, $row, $table = 'article')
|
||||||
|
{
|
||||||
|
$count = Document::where('type',$table)
|
||||||
|
->where('status', 1)->count(); //获取总记录数
|
||||||
|
$id = (new Document())->getPK();
|
||||||
|
$min = Document::where('type',$table)
|
||||||
|
->where('status', 1)->min($id); //统计某个字段最小数据
|
||||||
|
if($count < $row){$row = $count;}
|
||||||
|
$i = 1;
|
||||||
|
$flag = 0;
|
||||||
|
$ary = array();
|
||||||
|
while($i<=$row){
|
||||||
|
$rundnum = rand($min, $count);//抽取随机数
|
||||||
|
if($flag != $rundnum){
|
||||||
|
//过滤重复
|
||||||
|
if(!in_array($rundnum,$ary)){
|
||||||
|
$ary[] = $rundnum;
|
||||||
|
$flag = $rundnum;
|
||||||
|
}else{
|
||||||
|
$i--;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$relevantList = Document::where('type',$table)
|
||||||
|
->where('status', 1)
|
||||||
|
->where( $id,'<>',$documentId)
|
||||||
|
->where($id,'in',$ary)
|
||||||
|
->limit($row)->select();
|
||||||
|
$lists = [];
|
||||||
|
foreach ($relevantList as $key => $item) {
|
||||||
|
//生成文章url
|
||||||
|
$item['url'] = aurl($item);
|
||||||
|
$lists[$key] = $item;
|
||||||
|
}
|
||||||
|
return $relevantList;
|
||||||
|
}
|
||||||
|
|
||||||
//获取顶级栏目名
|
//获取顶级栏目名
|
||||||
function GetTopTypename($id = false)
|
function GetTopTypename($id = false)
|
||||||
|
|
@ -796,4 +877,5 @@ function ismobile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="post-turn-page post-turn-page-next" >
|
<div class="post-turn-page post-turn-page-next" >
|
||||||
{ape:prenext get="next" cid="$apeField['category_id']"}
|
{ape:prenext get="next" cid="$id"}
|
||||||
<div class="post-turn-page-main">
|
<div class="post-turn-page-main">
|
||||||
<a href="{:url('/index/article/detail')}?id={$field['id']}">{$field['title']}</a>
|
<a href="{:url('/index/article/detail')}?id={$field['id']}">{$field['title']}</a>
|
||||||
<div class="post-turn-page-link-next">
|
<div class="post-turn-page-link-next">
|
||||||
|
|
@ -209,18 +209,13 @@
|
||||||
<div class="plane-title">相关内容</div>
|
<div class="plane-title">相关内容</div>
|
||||||
<div>
|
<div>
|
||||||
<ul class="relevant-list">
|
<ul class="relevant-list">
|
||||||
<li><a href="../oracle-ebs-pl-sql-ar-receipt-detail/index.html">oracle-EBS-PL/sql AR
|
{ape:relevant row="5" id="$apeField['id']"}
|
||||||
收款的核销明细</a></li>
|
<li><a href="{$field['url']}">{$field['title']}</a></li>
|
||||||
<li><a href="../oracle-ebs-pl-sql-ap-aging/index.html">oracle-EBS-PL/sql AP 供应商的未清余额明细AP
|
{/ape:relevant}
|
||||||
AGING</a></li>
|
|
||||||
<li><a href="../oracle-ebs-pl-sql-ap-podetial/index.html">oracle-EBS-PL/sql AP
|
|
||||||
发票中匹配的po明细按发票</a></li>
|
|
||||||
<li><a href="../oracle-ebs-pl-sql-ap-pomatchdetails/index.html">oracle-EBS-PL/sql AP
|
|
||||||
发票中匹配的po明细</a></li>
|
|
||||||
<li><a href="">oracle-EBS-AP应付采购单匹配付款经历主要表(多图)</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{if web_config('comment_close') ==1}
|
||||||
<div id="comments" class="responsesWrapper">
|
<div id="comments" class="responsesWrapper">
|
||||||
<div class="reply-title">发表评论</div>
|
<div class="reply-title">发表评论</div>
|
||||||
<div id="respond" class="comment-respond">
|
<div id="respond" class="comment-respond">
|
||||||
|
|
@ -407,6 +402,7 @@
|
||||||
</script>
|
</script>
|
||||||
<nav class="comment-navigation pages"></nav>
|
<nav class="comment-navigation pages"></nav>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<div class="sidebar-box-list">
|
<div class="sidebar-box-list">
|
||||||
|
|
|
||||||
|
|
@ -209,15 +209,9 @@
|
||||||
<div class="plane-title">相关内容</div>
|
<div class="plane-title">相关内容</div>
|
||||||
<div>
|
<div>
|
||||||
<ul class="relevant-list">
|
<ul class="relevant-list">
|
||||||
<li><a href="../oracle-ebs-pl-sql-ar-receipt-detail/index.html">oracle-EBS-PL/sql AR
|
{ape:relevant row="5" id="$apeField['id']"}
|
||||||
收款的核销明细</a></li>
|
<li><a href="{$field['url']}">{$field['title']}</a></li>
|
||||||
<li><a href="../oracle-ebs-pl-sql-ap-aging/index.html">oracle-EBS-PL/sql AP 供应商的未清余额明细AP
|
{/ape:relevant}
|
||||||
AGING</a></li>
|
|
||||||
<li><a href="../oracle-ebs-pl-sql-ap-podetial/index.html">oracle-EBS-PL/sql AP
|
|
||||||
发票中匹配的po明细按发票</a></li>
|
|
||||||
<li><a href="../oracle-ebs-pl-sql-ap-pomatchdetails/index.html">oracle-EBS-PL/sql AP
|
|
||||||
发票中匹配的po明细</a></li>
|
|
||||||
<li><a href="">oracle-EBS-AP应付采购单匹配付款经历主要表(多图)</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue