포인트 리셋기능 추가. 글/댓글/파일을 첨부한 사용자만 대상이고 그 외 회원은 일단 지워지고 나서 캐시파일 생성시 포인트 입력됨 (회원가입점수는 이때 적용)

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3386 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-12-20 10:13:12 +00:00
parent 4d6afe35fa
commit 4c2eabe9fa
19 changed files with 260 additions and 2 deletions

View file

@ -12,5 +12,8 @@
<action name="procPointAdminInsertActConfig" type="controller" standalone="true" />
<action name="procPointAdminUpdatePoint" type="controller" standalone="true" />
<action name="procPointAdminInsertPointModuleConfig" type="controller" standalone="true" />
<action name="procPointAdminApplyPoint" type="controller" standalone="true" />
<action name="procPointAdminReCal" type="controller" standalone="true" />
</actions>
</module>

View file

@ -31,6 +31,9 @@
$lang->cmd_exp_calc = '계산';
$lang->cmd_exp_reset = '초기화';
$lang->cmd_point_recal = '포인트 재계산';
$lang->about_cmd_point_recal = '게시글/댓글/첨부파일등을 모두 검사하여 설정된 포인트 설정에 맞게 모든 회원들의 포인트를 재계산합니다';
$lang->about_module_point = "You can set point for each module and modules which don't have any value will use default point.<br />All point will be restored on acting reverse.";
$lang->point_signup = 'Signup';
@ -49,4 +52,7 @@
$lang->cmd_point_member_list = 'Member Point List';
$lang->msg_cannot_download = "You don't have enough point to download";
$lang->point_recal_message = '포인트 적용중입니다. (%d / %d)';
$lang->point_recal_finished = '포인트 재계산이 모두 완료되었습니다';
?>

View file

@ -31,6 +31,9 @@
$lang->cmd_exp_calc = '계산';
$lang->cmd_exp_reset = '초기화';
$lang->cmd_point_recal = '포인트 재계산';
$lang->about_cmd_point_recal = '게시글/댓글/첨부파일등을 모두 검사하여 설정된 포인트 설정에 맞게 모든 회원들의 포인트를 재계산합니다';
$lang->about_module_point = "Usted puede definir los puntos para cada módulo y los módulos que no tengan ningun valor usarán punto predefinido.<br />Todos los puntos serán restituidos al actuar en forma contraria.";
$lang->point_signup = 'Fecha del';
@ -49,4 +52,7 @@
$lang->cmd_point_member_list = 'Lista de puntos del usuario';
$lang->msg_cannot_download = "No tiene puntos suficientes para descagar";
$lang->point_recal_message = '포인트 적용중입니다. (%d / %d)';
$lang->point_recal_finished = '포인트 재계산이 모두 완료되었습니다';
?>

View file

@ -31,6 +31,9 @@
$lang->cmd_exp_calc = '計算';
$lang->cmd_exp_reset = '初期化';
$lang->cmd_point_recal = '포인트 재계산';
$lang->about_cmd_point_recal = '게시글/댓글/첨부파일등을 모두 검사하여 설정된 포인트 설정에 맞게 모든 회원들의 포인트를 재계산합니다';
$lang->about_module_point = 'モジュール別にポイントを指定することができますが、指定されていないモジュールでは、デフォルトポイントが使用されます。すべてのポイント数は、反対のアクションを行った際には原状復帰されます。';
$lang->point_signup = '加入';
@ -49,4 +52,7 @@
$lang->cmd_point_member_list = '会員ポイントリスト';
$lang->msg_cannot_download = 'ポイントが不足しているため、ダウンロードできません。';
$lang->point_recal_message = '포인트 적용중입니다. (%d / %d)';
$lang->point_recal_finished = '포인트 재계산이 모두 완료되었습니다';
?>

View file

@ -31,6 +31,9 @@
$lang->cmd_exp_calc = '계산';
$lang->cmd_exp_reset = '초기화';
$lang->cmd_point_recal = '포인트 재계산';
$lang->about_cmd_point_recal = '게시글/댓글/첨부파일등을 모두 검사하여 설정된 포인트 설정에 맞게 모든 회원들의 포인트를 재계산합니다';
$lang->about_module_point = '모듈별로 포인트를 지정할 수 있으며 지정되지 않은 모듈은 기본 포인트를 이용하게 됩니다<br />모든 점수는 반대 행동을 하였을 경우 원상복귀 됩니다.';
$lang->point_signup = '가입';
@ -49,4 +52,7 @@
$lang->cmd_point_member_list = '회원 포인트 목록';
$lang->msg_cannot_download = '포인트가 부족하여 다운로드를 하실 수 없습니다';
$lang->point_recal_message = '포인트 적용중입니다. (%d / %d)';
$lang->point_recal_finished = '포인트 재계산이 모두 완료되었습니다';
?>

View file

