@@ -417,12 +417,20 @@ class ListView | |||||
} | } | ||||
//排序方式 | //排序方式 | ||||
$ordersql = ''; | $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"; | $ordersql = " ORDER BY arc.id $orderWay"; | ||||
} else if ($orderby == "hot" || $orderby == "click") { | } else if ($orderby == "hot" || $orderby == "click") { | ||||
$ordersql = " ORDER BY arc.click $orderWay"; | $ordersql = " ORDER BY arc.click $orderWay"; | ||||
} else if ($orderby == "lastpost") { | } else if ($orderby == "lastpost") { | ||||
$ordersql = " ORDER BY arc.lastpost $orderWay"; | $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 { | } else { | ||||
$ordersql = " ORDER BY arc.sortrank $orderWay"; | $ordersql = " ORDER BY arc.sortrank $orderWay"; | ||||
} | } | ||||
@@ -463,7 +471,7 @@ class ListView | |||||
$addJoin = ''; | $addJoin = ''; | ||||
} | } | ||||
//如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 | //如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 | ||||
if (preg_match('/hot|click|lastpost/', $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"; | $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查询速度非常快 | //普通情况先从arctiny表查出id,然后按id查询速度非常快 | ||||
@@ -831,12 +839,20 @@ class ListView | |||||
} | } | ||||
//排序方式 | //排序方式 | ||||
$ordersql = ''; | $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"; | $ordersql = " ORDER BY arc.id $orderWay"; | ||||
} else if ($orderby == "hot" || $orderby == "click") { | } else if ($orderby == "hot" || $orderby == "click") { | ||||
$ordersql = " ORDER BY arc.click $orderWay"; | $ordersql = " ORDER BY arc.click $orderWay"; | ||||
} else if ($orderby == "lastpost") { | } else if ($orderby == "lastpost") { | ||||
$ordersql = " ORDER BY arc.lastpost $orderWay"; | $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 { | } else { | ||||
$ordersql = " ORDER BY arc.sortrank $orderWay"; | $ordersql = " ORDER BY arc.sortrank $orderWay"; | ||||
} | } | ||||
@@ -877,7 +893,7 @@ class ListView | |||||
$addJoin = ''; | $addJoin = ''; | ||||
} | } | ||||
//如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 | //如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 | ||||
if (preg_match('/hot|click|lastpost/', $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"; | $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查询速度非常快 | //普通情况先从arctiny表查出id,然后按di查询速度非常快 | ||||
@@ -512,19 +512,19 @@ class SearchView | |||||
$ordersql = ''; | $ordersql = ''; | ||||
if ($this->ChannelType < 0 || $this->ChannelTypeid < 0) { | if ($this->ChannelType < 0 || $this->ChannelTypeid < 0) { | ||||
if ($orderby == "id") { | if ($orderby == "id") { | ||||
$ordersql = "ORDER BY arc.aid desc"; | |||||
$ordersql = "ORDER BY arc.aid DESC"; | |||||
} else { | } else { | ||||
$ordersql = "ORDER BY arc.senddate desc"; | |||||
$ordersql = "ORDER BY arc.senddate DESC"; | |||||
} | } | ||||
} else { | } else { | ||||
if ($orderby == "senddate") { | if ($orderby == "senddate") { | ||||
$ordersql = " ORDER BY arc.senddate desc"; | |||||
$ordersql = " ORDER BY arc.senddate DESC"; | |||||
} else if ($orderby == "pubdate") { | } else if ($orderby == "pubdate") { | ||||
$ordersql = " ORDER BY arc.pubdate desc"; | |||||
$ordersql = " ORDER BY arc.pubdate DESC"; | |||||
} else if ($orderby == "id") { | } else if ($orderby == "id") { | ||||
$ordersql = " ORDER BY arc.id desc"; | |||||
$ordersql = " ORDER BY arc.id DESC"; | |||||
} else { | } else { | ||||
$ordersql = " ORDER BY arc.sortrank desc"; | |||||
$ordersql = " ORDER BY arc.sortrank DESC"; | |||||
} | } | ||||
} | } | ||||
//搜索 | //搜索 | ||||
@@ -360,12 +360,22 @@ class SgListView | |||||
if ($orderWay == '') $orderWay = 'desc'; | if ($orderWay == '') $orderWay = 'desc'; | ||||
//排序方式 | //排序方式 | ||||
$ordersql = ''; | $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"; | $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 { | } else { | ||||
$ordersql = " ORDER BY arc.aid $orderWay"; | |||||
$ordersql = " ORDER BY arc.sortrank $orderWay"; | |||||
} | } | ||||
$addField = 'arc.'.join(',arc.', $this->ListFields); | $addField = 'arc.'.join(',arc.', $this->ListFields); | ||||
//如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 | //如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 | ||||
@@ -703,12 +713,22 @@ class SgListView | |||||
if ($innertext == '') $innertext = GetSysTemplets('list_sglist.htm'); | if ($innertext == '') $innertext = GetSysTemplets('list_sglist.htm'); | ||||
//排序方式 | //排序方式 | ||||
$ordersql = ''; | $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"; | $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 { | } else { | ||||
$ordersql = " ORDER BY arc.aid $orderWay"; | |||||
$ordersql = " ORDER BY arc.sortrank $orderWay"; | |||||
} | } | ||||
$addField = 'arc.'.join(',arc.', $this->ListFields); | $addField = 'arc.'.join(',arc.', $this->ListFields); | ||||
//如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 | //如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢 | ||||
@@ -318,13 +318,13 @@ class SpecView | |||||
//排序方式 | //排序方式 | ||||
$ordersql = ''; | $ordersql = ''; | ||||
if ($orderby == 'senddate') { | if ($orderby == 'senddate') { | ||||
$ordersql = " ORDER BY arc.senddate desc"; | |||||
$ordersql = " ORDER BY arc.senddate DESC"; | |||||
} else if ($orderby == 'pubdate') { | } else if ($orderby == 'pubdate') { | ||||
$ordersql = " ORDER BY arc.pubdate desc"; | |||||
$ordersql = " ORDER BY arc.pubdate DESC"; | |||||
} else if ($orderby == 'id') { | } else if ($orderby == 'id') { | ||||
$ordersql = " ORDER BY arc.id desc"; | |||||
$ordersql = " ORDER BY arc.id DESC"; | |||||
} else { | } 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 "; | $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); | $this->dsql->SetQuery($query); | ||||