Skip to content

Commit

Permalink
修正sql语句
Browse files Browse the repository at this point in the history
  • Loading branch information
arcxingye committed Feb 8, 2021
1 parent 534789c commit 515fead
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions rank.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@
}
$offset = ($page - 1) * $num;
if ($lbtype == 'day') {
$title = "日榜";
$sql1 = "SELECT * FROM kano1_rank where to_days(time) = to_days(now()) ORDER BY score DESC limit {$offset},{$num};";
$sql2 = "SELECT count(*) FROM kano1_rank where to_days(time) = to_days(now());";
$title = "";
$cond = "to_days(time) = to_days(now())";
}
if ($lbtype == 'week') {
$title = "周榜";
$sql1 = "SELECT * FROM kano1_rank where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(time) ORDER BY score DESC limit {$offset},{$num};";
$sql2 = "SELECT count(*) FROM kano1_rank where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(time);";
$title = "";
$cond = "DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(time)";
}
if ($lbtype == 'month') {
$title = "月榜";
$sql1 = "SELECT * FROM kano1_rank where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(time) ORDER BY score DESC limit {$offset},{$num};";
$sql2 = "SELECT count(*) FROM kano1_rank where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(time)";
$title = "";
$cond = "DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(time)";
}
$filtercond = " ORDER BY score DESC limit {$offset},{$num}";
$sql1="SELECT * FROM kano1_rank where ".$cond.$filtercond;
$sql2="SELECT count(*) FROM kano1_rank where ".$cond;
?>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
Expand All @@ -56,7 +56,7 @@
</ol>
</nav>
<div class="page-header text-center">
<h1>排行榜(<?php echo $title; ?>)</h1>
<h1>排行榜(<?php echo $title; ?>)</h1>
<!-- 顶部广告区 -->
THAC游戏服群(有MC/TR等)<a href="https://qm.qq.com/cgi-bin/qm/qr?k=qF_FKkfuJGsvXotE8nWLJhpjxYB19_o1&jump_from=webapi">180093493</a><br/>
粉丝向游戏请手下留情勿乱搞榜仅供鹿友交流。
Expand Down

0 comments on commit 515fead

Please sign in to comment.