mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-03 17:22:20 +09:00
Make more use of trigger result in updateVotedCount
This commit is contained in:
parent
bf0014a7d9
commit
e7b272f7af
2 changed files with 22 additions and 22 deletions
|
|
@ -189,14 +189,14 @@ class commentController extends comment
|
||||||
$d_args = new stdClass();
|
$d_args = new stdClass();
|
||||||
$args->comment_srl = $d_args->comment_srl = $comment_srl;
|
$args->comment_srl = $d_args->comment_srl = $comment_srl;
|
||||||
$d_args->member_srl = $logged_info->member_srl;
|
$d_args->member_srl = $logged_info->member_srl;
|
||||||
if($point > 0)
|
if ($trigger_obj->update_target === 'voted_count')
|
||||||
{
|
{
|
||||||
$args->voted_count = $oComment->get('voted_count') - $point;
|
$args->voted_count = $trigger_obj->after_point;
|
||||||
$output = executeQuery('comment.updateVotedCount', $args);
|
$output = executeQuery('comment.updateVotedCount', $args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$args->blamed_count = $oComment->get('blamed_count') - $point;
|
$args->blamed_count = $trigger_obj->after_point;
|
||||||
$output = executeQuery('comment.updateBlamedCount', $args);
|
$output = executeQuery('comment.updateBlamedCount', $args);
|
||||||
}
|
}
|
||||||
$d_output = executeQuery('comment.deleteCommentVotedLog', $d_args);
|
$d_output = executeQuery('comment.deleteCommentVotedLog', $d_args);
|
||||||
|
|
@ -1446,31 +1446,32 @@ class commentController extends comment
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
// Update the voted count
|
// Update the voted count
|
||||||
if($point < 0)
|
if($trigger_obj->update_target === 'blamed_count')
|
||||||
{
|
{
|
||||||
// leave into session information
|
// leave into session information
|
||||||
$_SESSION['voted_comment'][$comment_srl] = $point;
|
$args->blamed_count = $trigger_obj->after_point;
|
||||||
$args->blamed_count = $oComment->get('blamed_count') + $point;
|
|
||||||
$output = executeQuery('comment.updateBlamedCount', $args);
|
$output = executeQuery('comment.updateBlamedCount', $args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$_SESSION['voted_comment'][$comment_srl] = $point;
|
$args->voted_count = $trigger_obj->after_point;
|
||||||
$args->voted_count = $oComment->get('voted_count') + $point;
|
|
||||||
$output = executeQuery('comment.updateVotedCount', $args);
|
$output = executeQuery('comment.updateVotedCount', $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// leave logs
|
// leave logs
|
||||||
$args->point = $point;
|
$args->point = $trigger_obj->point;
|
||||||
$output = executeQuery('comment.insertCommentVotedLog', $args);
|
$output = executeQuery('comment.insertCommentVotedLog', $args);
|
||||||
|
|
||||||
|
// Leave in the session information
|
||||||
|
$_SESSION['voted_comment'][$comment_srl] = $trigger_obj->point;
|
||||||
|
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
ModuleHandler::triggerCall('comment.updateVotedCount', 'after', $trigger_obj);
|
ModuleHandler::triggerCall('comment.updateVotedCount', 'after', $trigger_obj);
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
|
|
||||||
// Return the result
|
// Return the result
|
||||||
$output = new BaseObject();
|
$output = new BaseObject();
|
||||||
if($point > 0)
|
if($trigger_obj->update_target === 'voted_count')
|
||||||
{
|
{
|
||||||
$output->setMessage('success_voted');
|
$output->setMessage('success_voted');
|
||||||
$output->add('voted_count', $trigger_obj->after_point);
|
$output->add('voted_count', $trigger_obj->after_point);
|
||||||
|
|
|
||||||
|
|
@ -206,14 +206,14 @@ class documentController extends document
|
||||||
$d_args = new stdClass();
|
$d_args = new stdClass();
|
||||||
$args->document_srl = $d_args->document_srl = $document_srl;
|
$args->document_srl = $d_args->document_srl = $document_srl;
|
||||||
$d_args->member_srl = $logged_info->member_srl;
|
$d_args->member_srl = $logged_info->member_srl;
|
||||||
if($point > 0)
|
if ($trigger_obj->update_target === 'voted_count')
|
||||||
{
|
{
|
||||||
$args->voted_count = $oDocument->get('voted_count') - $point;
|
$args->voted_count = $trigger_obj->after_point;
|
||||||
$output = executeQuery('document.updateVotedCount', $args);
|
$output = executeQuery('document.updateVotedCount', $args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$args->blamed_count = $oDocument->get('blamed_count') - $point;
|
$args->blamed_count = $trigger_obj->after_point;
|
||||||
$output = executeQuery('document.updateBlamedCount', $args);
|
$output = executeQuery('document.updateBlamedCount', $args);
|
||||||
}
|
}
|
||||||
$d_output = executeQuery('document.deleteDocumentVotedLog', $d_args);
|
$d_output = executeQuery('document.deleteDocumentVotedLog', $d_args);
|
||||||
|
|
@ -1473,24 +1473,23 @@ class documentController extends document
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
// Update the voted count
|
// Update the voted count
|
||||||
if($point < 0)
|
if($trigger_obj->update_target === 'blamed_count')
|
||||||
{
|
{
|
||||||
$args->blamed_count = $oDocument->get('blamed_count') + $point;
|
$args->blamed_count = $trigger_obj->after_point;
|
||||||
// Leave in the session information
|
|
||||||
$_SESSION['voted_document'][$document_srl] = $point;
|
|
||||||
$output = executeQuery('document.updateBlamedCount', $args);
|
$output = executeQuery('document.updateBlamedCount', $args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$args->voted_count = $oDocument->get('voted_count') + $point;
|
$args->voted_count = $trigger_obj->after_point;
|
||||||
// Leave in the session information
|
|
||||||
$_SESSION['voted_document'][$document_srl] = $point;
|
|
||||||
$output = executeQuery('document.updateVotedCount', $args);
|
$output = executeQuery('document.updateVotedCount', $args);
|
||||||
}
|
}
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
|
// Leave in the session information
|
||||||
|
$_SESSION['voted_document'][$document_srl] = $trigger_obj->point;
|
||||||
|
|
||||||
// Leave logs
|
// Leave logs
|
||||||
$args->point = $point;
|
$args->point = $trigger_obj->point;
|
||||||
$output = executeQuery('document.insertDocumentVotedLog', $args);
|
$output = executeQuery('document.insertDocumentVotedLog', $args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
|
|
@ -1504,7 +1503,7 @@ class documentController extends document
|
||||||
|
|
||||||
// Return result
|
// Return result
|
||||||
$output = new BaseObject();
|
$output = new BaseObject();
|
||||||
if($point > 0)
|
if($trigger_obj->update_target === 'voted_count')
|
||||||
{
|
{
|
||||||
$output->setMessage('success_voted');
|
$output->setMessage('success_voted');
|
||||||
$output->add('voted_count', $trigger_obj->after_point);
|
$output->add('voted_count', $trigger_obj->after_point);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue