getNotifyMemberSrlBySrl 에서는 항상 array을 반환시키고 맴버번호 리스트만 처리하도록 개선

This commit is contained in:
BJRambo 2022-10-30 14:08:15 +09:00
parent 7179f9885a
commit 5d84c7fe5b
3 changed files with 25 additions and 36 deletions

View file

@ -872,18 +872,8 @@ class ncenterliteController extends ncenterlite
{
return;
}
$notify_list = ncenterliteModel::getInstance()->getNotifyMemberSrlBySrl($obj->comment_srl);
// 대댓글의 대댓글일 경우 혹은 중복적으로 받는 경우 comment_srl 당 2개이상 notify가 생성될 수 있다.
$member_srls = array();
foreach($notify_list as $value)
{
if(!in_array($value->member_srl, $member_srls))
{
$member_srls[] = $value->member_srl;
}
}
$member_srls = ncenterliteModel::getInstance()->getNotifyMemberSrlBySrl($obj->comment_srl);
$args = new stdClass();
$args->srl = $obj->comment_srl;
@ -905,26 +895,11 @@ class ncenterliteController extends ncenterlite
return;
}
$notify_list = ncenterliteModel::getInstance()->getNotifyMemberSrlBySrl($obj->document_srl);
// 대댓글의 대댓글일 경우 혹은 중복적으로 받는 경우 comment_srl 당 2개이상 notify가 생성될 수 있다.
$member_srls = array();
foreach($notify_list as $value)
{
if(!in_array($value->member_srl, $member_srls))
{
$member_srls[] = $value->member_srl;
}
}
$member_srls = ncenterliteModel::getInstance()->getNotifyMemberSrlBySrl($obj->document_srl);
$args = new stdClass();
$args->srl = $obj->document_srl;
$output = executeQuery('ncenterlite.deleteNotifyBySrl', $args);
if(!$output->toBool())
{
return $output;
}
if($output->toBool())
{
foreach($member_srls as $member_srl)

View file

@ -754,22 +754,33 @@ class ncenterliteModel extends ncenterlite
return $output->data;
}
function getNotifyMemberSrlBySrl($comment_srl)
/**
* 알림에서 member_srl 정리해서 보내준다.
* @param int $srl
* @return array
*/
function getNotifyMemberSrlBySrl(int $srl) : array
{
if(!$comment_srl === null)
if(!$srl)
{
return false;
return [];
}
$args = new stdClass();
$args->srl = $comment_srl;
$args->srl = $srl;
$output = executeQueryArray('ncenterlite.getNotifyMemberSrlBySrl', $args);
if(!$output->toBool())
{
return $output;
return [];
}
$member_srls = array();
foreach($output->data ?? [] as $value)
{
$member_srls[] = $value->member_srl;
}
return $output->data;
return $member_srls;
}
function getUserUnsubscribeConfigByUnsubscribeSrl($unsubscribe_srl = 0)

View file

@ -9,4 +9,7 @@
<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>
<groups>
<group column="member_srl" />
</groups>
</query>