테스트 사이트 - 개발 중인 베타 버전입니다

회원 레벨별 포인트 % 추가지급

· 13년 전 · 5543 · 14
무제-2 복사.jpg
회원 에게 포인트 지급시 레벨별로 %를 지정하여 그만큼 추가로 더 주는 기능입니다.

플러그인에 올릴까 팁에 올릴까 하다 플러그인에 올립니다.

30분 작업한거라 조잡할수도 있습니다.

PS. 그누보드 DTD 버젼으로 작업한 것이므로 테이블은 맞춰서 사용하시면 됩니다.

===== 사용법

1. 테이블 생성 - phpMyAdmin 으로 접근하여아래 코드를 실행 합니다

ALTER TABLE `g4_config` ADD `cf_level_point_use` INT( 1) NOT NULL ,
ADD `cf_level_point2` INT( 3) NOT NULL ,
ADD `cf_level_point3` INT( 3) NOT NULL ,
ADD `cf_level_point4` INT( 3) NOT NULL ,
ADD `cf_level_point5` INT( 3) NOT NULL ,
ADD `cf_level_point6` INT( 3) NOT NULL ,
ADD `cf_level_point7` INT( 3) NOT NULL ,
ADD `cf_level_point8` INT( 3) NOT NULL ,
ADD `cf_level_point9` INT( 3) NOT NULL


ALTER TABLE `g4_point` ADD `pr_per_content` VARCHAR( 255) NOT NULL

=> config 테이블과 point 테이블에 칼럼을 추가 합니다.



2. /adm/config_form.php 파일의 적절한 위치에 아래 코드를 넣습니다

<?php echo subtitle("레벨별 포인트 설정")?>
<table class="normal2">
<tr>
<th scope="col" width="20%">레벨별 포인트 사용</th>
<td colspan="3" width="80%"><input type='checkbox' name='cf_level_point_use' value='1' <?php echo $config['cf_level_point_use']?"checked='checked'":"";?> /> 사용 (체크하지 않으면 레벨별 포인트를 사용하지 않습니다.)</td>
</tr>
<tr>
<th scope="col" width="20%">2레벨</th>
<td width="30%"><input type='text' name='cf_level_point2' size='2' class='text' value='<?php echo get_text($config["cf_level_point2"])?>' title='2레벨포인트' style='text-align:right;font-weight:bold;' />%</td>
<th scope="col">3레벨</th>
<td width="30%"><input type='text' name='cf_level_point3' size='2' class='text' value='<?php echo get_text($config["cf_level_point3"])?>' title='3레벨포인트' style='text-align:right;font-weight:bold;' />%</td>
</tr>
<tr>
<th scope="col" width="20%">4레벨</th>
<td width="30%"><input type='text' name='cf_level_point4' size='2' class='text' value='<?php echo get_text($config["cf_level_point4"])?>' title='4레벨포인트' style='text-align:right;font-weight:bold;' />%</td>
<th scope="col">5레벨</th>
<td width="30%"><input type='text' name='cf_level_point5' size='2' class='text' value='<?php echo get_text($config["cf_level_point5"])?>' title='5레벨포인트' style='text-align:right;font-weight:bold;' />%</td>
</tr>
<tr>
<th scope="col" width="20%">6레벨</th>
<td width="30%"><input type='text' name='cf_level_point6' size='2' class='text' value='<?php echo get_text($config["cf_level_point6"])?>' title='6레벨포인트' style='text-align:right;font-weight:bold;' />%</td>
<th scope="col">7레벨</th>
<td width="30%"><input type='text' name='cf_level_point7' size='2' class='text' value='<?php echo get_text($config["cf_level_point7"])?>' title='7레벨포인트' style='text-align:right;font-weight:bold;' />%</td>
</tr>
<tr>
<th scope="col" width="20%">8레벨</th>
<td width="30%"><input type='text' name='cf_level_point8' size='2' class='text' value='<?php echo get_text($config["cf_level_point8"])?>' title='8레벨포인트' style='text-align:right;font-weight:bold;' />%</td>
<th scope="col">9레벨</th>
<td width="30%"><input type='text' name='cf_level_point9' size='2' class='text' value='<?php echo get_text($config["cf_level_point9"])?>' title='9레벨포인트' style='text-align:right;font-weight:bold;' />%</td>
</tr>
</table>

