mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
comment도 추천/비추천 구분
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4197 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
5baf002551
commit
ee8e180f22
7 changed files with 46 additions and 5 deletions
|
|
@ -40,10 +40,10 @@
|
|||
<!--@end-->
|
||||
</div>
|
||||
|
||||
<!--@if($comment->get('voted_count')!=0)-->
|
||||
<!--@if($comment->get('voted_count')!=0 || $comment->get('blamed_count') != 0)-->
|
||||
<div class="voted">
|
||||
({$lang->voted_count}:
|
||||
<strong>{$comment->get('voted_count')}</strong>)
|
||||
<strong>{$comment->get('voted_count')?$comment->get('voted_count'):0}</strong> / <strong>{$comment->get('blamed_count')?$comment->get('blamed_count'):0}</strong>)
|
||||
</div>
|
||||
<!--@end-->
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@
|
|||
// 2008. 02. 22 모듈의 추가 설정에서 댓글 추가 설정 추가
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) return true;
|
||||
|
||||
// 2008. 05. 14 blamed count 컬럼 추가
|
||||
if(!$oDB->isColumnExists("comments", "blamed_count")) return true;
|
||||
if(!$oDB->isColumnExists("comment_voted_log", "point")) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -88,6 +92,14 @@
|
|||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
|
||||
|
||||
// 2008. 05. 14 blamed count 컬럼 추가
|
||||
if(!$oDB->isColumnExists("comments", "blamed_count")) {
|
||||
$oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, true);
|
||||
$oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count'));
|
||||
}
|
||||
if(!$oDB->isColumnExists("comment_voted_log", "point"))
|
||||
$oDB->addColumn('comment_voted_log', 'point', 'number', 11, 0, true);
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -398,6 +398,9 @@
|
|||
* @brief 해당 comment의 추천수 증가
|
||||
**/
|
||||
function updateVotedCount($comment_srl, $point = 1) {
|
||||
if($point > 0) $failed_voted = 'failed_voted';
|
||||
else $failed_voted = 'failed_blamed';
|
||||
|
||||
// 세션 정보에 추천 정보가 있으면 중단
|
||||
if($_SESSION['voted_comment'][$comment_srl]) return new Object(-1, 'failed_voted');
|
||||
|
||||
|
|
@ -440,17 +443,29 @@
|
|||
}
|
||||
|
||||
// 추천수 업데이트
|
||||
$args->voted_count = $oComment->get('voted_count') + $point;
|
||||
$output = executeQuery('comment.updateVotedCount', $args);
|
||||
if($point < 0)
|
||||
{
|
||||
$args->blamed_count = $oComment->get('blamed_count') + $point;
|
||||
$output = executeQuery('comment.updateBlamedCount', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->voted_count = $oComment->get('voted_count') + $point;
|
||||
$output = executeQuery('comment.updateVotedCount', $args);
|
||||
}
|
||||
|
||||
// 로그 남기기
|
||||
$args->point = $point;
|
||||
$output = executeQuery('comment.insertCommentVotedLog', $args);
|
||||
|
||||
// 세션 정보에 남김
|
||||
$_SESSION['voted_comment'][$comment_srl] = true;
|
||||
|
||||
// 결과 리턴
|
||||
return new Object(0, 'success_voted');
|
||||
if($point > 0)
|
||||
return new Object(0, 'success_voted');
|
||||
else
|
||||
return new Object(0, 'success_blamed');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -7,5 +7,6 @@
|
|||
<column name="member_srl" var="member_srl" filter="number" default="0" />
|
||||
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
|
||||
<column name="regdate" var="regdate" default="curdate()" />
|
||||
<column name="point" var="point" filter="number" default="0"/>
|
||||
</columns>
|
||||
</query>
|
||||
|
|
|
|||
11
modules/comment/queries/updateBlamedCount.xml
Normal file
11
modules/comment/queries/updateBlamedCount.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<query id="updateBlamedCount" action="update">
|
||||
<tables>
|
||||
<table name="comments" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="blamed_count" var="blamed_count" notnull="notnull" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="comment_srl" var="comment_srl" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
@ -3,4 +3,5 @@
|
|||
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
|
||||
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress"/>
|
||||
<column name="regdate" type="date" index="idx_regdate" />
|
||||
<column name="point" type="number" size="11" notnull="notnull" />
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<column name="is_secret" type="char" size="1" default="N" notnull="notnull" />
|
||||
<column name="content" type="bigtext" notnull="notnull" />
|
||||
<column name="voted_count" type="number" size="11" default="0" notnull="notnull" index="idx_voted_count" />
|
||||
<column name="blamed_count" type="number" size="11" default="0" notnull="notnull" index="idx_blamed_count" />
|
||||
<column name="notify_message" type="char" size="1" default="N" notnull="notnull" />
|
||||
<column name="password" type="varchar" size="60" />
|
||||
<column name="user_id" type="varchar" size="80" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue