diff --git a/app/provider.php b/app/provider.php
index 73d99fa..9e98cbe 100644
--- a/app/provider.php
+++ b/app/provider.php
@@ -6,4 +6,5 @@ use app\Request;
return [
'think\Request' => Request::class,
'think\exception\Handle' => ExceptionHandle::class,
+ 'think\Paginator' => \app\provider\Bootstrap::class,
];
diff --git a/app/provider/Bootstrap.php b/app/provider/Bootstrap.php
index f8b9da2..2c3a33f 100644
--- a/app/provider/Bootstrap.php
+++ b/app/provider/Bootstrap.php
@@ -22,9 +22,7 @@ class Bootstrap extends Paginator
return $this->getDisabledTextWrapper($text);
}
- $url = $this->url(
- $this->currentPage() - 1
- );
+ $url = $this->currentPage - 1;
return $this->getPageLinkWrapper($url, $text);
}
@@ -40,7 +38,7 @@ class Bootstrap extends Paginator
return $this->getDisabledTextWrapper($text);
}
- $url = $this->url($this->currentPage() + 1);
+ $url = $this->currentPage + 1;
return $this->getPageLinkWrapper($url, $text);
}
@@ -65,17 +63,17 @@ class Bootstrap extends Paginator
$window = $side * 2;
if ($this->lastPage < $window + 4) {
- $block['first'] = $this->getUrlRange(1, $this->lastPage);
+ $block['first'] = $this->getPageRange(1, $this->lastPage);
} elseif ($this->currentPage <= $window) {
- $block['first'] = $this->getUrlRange(1, $window + 2);
- $block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage);
+ $block['first'] = $this->getPageRange(1, $window + 2);
+ $block['last'] = $this->getPageRange($this->lastPage - 1, $this->lastPage);
} elseif ($this->currentPage > ($this->lastPage - $window)) {
- $block['first'] = $this->getUrlRange(1, 2);
- $block['last'] = $this->getUrlRange($this->lastPage - ($window + 2), $this->lastPage);
+ $block['first'] = $this->getPageRange(1, 2);
+ $block['last'] = $this->getPageRange($this->lastPage - ($window + 2), $this->lastPage);
} else {
- $block['first'] = $this->getUrlRange(1, 2);
- $block['slider'] = $this->getUrlRange($this->currentPage - $side, $this->currentPage + $side);
- $block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage);
+ $block['first'] = $this->getPageRange(1, 2);
+ $block['slider'] = $this->getPageRange($this->currentPage - $side, $this->currentPage + $side);
+ $block['last'] = $this->getPageRange($this->lastPage - 1, $this->lastPage);
}
$html = '';
@@ -112,7 +110,7 @@ class Bootstrap extends Paginator
);
} else {
return sprintf(
- '
',
+ '',
$this->getPreviousButton(),
$this->getLinks(),
$this->getNextButton()
@@ -130,7 +128,8 @@ class Bootstrap extends Paginator
*/
protected function getAvailablePageWrapper(string $url, string $page): string
{
- return '' . $page . '';
+ return '';
+// return '' . $page . '';
}
/**
@@ -141,7 +140,8 @@ class Bootstrap extends Paginator
*/
protected function getDisabledTextWrapper(string $text): string
{
- return '' . $text . '';
+ return '';
+// return '' . $text . '';
}
/**
@@ -152,7 +152,8 @@ class Bootstrap extends Paginator
*/
protected function getActivePageWrapper(string $text): string
{
- return '' . $text . '';
+ return '';
+// return '' . $text . '';
}
/**
@@ -197,4 +198,15 @@ class Bootstrap extends Paginator
return $this->getAvailablePageWrapper($url, $page);
}
+
+ private function getPageRange(int $start, int $end)
+ {
+ $urls = [];
+
+ for ($page = $start; $page <= $end; $page++) {
+ $urls[$page] = $page;
+ }
+
+ return $urls;
+ }
}
diff --git a/app/service/ContentService.php b/app/service/ContentService.php
index 5658ddb..89fcde6 100644
--- a/app/service/ContentService.php
+++ b/app/service/ContentService.php
@@ -368,6 +368,7 @@ class ContentService {
$order = self::setOrder($param['sort']);
$content = $content -> where($where)->whereIn('id',$subIds)->whereTime('publish_time','<=',time())->order($order);
+
if($param['asPage'] == 1){
$page = request()->param('page');
if($page){
@@ -377,7 +378,7 @@ class ContentService {
if($limit){
$param['limit'] = $limit;
}
-// $query = request()->except(['id','cid','page','limit','']);
+// $query = request()->except(['id','cid','page','limit','','keywords']);
//
// if(!empty($query)){
// $content->where($query);
@@ -472,6 +473,9 @@ class ContentService {
if($param['isCommend'] != 2){
$where['is_recommend'] = 1;
}
+ if (isset($param['keywords']) && !empty($param['keywords'])) {
+ $where[] = ['title', 'like', '%' . $param['keywords'] . '%'];
+ }
return $where;
}
diff --git a/app/taglib/HcTaglib.php b/app/taglib/HcTaglib.php
index 6c4f9dc..6a75948 100644
--- a/app/taglib/HcTaglib.php
+++ b/app/taglib/HcTaglib.php
@@ -690,7 +690,8 @@ parse;
*/
public function tagContentPage($tag, $content): string
{
- $cid = empty($tag['cid']) ? '' : (int)$tag['cid'];
+ $cid = !empty($_GET['cid']) ? $_GET['cid'] : (empty($tag['cid']) ? '' : (int)$tag['cid']);
+ $keywords = empty($_GET['keywords']) ? '' : $_GET['keywords'];
$item = empty($tag['item']) ? 'vo' : $tag['item'];
$mainField = empty($tag['mainField']) ? '*' : $tag['mainField'];
$subField = isset($tag['subField']) ? '*' : '';
@@ -729,6 +730,7 @@ parse;
'sellerId' => {$this->sellerId},
'asPage' => '1',
'onlyData' => '1',
+ 'keywords' => '{$keywords}'
]);
?>
{$content}
@@ -754,6 +756,7 @@ parse;
'sellerId' => {$this->sellerId},
'asPage' => '1',
'onlyData' => '2',
+ 'keywords' => '{$keywords}'
]);
?>
diff --git a/public/themes/dist_static/static/js/download.js b/public/themes/dist_static/static/js/download.js
index e149e0b..09e467f 100644
--- a/public/themes/dist_static/static/js/download.js
+++ b/public/themes/dist_static/static/js/download.js
@@ -42,7 +42,7 @@ $(function() {
};
const buildQueryUrl = ({ tabId = getActiveTabId(), keywords = getKeywords(), page } = {}) => {
const params = new URLSearchParams();
- if (tabId) params.set("tab", tabId);
+ if (tabId) params.set("cid", tabId);
if (keywords) params.set("keywords", keywords);
if (page && Number(page) > 1) params.set("page", String(page));
const query = params.toString();
@@ -122,7 +122,6 @@ $(function() {
});
const searchParams = new URLSearchParams(window.location.search);
const tabParam = searchParams.get("cid");
- const tabParam = searchParams.get("cid");
const keywordsParam = searchParams.get("keywords");
const pageParam = searchParams.get("page");
if (keywordsParam) $("[data-tab-search] [name='keywords']").val(keywordsParam);
diff --git a/public/themes/website/1/zh/demo/download.html b/public/themes/website/1/zh/demo/download.html
index 95f8811..cee8774 100644
--- a/public/themes/website/1/zh/demo/download.html
+++ b/public/themes/website/1/zh/demo/download.html
@@ -1,6 +1,8 @@
+{php}$download_keywords = input('keywords', '');{/php}
+
@@ -61,7 +63,7 @@
diff --git a/public/themes/website/1/zh/demo/news-detail.html b/public/themes/website/1/zh/demo/news-detail.html
index 31b85b5..ee3ea0d 100644
--- a/public/themes/website/1/zh/demo/news-detail.html
+++ b/public/themes/website/1/zh/demo/news-detail.html
@@ -134,12 +134,63 @@