@ -26,6 +26,14 @@
$lang->disable_download = 'Запретить скачивание';
$lang->about_disable_download = "Это запретит скачивание файлов, когда не хватает достаточного кол-ва поинтов. (За исключением файлов изображений)";
$lang->level_point_calc = '레벨별 포인트 계산';
$lang->expression = '레벨 변수 <b>i</b>를 사용하여 자바스크립트 수식을 입력하세요. 예: Math.pow(i, 2) * 90';
$lang->cmd_exp_calc = '계산';
$lang->cmd_exp_reset = '초기화';
$lang->cmd_point_recal = '포인트 재계산';
$lang->about_cmd_point_recal = '게시글/댓글/첨부파일등을 모두 검사하여 설정된 포인트 설정에 맞게 모든 회원들의 포인트를 재계산합니다';
$lang->about_module_point = "Вы можете установть поинты для каждого модуля, а модули, не имеющие значения будут использовать значение по умолчанию для поинтов.<br />Все поинты будут восстановлены при обратном действии.";
$lang->point_signup = 'Присвоить';
@ -44,4 +52,7 @@
$lang->cmd_point_member_list = 'Список поинтов пользователей';
$lang->msg_cannot_download = "У Вас нет достаточного количества поитов, чтобы иметь разрешение скачивать файлы.";
$lang->point_recal_message = '포인트 적용중입니다. (%d / %d)';
$lang->point_recal_finished = '포인트 재계산이 모두 완료되었습니다';
?>

View file

@ -31,6 +31,9 @@
$lang->cmd_exp_calc = '计算';
$lang->cmd_exp_reset = '初始化';
$lang->cmd_point_recal = '포인트 재계산';
$lang->about_cmd_point_recal = '게시글/댓글/첨부파일등을 모두 검사하여 설정된 포인트 설정에 맞게 모든 회원들의 포인트를 재계산합니다';
$lang->about_module_point = '可以分别对各模块进行积分设置,没有被设置的模块将使用默认值。<br />所有积分在相反动作下恢复原始值。即发表新帖后再删除得到的积分为0分。';
$lang->point_signup = '注册';
@ -49,4 +52,7 @@
$lang->cmd_point_member_list = '会员积分目录';
$lang->msg_cannot_download = '积分不足无法下载!';
$lang->point_recal_message = '포인트 적용중입니다. (%d / %d)';
$lang->point_recal_finished = '포인트 재계산이 모두 완료되었습니다';
?>

View file

@ -149,6 +149,119 @@
return $oPointController->setPoint($member_srl, (int)$point);
}
/**
* @brief 전체글/ 댓글/ 첨부파일과 가입정보를 바탕으로 포인트를 재계산함. 로그인 점수는 1번만 부여됨
**/
function procPointAdminReCal() {
set_time_limit(0);
// 모듈별 포인트 정보를 가져옴
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('point');
// 회원의 포인트 저장을 위한 변수
$member = array();
// 게시글 정보를 가져옴
$output = executeQueryArray('point.getDocumentPoint');
if(!$output->toBool()) return $output;
foreach($output->data as $key => $val) {
if($config->module_point[$val->module_srl]->insert_document) $insert_point = $config->module_point[$val->module_srl]->insert_document;
else $insert_point = $config->insert_document;
if(!$val->member_srl) continue;
$point = $insert_point * $val->count;
$member[$val->member_srl] += $point;
}
$output = null;
// 댓글 정보를 가져옴
$output = executeQueryArray('point.getCommentPoint');
if(!$output->toBool()) return $output;
foreach($output->data as $key => $val) {
if($config->module_point[$val->module_srl]->insert_comment) $insert_point = $config->module_point[$val->module_srl]->insert_comment;
else $insert_point = $config->insert_comment;
if(!$val->member_srl) continue;
$point = $insert_point * $val->count;
$member[$val->member_srl] += $point;
}
$output = null;
// 첨부파일 정보를 가져옴
$output = executeQueryArray('point.getFilePoint');
if(!$output->toBool()) return $output;
foreach($output->data as $key => $val) {
if($config->module_point[$val->module_srl]->upload_file) $insert_point = $config->module_point[$val->module_srl]->upload_file;
else $insert_point = $config->upload_file;
if(!$val->member_srl) continue;
$point = $insert_point * $val->count;
$member[$val->member_srl] += $point;
}
$output = null;
// 모든 회원의 포인트를 0으로 세팅
$output = executeQuery("point.initMemberPoint");
if(!$output->toBool()) return $output;
// 임시로 파일 저장
$f = fopen("./files/cache/pointRecal.txt","w");
foreach($member as $key => $val) {
$val += (int)$config->signup_point;
fwrite($f, $key.','.$val."\r\n");
}
fclose($f);
$this->add('total', count($member));
$this->add('position', 0);
$this->setMessage( sprintf(Context::getLang('point_recal_message'), 0, $this->get('total')) );
}
/**
* @brief 파일로 저장한 회원 포인트를 5000 단위로 적용
**/
function procPointAdminApplyPoint() {
$position = (int)Context::get('position');
$total = (int)Context::get('total');
if(!file_exists('./files/cache/pointRecal.txt')) return new Object(-1, 'msg_invalid_request');
$idx = 0;
$f = fopen("./files/cache/pointRecal.txt","r");
while(!feof($f)) {
$str = trim(fgets($f, 1024));
$idx ++;
if($idx > $position) {
list($member_srl, $point) = explode(',',$str);
$args = null;
$args->member_srl = $member_srl;
$args->point = $point;
$output = executeQuery('point.insertPoint',$args);
if($idx%5000==0) break;
}
}
if(feof($f)) {
@unlink('./files/cache/pointRecal.txt');
$idx = $total;
@rename('./files/member_extra_info/point','./files/member_extra_info/point.old');
FileHandler::removeDir('./files/member_extra_info/point.old');
}
fclose($f);
$this->add('total', $total);
$this->add('position', $idx);
$this->setMessage(sprintf(Context::getLang('point_recal_message'), $idx, $total));
}
/**
* @brief 캐시파일 저장
**/

