대댓글일경우를 대비해서 로직 변경

This commit is contained in:
BJRambo 2016-09-10 20:29:47 +09:00
parent f56b23e522
commit 5848572bb1
3 changed files with 48 additions and 7 deletions

View file

@ -415,19 +415,31 @@ class ncenterliteController extends ncenterlite
return new Object();
}
$notify_list = $oNcenterliteModel->getNotifyMemberSrlByCommentSrl($obj->comment_srl);
// 대댓글이 2개이상일경우 comment
$member_srls = array();
foreach($notify_list as $value)
{
if(!in_array($value->member_srl, $member_srls))
{
$member_srls[] = $value->member_srl;
}
}
$args = new stdClass();
$args->srl = $obj->comment_srl;
$output = executeQuery('ncenterlite.deleteNotifyBySrl', $args);
if($output->toBool())
{
$oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($obj->document_srl);
//Remove flag files
$flag_path = \RX_BASEDIR . 'files/cache/ncenterlite/new_notify/' . getNumberingPath($oDocument->get('member_srl')) . $oDocument->get('member_srl') . '.php';
if(file_exists($flag_path))
foreach($member_srls as $member_srl)
{
FileHandler::removeFile($flag_path);
//Remove flag files
$flag_path = \RX_BASEDIR . 'files/cache/ncenterlite/new_notify/' . getNumberingPath($member_srl) . $member_srl . '.php';
if(file_exists($flag_path))
{
FileHandler::removeFile($flag_path);
}
}
}

View file

@ -474,4 +474,21 @@ class ncenterliteModel extends ncenterlite
return $output->data;
}
function getNotifyMemberSrlByCommentSrl($comment_srl)
{
if(!$comment_srl === null)
{
return false;
}
$args = new stdClass();
$args->srl = $comment_srl;
$output = executeQueryArray('ncenterlite.getNotifyMemberSrlByCommentSrl', $args);
if(!$output->toBool())
{
return $output;
}
return $output->data;
}
}

View file

@ -0,0 +1,12 @@
<query id="getNotifyMemberSrlBySrl" action="select">
<tables>
<table name="ncenterlite_notify" />
</tables>
<columns>
<column name="member_srl" />
</columns>
<conditions>
<condition operation="equal" column="srl" var="srl" filter="number" notnull="notnull" />
<condition operation="equal" column="target_srl" var="srl" filter="number" notnull="notnull" pipe="or" />
</conditions>
</query>