From 876534a4409b7a61293b0c8429b2ea85d8d5b044 Mon Sep 17 00:00:00 2001 From: thisgun Date: Wed, 16 Aug 2023 13:01:05 +0900 Subject: [PATCH] =?UTF-8?q?wr=5Fnum=20=ED=95=84=EB=93=9C=20=EA=B0=92?= =?UTF-8?q?=EC=9D=B4=20=EB=8F=99=EC=8B=9C=EC=84=B1=20=EB=AC=B8=EC=A0=9C?= =?UTF-8?q?=EB=A1=9C=20=EA=B2=B9=EC=B9=98=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=EB=8B=B5=EB=B3=80=EA=B8=80=EC=97=90=20=EB=8C=80=ED=95=9C=20?= =?UTF-8?q?=EA=B6=8C=ED=95=9C=EC=9D=B4=20=EC=9E=98=EB=AA=BB=20=EC=A3=BC?= =?UTF-8?q?=EC=96=B4=EC=A7=80=EB=8A=94=20=EB=93=B1=EC=9D=98=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20#265?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/move_update.php | 10 ++++++++-- bbs/write_update.php | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bbs/move_update.php b/bbs/move_update.php index 99265fb8c..902249b4c 100644 --- a/bbs/move_update.php +++ b/bbs/move_update.php @@ -49,7 +49,9 @@ while ($row = sql_fetch_array($result)) $count_write = 0; $count_comment = 0; - $next_wr_num = get_next_num($move_write_table); + // get_next_num 함수는 mysql 지연시 중복이 될수 있는 문제로 더 이상 사용하지 않습니다. + // $next_wr_num = get_next_num($move_write_table); + $next_wr_num = 0; $sql2 = " select * from $write_table where wr_num = '$wr_num' order by wr_parent, wr_is_comment, wr_comment desc, wr_id "; $result2 = sql_query($sql2); @@ -120,6 +122,10 @@ while ($row = sql_fetch_array($result)) // 코멘트가 아니라면 if (!$row2['wr_is_comment']) { + if (! $row2['wr_reply']) { + $next_wr_num = -$insert_id; + } + $save_parent = $insert_id; $sql3 = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' order by bf_no "; @@ -200,7 +206,7 @@ while ($row = sql_fetch_array($result)) } } - sql_query(" update $move_write_table set wr_parent = '$save_parent' where wr_id = '$insert_id' "); + sql_query(" update $move_write_table set wr_parent = '$save_parent', wr_num = '$next_wr_num' where wr_id = '$insert_id' "); if ($sw == 'move') $save[$cnt]['wr_id'] = $row2['wr_parent']; diff --git a/bbs/write_update.php b/bbs/write_update.php index 29daa0046..d6d47647a 100644 --- a/bbs/write_update.php +++ b/bbs/write_update.php @@ -252,7 +252,9 @@ if ($w == '' || $w == 'r') { $wr_num = $write['wr_num']; $wr_reply = $reply; } else { - $wr_num = get_next_num($write_table); + // get_next_num 함수는 mysql 지연시 중복이 될수 있는 문제로 더 이상 사용하지 않습니다. + // $wr_num = get_next_num($write_table); + $wr_num = 0; $wr_reply = ''; } @@ -294,8 +296,10 @@ if ($w == '' || $w == 'r') { $wr_id = sql_insert_id(); + $add_wr_update_sql = ($wr_num === 0) ? ", wr_num = '-$wr_id' " : ""; + // 부모 아이디에 UPDATE - sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' "); + sql_query(" update $write_table set wr_parent = '$wr_id' $add_wr_update_sql where wr_id = '$wr_id' "); // 새글 INSERT sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) ");