From 605b68001ffb31d1c28cabb33fecafdc27809f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=99=E8=BF=B0=E3=80=81=E5=88=AB=E7=A6=BB?= Date: Tue, 24 Dec 2024 20:18:54 +0800 Subject: [PATCH 1/4] Update listview.class.php --- src/system/archive/listview.class.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/system/archive/listview.class.php b/src/system/archive/listview.class.php index b33bb118..6f821a95 100755 --- a/src/system/archive/listview.class.php +++ b/src/system/archive/listview.class.php @@ -417,12 +417,20 @@ class ListView } //排序方式 $ordersql = ''; - if ($orderby == "senddate" || $orderby == "id") { + if ($orderby == "senddate") { + $ordersql = " ORDER BY arc.senddate $orderWay"; + } else if ($orderby == "pubdate") { + $ordersql = " ORDER BY arc.pubdate $orderWay"; + } else if ($orderby == "id") { $ordersql = " ORDER BY arc.id $orderWay"; } else if ($orderby == "hot" || $orderby == "click") { $ordersql = " ORDER BY arc.click $orderWay"; } else if ($orderby == "lastpost") { $ordersql = " ORDER BY arc.lastpost $orderWay"; + } else if ($orderby == "scores") { + $ordersql = " ORDER BY arc.scores $orderWay"; + } else if ($orderby == "rand") { + $ordersql = " ORDER BY rand() DESC"; } else { $ordersql = " ORDER BY arc.sortrank $orderWay"; } @@ -463,7 +471,7 @@ class ListView $addJoin = ''; } //如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 - if (preg_match('/hot|click|lastpost/', $orderby)) { + if (preg_match('/hot|click|lastpost|rand/', $orderby)) { $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,mb.uname,mb.face,mb.userid $addField FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id LEFT JOIN `#@__member` mb ON arc.mid=mb.mid $addJoin WHERE {$this->addSql} $filtersql $ordersql LIMIT $limitstart,$row"; } //普通情况先从arctiny表查出id,然后按id查询速度非常快 @@ -831,12 +839,20 @@ class ListView } //排序方式 $ordersql = ''; - if ($orderby == "senddate" || $orderby == "id") { + if ($orderby == "senddate") { + $ordersql = " ORDER BY arc.senddate $orderWay"; + } else if ($orderby == "pubdate") { + $ordersql = " ORDER BY arc.pubdate $orderWay"; + } else if ($orderby == "id") { $ordersql = " ORDER BY arc.id $orderWay"; } else if ($orderby == "hot" || $orderby == "click") { $ordersql = " ORDER BY arc.click $orderWay"; } else if ($orderby == "lastpost") { $ordersql = " ORDER BY arc.lastpost $orderWay"; + } else if ($orderby == "scores") { + $ordersql = " ORDER BY arc.scores $orderWay"; + } else if ($orderby == "rand") { + $ordersql = " ORDER BY rand() DESC"; } else { $ordersql = " ORDER BY arc.sortrank $orderWay"; } @@ -877,7 +893,7 @@ class ListView $addJoin = ''; } //如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 - if (preg_match('/hot|click|lastpost/', $orderby)) { + if (preg_match('/hot|click|lastpost|rand/', $orderby)) { $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,mb.uname,mb.face,mb.userid $addField FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id LEFT JOIN `#@__member` mb ON arc.mid=mb.mid $addJoin WHERE {$this->addSql} $filtersql $ordersql LIMIT $limitstart,$row"; } //普通情况先从arctiny表查出id,然后按di查询速度非常快 From 37b9e448502ac52d1725b888f12f0e3c53d39965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=99=E8=BF=B0=E3=80=81=E5=88=AB=E7=A6=BB?= Date: Tue, 24 Dec 2024 20:22:02 +0800 Subject: [PATCH 2/4] Update listview.class.php --- src/system/archive/listview.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/system/archive/listview.class.php b/src/system/archive/listview.class.php index 6f821a95..184ad2f8 100755 --- a/src/system/archive/listview.class.php +++ b/src/system/archive/listview.class.php @@ -430,7 +430,7 @@ class ListView } else if ($orderby == "scores") { $ordersql = " ORDER BY arc.scores $orderWay"; } else if ($orderby == "rand") { - $ordersql = " ORDER BY rand() DESC"; + $ordersql = " ORDER BY rand()"; } else { $ordersql = " ORDER BY arc.sortrank $orderWay"; } @@ -852,7 +852,7 @@ class ListView } else if ($orderby == "scores") { $ordersql = " ORDER BY arc.scores $orderWay"; } else if ($orderby == "rand") { - $ordersql = " ORDER BY rand() DESC"; + $ordersql = " ORDER BY rand()"; } else { $ordersql = " ORDER BY arc.sortrank $orderWay"; } From 53e1df2e6c64d1f6fc8d955eaee829fb148c60bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=99=E8=BF=B0=E3=80=81=E5=88=AB=E7=A6=BB?= Date: Tue, 24 Dec 2024 20:28:31 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/system/archive/sglistview.class.php | 36 +++++++++++++++++++------ src/system/archive/specview.class.php | 8 +++--- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/system/archive/sglistview.class.php b/src/system/archive/sglistview.class.php index 14147fca..ba081be3 100755 --- a/src/system/archive/sglistview.class.php +++ b/src/system/archive/sglistview.class.php @@ -360,12 +360,22 @@ class SgListView if ($orderWay == '') $orderWay = 'desc'; //排序方式 $ordersql = ''; - if ($orderby == 'senddate' || $orderby == 'id') { - $ordersql = " ORDER BY arc.aid $orderWay"; - } else if ($orderby == 'hot' || $orderby == 'click') { + if ($orderby == "senddate") { + $ordersql = " ORDER BY arc.senddate $orderWay"; + } else if ($orderby == "pubdate") { + $ordersql = " ORDER BY arc.pubdate $orderWay"; + } else if ($orderby == "id") { + $ordersql = " ORDER BY arc.id $orderWay"; + } else if ($orderby == "hot" || $orderby == "click") { $ordersql = " ORDER BY arc.click $orderWay"; + } else if ($orderby == "lastpost") { + $ordersql = " ORDER BY arc.lastpost $orderWay"; + } else if ($orderby == "scores") { + $ordersql = " ORDER BY arc.scores $orderWay"; + } else if ($orderby == "rand") { + $ordersql = " ORDER BY rand()"; } else { - $ordersql = " ORDER BY arc.aid $orderWay"; + $ordersql = " ORDER BY arc.sortrank $orderWay"; } $addField = 'arc.'.join(',arc.', $this->ListFields); //如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 @@ -703,12 +713,22 @@ class SgListView if ($innertext == '') $innertext = GetSysTemplets('list_sglist.htm'); //排序方式 $ordersql = ''; - if ($orderby == 'senddate' || $orderby == 'id') { - $ordersql = " ORDER BY arc.aid $orderWay"; - } else if ($orderby == 'hot' || $orderby == 'click') { + if ($orderby == "senddate") { + $ordersql = " ORDER BY arc.senddate $orderWay"; + } else if ($orderby == "pubdate") { + $ordersql = " ORDER BY arc.pubdate $orderWay"; + } else if ($orderby == "id") { + $ordersql = " ORDER BY arc.id $orderWay"; + } else if ($orderby == "hot" || $orderby == "click") { $ordersql = " ORDER BY arc.click $orderWay"; + } else if ($orderby == "lastpost") { + $ordersql = " ORDER BY arc.lastpost $orderWay"; + } else if ($orderby == "scores") { + $ordersql = " ORDER BY arc.scores $orderWay"; + } else if ($orderby == "rand") { + $ordersql = " ORDER BY rand()"; } else { - $ordersql = " ORDER BY arc.aid $orderWay"; + $ordersql = " ORDER BY arc.sortrank $orderWay"; } $addField = 'arc.'.join(',arc.', $this->ListFields); //如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 diff --git a/src/system/archive/specview.class.php b/src/system/archive/specview.class.php index 478c4858..5f24c7c7 100755 --- a/src/system/archive/specview.class.php +++ b/src/system/archive/specview.class.php @@ -318,13 +318,13 @@ class SpecView //排序方式 $ordersql = ''; if ($orderby == 'senddate') { - $ordersql = " ORDER BY arc.senddate desc"; + $ordersql = " ORDER BY arc.senddate DESC"; } else if ($orderby == 'pubdate') { - $ordersql = " ORDER BY arc.pubdate desc"; + $ordersql = " ORDER BY arc.pubdate DESC"; } else if ($orderby == 'id') { - $ordersql = " ORDER BY arc.id desc"; + $ordersql = " ORDER BY arc.id DESC"; } else { - $ordersql = " ORDER BY arc.sortrank desc"; + $ordersql = " ORDER BY arc.sortrank DESC"; } $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,arc.money,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,mb.uname,mb.face,mb.userid FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id LEFT JOIN `#@__member` mb on arc.mid = mb.mid WHERE $orwhere $ordersql LIMIT $limitstart,$row "; $this->dsql->SetQuery($query); From 56eeb2ceda2f7f390ea85ab79519c193414bb89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=99=E8=BF=B0=E3=80=81=E5=88=AB=E7=A6=BB?= Date: Wed, 25 Dec 2024 10:33:23 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/system/archive/listview.class.php | 4 ++-- src/system/archive/searchview.class.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/system/archive/listview.class.php b/src/system/archive/listview.class.php index 184ad2f8..f9abfe1b 100755 --- a/src/system/archive/listview.class.php +++ b/src/system/archive/listview.class.php @@ -471,7 +471,7 @@ class ListView $addJoin = ''; } //如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 - if (preg_match('/hot|click|lastpost|rand/', $orderby)) { + if (preg_match('/senddate|pubdate|hot|click|lastpost|rand/', $orderby)) { $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,mb.uname,mb.face,mb.userid $addField FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id LEFT JOIN `#@__member` mb ON arc.mid=mb.mid $addJoin WHERE {$this->addSql} $filtersql $ordersql LIMIT $limitstart,$row"; } //普通情况先从arctiny表查出id,然后按id查询速度非常快 @@ -893,7 +893,7 @@ class ListView $addJoin = ''; } //如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 - if (preg_match('/hot|click|lastpost|rand/', $orderby)) { + if (preg_match('/senddate|pubdate|hot|click|lastpost|rand/', $orderby)) { $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,mb.uname,mb.face,mb.userid $addField FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id LEFT JOIN `#@__member` mb ON arc.mid=mb.mid $addJoin WHERE {$this->addSql} $filtersql $ordersql LIMIT $limitstart,$row"; } //普通情况先从arctiny表查出id,然后按di查询速度非常快 diff --git a/src/system/archive/searchview.class.php b/src/system/archive/searchview.class.php index a73516d2..abba8b92 100755 --- a/src/system/archive/searchview.class.php +++ b/src/system/archive/searchview.class.php @@ -512,19 +512,19 @@ class SearchView $ordersql = ''; if ($this->ChannelType < 0 || $this->ChannelTypeid < 0) { if ($orderby == "id") { - $ordersql = "ORDER BY arc.aid desc"; + $ordersql = "ORDER BY arc.aid DESC"; } else { - $ordersql = "ORDER BY arc.senddate desc"; + $ordersql = "ORDER BY arc.senddate DESC"; } } else { if ($orderby == "senddate") { - $ordersql = " ORDER BY arc.senddate desc"; + $ordersql = " ORDER BY arc.senddate DESC"; } else if ($orderby == "pubdate") { - $ordersql = " ORDER BY arc.pubdate desc"; + $ordersql = " ORDER BY arc.pubdate DESC"; } else if ($orderby == "id") { - $ordersql = " ORDER BY arc.id desc"; + $ordersql = " ORDER BY arc.id DESC"; } else { - $ordersql = " ORDER BY arc.sortrank desc"; + $ordersql = " ORDER BY arc.sortrank DESC"; } } //搜索