mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 00:02:21 +09:00
Fix multiple queries for document/comment vote count
This commit is contained in:
parent
4f821bca85
commit
c227d188a7
6 changed files with 62 additions and 12 deletions
|
|
@ -1227,7 +1227,7 @@ class commentController extends comment
|
|||
// invalid vote if both ip addresses between author's and the current user are same.
|
||||
if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
|
||||
{
|
||||
$_SESSION['voted_comment'][$comment_srl] = TRUE;
|
||||
$_SESSION['voted_comment'][$comment_srl] = false;
|
||||
return new Object(-1, $failed_voted);
|
||||
}
|
||||
|
||||
|
|
@ -1241,7 +1241,7 @@ class commentController extends comment
|
|||
// session registered if the author information matches to the current logged-in user's.
|
||||
if($member_srl && $member_srl == $oComment->get('member_srl'))
|
||||
{
|
||||
$_SESSION['voted_comment'][$comment_srl] = TRUE;
|
||||
$_SESSION['voted_comment'][$comment_srl] = false;
|
||||
return new Object(-1, $failed_voted);
|
||||
}
|
||||
}
|
||||
|
|
@ -1264,7 +1264,7 @@ class commentController extends comment
|
|||
// session registered if log info contains recommendation vote log.
|
||||
if($output->data->count)
|
||||
{
|
||||
$_SESSION['voted_comment'][$comment_srl] = TRUE;
|
||||
$_SESSION['voted_comment'][$comment_srl] = false;
|
||||
return new Object(-1, $failed_voted);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -284,12 +284,13 @@ class commentItem extends Object
|
|||
function getVote()
|
||||
{
|
||||
if(!$this->comment_srl) return false;
|
||||
if($_SESSION['voted_comment'][$this->comment_srl])
|
||||
if(isset($_SESSION['voted_comment'][$this->comment_srl]))
|
||||
{
|
||||
return $_SESSION['voted_comment'][$this->comment_srl];
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info->member_srl) return false;
|
||||
|
||||
$args = new stdClass();
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
|
|
@ -298,10 +299,10 @@ class commentItem extends Object
|
|||
|
||||
if($output->data->point)
|
||||
{
|
||||
return $output->data->point;
|
||||
return $_SESSION['voted_comment'][$this->comment_srl] = $output->data->point;
|
||||
}
|
||||
|
||||
return false;
|
||||
return $_SESSION['voted_comment'][$this->comment_srl] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
13
modules/comment/queries/getCommentVotedLogMulti.xml
Normal file
13
modules/comment/queries/getCommentVotedLogMulti.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<query id="getCommentVotedLog" action="select">
|
||||
<tables>
|
||||
<table name="comment_voted_log" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="comment_srl" />
|
||||
<column name="point" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="in" column="comment_srl" var="comment_srls" filter="number" notnull="notnull" />
|
||||
<condition operation="equal" column="member_srl" var="member_srl" filter="number" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
Loading…
Add table
Add a link
Reference in a new issue