3. /lib/common.lib.php 의 insert_point 함수에 아래 내용을 수정/ 추가합니다.

// 포인트 건별 생성
$sql = " insert into $g4[point_table]
set mb_id = '$mb_id',
po_datetime = '$g4[time_ymdhis]',
po_content = '".addslashes($content)."',
po_point = '$point',
po_rel_table = '$rel_table',
po_rel_id = '$rel_id',
po_rel_action = '$rel_action' ";
sql_query($sql);

=>


// 레벨별 포인트 % 처리
if($config[cf_level_point_use] == 1){
if($member[mb_level] >=2 && $member[mb_level] <= 9){
$mem_per_point = $config['cf_level_point'.$member[mb_level]]; // 회원 레벨별 필드 가져오기
if($mem_per_point) $per_point = floor(($point /100) * $mem_per_point); // 추가금액
$pr_per_content = "기본포인트 : ".$point." / 레벨별포인트 : ".$mem_per_point."% 추가 - ".$per_point;
$point += $per_point;
$pr_query = "pr_per_content = '$pr_per_content',";
}
}

// 포인트 건별 생성
$sql = " insert into $g4[point_table]
set mb_id = '$mb_id',
po_datetime = '$g4[time_ymdhis]',
po_content = '".addslashes($content)."',
po_point = '$point',
$pr_query
po_rel_table = '$rel_table',
po_rel_id = '$rel_id',
po_rel_action = '$rel_action' ";
sql_query($sql);



위와같이 하시고 관리자 환경설정 - 기본 환경 설정 들어가셔서

레벨별 퍼센트를 지정해 주신후 게시글 등록 등으로 테스트 해보시면 됩니다.

필요하신 분들은 많이 사용해 주세요.~

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 14개

13년 전
레벨은 올라가는데 딱히 해 드릴건 없고 ....
이거 딱 인듯 합니다.^^
13년 전
좋아요.!


/adm/config_form_update.php 117번 라인에 추가 및 수정이요.

cf_10 = '$_POST[cf_10]',
cf_level_point_use = '$_POST[cf_level_point_use]',
cf_level_point2 = '$_POST[cf_level_point2]',
cf_level_point3 = '$_POST[cf_level_point3]',
cf_level_point4 = '$_POST[cf_level_point4]',
cf_level_point5 = '$_POST[cf_level_point5]',
cf_level_point6 = '$_POST[cf_level_point6]',
cf_level_point7 = '$_POST[cf_level_point7]',
cf_level_point8 = '$_POST[cf_level_point8]',
cf_level_point9 = '$_POST[cf_level_point9]' ";

이거 추가안하면 작동 안하는..!!
13년 전
네.맞습니다 .
그부분을 빼고 올렸네요.^^
update 파일부분에 추가해주시면 됩니다.~
13년 전
그런데 일반 그누보드4 에선 적용이 안되는.... dtd 버전이라그런지.. 흑흑 ... 사용하고싶었는데...
13년 전
/lib/common.lib.php
파일의
insert_point 함수안에

global $member; <= 이게 없다면 추가해주시면 됩니다
13년 전
해결완료..!! 넓은마인드님 알려주셔서 감사합니다. ^^ 이 플러그인 잘쓰겠습니다.!
12년 전
감사합니다~ *^^*
CaoCao가나타났다CaoCao가나타
12년 전
왜 전 안될까요; 그누보드4 원본인데, 그누보드 DTD와 테이블을 다르게 생성해야하는 건가요
12년 전
/lib/common.lib.php
파일의
insert_point 함수안에

global $member; <= 이게 없다면 추가해주시면 됩니다

해보고 안되시면 다시 말해주세요.~
CaoCao가나타났다CaoCao가나타
12년 전
그거 넣었었는데 문제가 저의 사소한 실수 때문에 생긴 문제였어요.;;

넓은마인드님 감사합니다 정말 잘 쓸게요!