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

n회 이상 글 썼을 경우 포인트 지급 하지 않기 매개 게시판마다 다드르게 하려면 어떻게 수정해야 하나요? 채택완료

ㅐ늑대ㅐ 5년 전 조회 3,911

n회 이상 글 썼을 경우 포인트 지급 하지 않기 매개 게시판마다 다드르게 하려면 어떻게 수정해야 하나요?

게시판 관리에서 bo_1 사용해서 매개 게시판마다 다르게 하려합니다.

lib/common.lib.php 에서 아래처럼 하니 작동 되지 않습니다ㅏ.

 

// 포인트 부여
function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $rel_action='', $expire=0, $repeat=0)
{
    global $config;
    global $g5;
    global $is_admin;
    
    // 하루 게시글 지전한개수이상 넘게 쓸 경우는 더이상 포인트 지급 안함
    if ($rel_action=='쓰기'){
        $sql = " select count(*) as cnt from {$g5['point_table']} where mb_id = '$mb_id' and left(po_datetime,10) = '".G5_TIME_YMD."' and po_rel_action = '쓰기' ";
        $row = sql_fetch($sql);
        if ($row['cnt'] > $board['bo_1'])
        return + 1;
    }

    // 포인트 사용을 하지 않는다면 return
    if (!$config['cf_use_point']) { return 0; }

    // 포인트가 없다면 업데이트 할 필요 없음
    if ($point == 0) { return 0; }

    // 회원아이디가 없다면 업데이트 할 필요 없음
    if ($mb_id == '') { return 0; }
    $mb = sql_fetch(" select mb_id from {$g5['member_table']} where mb_id = '$mb_id' ");
    if (!$mb['mb_id']) { return 0; }

    // 회원포인트
    $mb_point = get_point_sum($mb_id);

    // 이미 등록된 내역이라면 건너뜀 - 반복기능 추가
    if (!$repeat && ($rel_table || $rel_id || $rel_action))
    {
        $sql = " select count(*) as cnt from {$g5['point_table']}
                  where mb_id = '$mb_id'
                    and po_rel_table = '$rel_table'
                    and po_rel_id = '$rel_id'
                    and po_rel_action = '$rel_action' ";
        $row = sql_fetch($sql);
        if ($row['cnt'])
            return -1;
    }

    // 포인트 건별 생성
    $po_expire_date = '9999-12-31';
    if($config['cf_point_term'] > 0) {
        if($expire > 0)
            $po_expire_date = date('Y-m-d', strtotime('+'.($expire - 1).' days', G5_SERVER_TIME));
        else
            $po_expire_date = date('Y-m-d', strtotime('+'.($config['cf_point_term'] - 1).' days', G5_SERVER_TIME));
    }

    $po_expired = 0;
    if($point < 0) {
        $po_expired = 1;
        $po_expire_date = G5_TIME_YMD;
    }
    $po_mb_point = $mb_point + $point;

    $sql = " insert into {$g5['point_table']}
                set mb_id = '$mb_id',
                    po_datetime = '".G5_TIME_YMDHIS."',
                    po_content = '".addslashes($content)."',
                    po_point = '$point',
                    po_use_point = '0',
                    po_mb_point = '$po_mb_point',
                    po_expired = '$po_expired',
                    po_expire_date = '$po_expire_date',
                    po_rel_table = '$rel_table',
                    po_rel_id = '$rel_id',
                    po_rel_action = '$rel_action' ";
    sql_query($sql);

    // 포인트를 사용한 경우 포인트 내역에 사용금액 기록
    if($point < 0) {
        insert_use_point($mb_id, $point);
    }

    // 포인트 UPDATE
    $sql = " update {$g5['member_table']} set mb_point = '$po_mb_point' where mb_id = '$mb_id' ";
    sql_query($sql);
    
    // XP UPDATE
    update_xp($mb_id, $point, $content, $rel_table, $rel_action);

    return 1;
}

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

답변 3개

5년 전

안되신다니 아쉽네요 고생하세요~

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

ㅐ늑대ㅐ
5년 전
감사합니다

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

5년 전

포인트 부여하지 않는다는게 무슨뜻인지 이해가 가질 않네요

잘 된다는뜻인가요..?

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

ㅐ늑대ㅐ
5년 전
자유게시판에 한회원 매일 2개 원글만 포인트 주고 3번째 원글부터는 포인트를 않줄려고 합니다.

감기약님 답변대로 하면은 원글에 포인트 주지 않습니다.

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

5년 전

글이 작성되는 순간에 적용하시는게 좋을듯 합니다.

 

bbs/write_update.php 파일 약 297번재줄

 

    // 쓰기 포인트 부여

    if ($w == '') {

        if ($notice) {

            $bo_notice = $wr_id.($board['bo_notice'] ? ",".$board['bo_notice'] : '');

            sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");

        }</p>

<p>        insert_point($member['mb_id'], $board['bo_write_point'], "{$board['bo_subject']} {$wr_id} 글쓰기", $bo_table, $wr_id, '쓰기');

    } else {

        // 답변은 코멘트 포인트를 부여함

        // 답변 포인트가 많은 경우 코멘트 대신 답변을 하는 경우가 많음

        insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id} 글답변", $bo_table, $wr_id, '쓰기');

    }

}  else if ($w == 'u') {

    if (get_session('ss_bo_table') != $_POST['bo_table'] || get_session('ss_wr_id') != $_POST['wr_id']) {

        alert('올바른 방법으로 수정하여 주십시오.', get_pretty_url($bo_table));

    }</p>

<p>

 

위 코드에서 insert_point 부분에 적용

 

</p>

<p>// xxx 라는 테이블의 게시판일경우</p>

<p>if($bo_table == "xxx") {</p>

<p>$count = sql_fetch(" select count(*) as cnt from {$write_table} where bo_table = '{$bo_table}' and mb_id= '{$mb_id}'");</p>

<p>if($count['cnt'] >= $board['bo_1']) { 게시글이 bo_1 에 설정한 개수보다 작거나 같을때만 포인트 지급</p>

<p>insert_point($member['mb_id'], $board['bo_write_point'], "{$board['bo_subject']} {$wr_id} 글쓰기", $bo_table, $wr_id, '쓰기');</p>

<p>}</p>

<p>} else {</p>

<p>insert_point($member['mb_id'], $board['bo_write_point'], "{$board['bo_subject']} {$wr_id} 글쓰기", $bo_table, $wr_id, '쓰기');</p>

<p>}</p>

<p>

 

직접 해보진 않았습니다.

 

 

 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

ㅐ늑대ㅐ
5년 전
답변 갑사 합니다

해봣는데 포인트 부여 하지 않습니다.

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

답변을 작성하려면 로그인이 필요합니다.

로그인