View file

@ -300,6 +300,10 @@
function setPoint($member_srl, $point) {
if($point < 0) $point = 0;
// 설정 정보 가져오기
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('point');
// 변수 설정
$args->member_srl = $member_srl;
$args->point = $point;
@ -309,6 +313,7 @@
if($oPointModel->isExistsPoint($member_srl)) {
executeQuery("point.updatePoint", $args);
} else {
$args->point += (int)$config->signup_point;
executeQuery("point.insertPoint", $args);
}

View file

@ -0,0 +1,14 @@
<query id="getCommentPoint" action="select">
<tables>
<table name="comments" />
</tables>
<columns>
<column name="module_srl" />
<column name="member_srl" />
<column name="count(*)" alias="count"/>
</columns>
<groups>
<group column="module_srl" />
<group column="member_srl" />
</groups>
</query>

View file

@ -0,0 +1,14 @@
<query id="getDocumentPoint" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="module_srl" />
<column name="member_srl" />
<column name="count(*)" alias="count"/>
</columns>
<groups>
<group column="module_srl" />
<group column="member_srl" />
</groups>
</query>

View file

@ -0,0 +1,17 @@
<query id="getFilePoint" action="select">
<tables>
<table name="files" />
</tables>
<columns>
<column name="module_srl" />
<column name="member_srl" />
<column name="count(*)" alias="count"/>
</columns>
<conditions>
<condition operation="equal" column="isvalid" default="Y" notnull="notnull" />
</conditions>
<groups>
<group column="module_srl" />
<group column="member_srl" />
</groups>
</query>

View file

@ -0,0 +1,5 @@
<query id="initMemberPoint" action="delete">
<tables>
<table name="point" />
</tables>
</query>

View file

@ -8,6 +8,14 @@
<col width="120" />
<col width="120" />
<col />
<tr>
<th scope="col">{$lang->cmd_point_recal}</th>
<td colspan="3">
<span class="button"><input type="button" value="{$lang->cmd_point_recal}" onclick="doPointRecal(); return false;"/></span>
<p>{$lang->about_cmd_point_recal}</p>
<div id="pointReCal"></div>
</td>
</tr>
<tr>
<th scope="col">{$lang->max_level}</th>
<td colspan="3">

View file

@ -16,4 +16,36 @@ function exp_calc (form, reset) {
point = eval("fo_obj.level_step_" + i)
point.value = eval(exp.value);
}
}
}
/**
* @brief 포인트를 전부 체크하여 재계산하는 action 호출
**/
function doPointRecal() {
var params = new Array();
var response_tags = new Array('error','message','total', 'position');
exec_xml('point','procPointAdminReCal',params, completePointRecal, response_tags);
}
function completePointRecal(ret_obj) {
var total = ret_obj['total'];
var message = ret_obj['message'];
var position = ret_obj['position'];
if(position == total) {
xInnerHtml('pointReCal', message);
alert(message);
location.reload();
} else {
xInnerHtml('pointReCal', message);
var params = new Array();
params['position'] = position;
params['total'] = total;
var response_tags = new Array('error','message','total', 'position');
exec_xml('point','procPointAdminApplyPoint',params, completePointRecal, response_tags);
}
}

View file

@ -11,6 +11,7 @@
<th>{$lang->point_download_file}</th>
</tr>
<!--@foreach($mid_list as $key => $val)-->
<!--@if(in_array($val->module,array('guestbook','board','blog')))-->
<tr>
<th colspan="4" scope="col">{$val->browser_title} ({$val->mid})</th>
</tr>
@ -21,6 +22,7 @@
<td><input type="text" name="download_file_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['download_file']}" class="inputTypeText w80" /> {$config->point_name}</td>
</tr>
<!--@end-->
<!--@end-->
</table>
<!-- 버튼 -->