Merge pull request #2 from commurunning/fix/skin/board/character/list-order-sql

Fix list pagination
This commit is contained in:
TATECK 2022-12-30 09:17:57 +09:00 committed by GitHub
commit 0181eca6f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,9 +83,17 @@ if (!$sca) {
$arr_notice = array_filter($arr_notice); $arr_notice = array_filter($arr_notice);
$board_notice_count = count($arr_notice); $board_notice_count = count($arr_notice);
if($board_notice_count > 0) { if($sst == 'wr_id') {
// 전체 목록인 경우, 게시글 개수에서 공지글 제외
$total_count -= $board_notice_count;
}
else if($board_notice_count > 0) {
$pair_str = implode("' or wr_id = '", $arr_notice); $pair_str = implode("' or wr_id = '", $arr_notice);
$pair_str = "wr_id = '".$pair_str."'"; $pair_str = "wr_id = '".$pair_str."'";
// 페어 목록인 경우, 페어 목록만 추출하고 게시글 개수를 공지글로 한정
$pair_str = "({$pair_str}) and wr_type = 'pair'";
$total_count = $board_notice_count;
$pair_sql = " select * from {$write_table} where {$pair_str} order by wr_ing desc, wr_subject asc "; $pair_sql = " select * from {$write_table} where {$pair_str} order by wr_ing desc, wr_subject asc ";
$notice_result = sql_query($pair_sql); $notice_result = sql_query($pair_sql);
@ -153,6 +161,11 @@ if ($sca || $stx) {
$sql = " select * from {$write_table} where wr_is_comment = 0 "; $sql = " select * from {$write_table} where wr_is_comment = 0 ";
if(!empty($notice_array)) if(!empty($notice_array))
$sql .= " and wr_id not in (".implode(', ', $notice_array).") "; $sql .= " and wr_id not in (".implode(', ', $notice_array).") ";
// 전체 목록인 경우, 캐릭터 게시글만 추출. 페어 목록인 경우, 페어 게시글만 추출
if($sst=='wr_id' || $board_notice_count < 1)
$sql .= " and wr_type != 'pair'";
else
$sql .= " and wr_type = 'pair'";
$sql .= " {$sql_order} limit {$from_record}, $page_rows "; $sql .= " {$sql_order} limit {$from_record}, $page_rows ";
} }