기존 방식 롤백한뒤 에러 코드를 이용하여 찾지 못하는 경우 -2 에러코드를 리턴 시킴

This commit is contained in:
Johnny 2022-03-24 23:07:06 +09:00
parent b4b1188081
commit 2788392060
2 changed files with 7 additions and 15 deletions

View file

@ -223,12 +223,14 @@ class commentAdminController extends comment
} }
$output = $oCommentController->deleteComment($comment_srl, TRUE, toBool($isTrash)); $output = $oCommentController->deleteComment($comment_srl, TRUE, toBool($isTrash));
if(!$output->toBool()) if($output->error !== -2)
{ {
$oDB->rollback(); if(!$output->toBool())
return $output; {
$oDB->rollback();
return $output;
}
} }
$deleted_count++; $deleted_count++;
} }

View file

@ -11,8 +11,6 @@
*/ */
class commentController extends comment class commentController extends comment
{ {
private $deleteCommentSrls = array();
/** /**
* Initialization * Initialization
* @return void * @return void
@ -1050,15 +1048,9 @@ class commentController extends comment
// check if comment already exists // check if comment already exists
$comment = CommentModel::getComment($comment_srl); $comment = CommentModel::getComment($comment_srl);
// 이미 삭제한 댓글을 다시 삭제를 실행할 의무는 없으므로 넘겨버림.
if($this->deleteCommentSrls[$comment_srl])
{
return new BaseObject();
}
if(!$comment->isExists()) if(!$comment->isExists())
{ {
return new BaseObject(-1, 'msg_not_founded'); return new BaseObject(-2, 'msg_not_founded');
} }
if(!$is_admin && !$comment->isGranted()) if(!$is_admin && !$comment->isGranted())
{ {
@ -1189,8 +1181,6 @@ class commentController extends comment
// Remove the thumbnail file // Remove the thumbnail file
Rhymix\Framework\Storage::deleteDirectory(RX_BASEDIR . sprintf('files/thumbnails/%s', getNumberingPath($comment_srl, 3))); Rhymix\Framework\Storage::deleteDirectory(RX_BASEDIR . sprintf('files/thumbnails/%s', getNumberingPath($comment_srl, 3)));
$this->deleteCommentSrls[$comment_srl] = true;
// commit // commit
$oDB->commit(); $oDB->commit();