mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 20:12:14 +09:00
추천/비추천 인식 방법을 변경하고 그에 맞게 코드 변경
This commit is contained in:
parent
1ba633ff83
commit
43a6caeb36
5 changed files with 42 additions and 12 deletions
|
|
@ -85,7 +85,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a cond="$oDocument->getVoted() === false" href="#" onclick="doCallModuleAction('document','procDocumentVoteUp','{$oDocument->document_srl}');return false;"|cond="$is_logged" class="voted"> <i class="xi-thumbs-up"></i><br>{$lang->cmd_vote} {$oDocument->get('voted_count')}</a>
|
<a cond="$oDocument->getVoted() === false" href="#" onclick="doCallModuleAction('document','procDocumentVoteUp','{$oDocument->document_srl}');return false;"|cond="$is_logged" class="voted"> <i class="xi-thumbs-up"></i><br>{$lang->cmd_vote} {$oDocument->get('voted_count')}</a>
|
||||||
<a cond="$oDocument->getVoted() !== false" href="#" onclick="doCallModuleAction('document','procDocumentVoteUpCancel','{$oDocument->document_srl}');return false;"|cond="$is_logged" class="voted"> <i class="xi-thumbs-up"></i><br>{$lang->cmd_vote} {$oDocument->get('voted_count')}</a>
|
<a cond="$oDocument->getVoted() === 'voted'" href="#" onclick="doCallModuleAction('document','procDocumentVoteUpCancel','{$oDocument->document_srl}');return false;"|cond="$is_logged" class="voted"> <i class="xi-thumbs-up"></i><br>{$lang->cmd_vote} {$oDocument->get('voted_count')}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -57,15 +57,18 @@ class documentController extends document
|
||||||
{
|
{
|
||||||
return new Object(-1, 'msg_document_voted_cancel_not');
|
return new Object(-1, 'msg_document_voted_cancel_not');
|
||||||
}
|
}
|
||||||
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$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;
|
||||||
$args->voted_count = $oDocument->get('voted_count') - 1;
|
$args->voted_count = $oDocument->get('voted_count') - 1;
|
||||||
$output = executeQuery('document.updateVotedCount', $args);
|
$output = executeQuery('document.updateVotedCount', $args);
|
||||||
$d_output = executeQuery('document.deleteDocumentVotedLog', $d_args);
|
$d_output = executeQuery('document.deleteDocumentVotedLog', $d_args);
|
||||||
//session reset
|
//session reset
|
||||||
$_SESSION['voted_document'][$document_srl] = false;
|
$_SESSION['voted_document'][$document_srl] = false;
|
||||||
|
|
||||||
$output->setMessage('success_voted_canceled');
|
$output->setMessage('success_voted_canceled');
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
@ -1201,7 +1204,7 @@ class documentController extends document
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use member_srl for logged-in members and IP address for non-members.
|
// Use member_srl for logged-in members and IP address for non-members.
|
||||||
$args = new stdClass;
|
$args = new stdClass();
|
||||||
if($member_srl)
|
if($member_srl)
|
||||||
{
|
{
|
||||||
$args->member_srl = $member_srl;
|
$args->member_srl = $member_srl;
|
||||||
|
|
@ -1227,11 +1230,15 @@ class documentController extends document
|
||||||
if($point < 0)
|
if($point < 0)
|
||||||
{
|
{
|
||||||
$args->blamed_count = $oDocument->get('blamed_count') + $point;
|
$args->blamed_count = $oDocument->get('blamed_count') + $point;
|
||||||
|
// Leave in the session information
|
||||||
|
$_SESSION['voted_document'][$document_srl] = -1;
|
||||||
$output = executeQuery('document.updateBlamedCount', $args);
|
$output = executeQuery('document.updateBlamedCount', $args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$args->voted_count = $oDocument->get('voted_count') + $point;
|
$args->voted_count = $oDocument->get('voted_count') + $point;
|
||||||
|
// Leave in the session information
|
||||||
|
$_SESSION['voted_document'][$document_srl] = 1;
|
||||||
$output = executeQuery('document.updateVotedCount', $args);
|
$output = executeQuery('document.updateVotedCount', $args);
|
||||||
}
|
}
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
@ -1265,9 +1272,6 @@ class documentController extends document
|
||||||
$oCacheHandler->delete($cache_key);
|
$oCacheHandler->delete($cache_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Leave in the session information
|
|
||||||
$_SESSION['voted_document'][$document_srl] = true;
|
|
||||||
|
|
||||||
// Return result
|
// Return result
|
||||||
$output = new Object();
|
$output = new Object();
|
||||||
if($point > 0)
|
if($point > 0)
|
||||||
|
|
|
||||||
|
|
@ -372,19 +372,29 @@ class documentItem extends Object
|
||||||
function getVoted()
|
function getVoted()
|
||||||
{
|
{
|
||||||
if(!$this->document_srl) return;
|
if(!$this->document_srl) return;
|
||||||
|
if($_SESSION['voted_document'][$this->document_srl] == '1')
|
||||||
|
{
|
||||||
|
return 'voted';
|
||||||
|
}
|
||||||
|
else if($_SESSION['voted_document'][$this->document_srl] == '-1')
|
||||||
|
{
|
||||||
|
return 'blamed';
|
||||||
|
}
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$member_srl = $logged_info->member_srl;
|
|
||||||
$document_srl = $this->document_srl;
|
|
||||||
|
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->member_srl = $member_srl;
|
$args->member_srl = $logged_info->member_srl;
|
||||||
$args->document_srl = $document_srl;
|
$args->document_srl = $this->document_srl;
|
||||||
$output = executeQuery('document.getDocumentVotedLogInfo', $args);
|
$output = executeQuery('document.getDocumentVotedLog', $args);
|
||||||
|
|
||||||
if($output->data->count)
|
if($output->data->point === '1')
|
||||||
{
|
{
|
||||||
return true;
|
return 'voted';
|
||||||
|
}
|
||||||
|
else if($output->data->point === '-1')
|
||||||
|
{
|
||||||
|
return 'blamed';
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,6 @@
|
||||||
</tables>
|
</tables>
|
||||||
<conditions>
|
<conditions>
|
||||||
<condition operation="in" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
|
<condition operation="in" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
|
||||||
|
<condition operation="equal" column="member_srl" var="member_srl" filter="number" pipe="and" />
|
||||||
</conditions>
|
</conditions>
|
||||||
</query>
|
</query>
|
||||||
|
|
|
||||||
15
modules/document/queries/getDocumentVotedLog.xml
Normal file
15
modules/document/queries/getDocumentVotedLog.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<query id="getDocumentVotedLog" action="select">
|
||||||
|
<tables>
|
||||||
|
<table name="document_voted_log" />
|
||||||
|
</tables>
|
||||||
|
<columns>
|
||||||
|
<column name="*" />
|
||||||
|
</columns>
|
||||||
|
<conditions>
|
||||||
|
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
|
||||||
|
<group pipe="and">
|
||||||
|
<condition operation="equal" column="member_srl" var="member_srl" filter="number" pipe="and" />
|
||||||
|
<condition operation="equal" column="ipaddress" var="ipaddress" pipe="and" />
|
||||||
|
</group>
|
||||||
|
</conditions>
|
||||||
|
</query>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue