게시글 삭제시 포인트 처리 코드 추가

This commit is contained in:
chicpro
2013-07-24 10:34:34 +09:00
parent d85556451d
commit 7dac113f38
3 changed files with 21 additions and 7 deletions

View File

@ -168,7 +168,7 @@ function point_clear()
<td class="td_time"><?php echo $row['po_datetime'] ?></td>
<td class="td_pt_log"><?php echo $link1 ?><?php echo $row['po_content'] ?><?php echo $link2 ?></td>
<td class="td_num td_pt"><?php echo number_format($row['po_point']) ?></td>
<td><?php echo $row['po_expired'] ? '예' : '아니오'; ?></td>
<td><?php echo $row['po_expired'] == 1 ? '예' : '아니오'; ?></td>
<td class="td_bignum td_pt"><?php echo number_format($row2['mb_point']) ?></td>
</tr>

View File

@ -33,7 +33,7 @@ for ($i=0; $i<$count; $i++)
delete_use_point($mb_id, $po_point);
}
} else {
if($row['po_expired'] == 0 && $row['po_use_point'] > 0) {
if($row['po_expired'] != 1 && $row['po_use_point'] > 0) {
insert_use_point($row['mb_id'], $row['po_use_point'], $row['po_id']);
}
}

View File

@ -1027,18 +1027,32 @@ function delete_point($mb_id, $rel_table, $rel_id, $rel_action)
$result = false;
if ($rel_table || $rel_id || $rel_action)
{
// 포인트정보
$sql = " select po_id, mb_id, po_use_point, po_expired
from {$g4['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);
$result = sql_query(" delete from {$g4['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' ", false);
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ", false);
// 포인트 내역의 합을 구하고
$sum_point = get_point_sum($mb_id);
// 포인트 UPDATE
$sql = " update {$g4['member_table']} set mb_point = '$sum_point' where mb_id = '$mb_id' ";
$result = sql_query($sql);
$result = sql_query($sql, false);
// 포인트 사용 값이 있으면 다른 포인트 내역으로 이동시킴
if($result && $row['po_expired'] != 1 && $row['po_use_point'] > 0) {
insert_use_point($row['mb_id'], $row['po_use_point'], $row['po_id']);
}
}
return $result;