포인트 유효기간 추가 및 내역 삭제 추가
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$sub_menu = "200200";
|
||||
$sub_menu = '200200';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
@ -10,23 +10,48 @@ check_token();
|
||||
|
||||
$count = count($_POST['chk']);
|
||||
if(!$count)
|
||||
alert($_POST['act_button']." 하실 항목을 하나 이상 체크하세요.");
|
||||
alert($_POST['act_button'].' 하실 항목을 하나 이상 체크하세요.');
|
||||
|
||||
for ($i=0; $i<$count; $i++)
|
||||
{
|
||||
// 실제 번호를 넘김
|
||||
$k = $_POST['chk'][$i];
|
||||
|
||||
// 포인트 내역정보
|
||||
$sql = " select * from {$g4['point_table']} where po_id = '{$_POST['po_id'][$k]}' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if(!$row['po_id'])
|
||||
continue;
|
||||
|
||||
if($row['po_point'] < 0) {
|
||||
if($row['po_rel_table'] != '@expire') {
|
||||
$mb_id = $row['mb_id'];
|
||||
$po_point = abs($row['po_point']);
|
||||
|
||||
delete_use_point($mb_id, $po_point);
|
||||
}
|
||||
} else {
|
||||
if($row['po_expired'] != 1 && $row['po_use_point'] > 0) {
|
||||
insert_use_point($row['mb_id'], $row['po_use_point'], $row['po_id']);
|
||||
}
|
||||
}
|
||||
|
||||
// 포인트 내역삭제
|
||||
$sql = " delete from {$g4['point_table']} where po_id = '{$_POST['po_id'][$k]}' ";
|
||||
sql_query($sql);
|
||||
|
||||
$sql = " select sum(po_point) as sum_po_point from {$g4['point_table']} where mb_id = '{$_POST['mb_id'][$k]}' ";
|
||||
$row = sql_fetch($sql);
|
||||
$sum_point = $row['sum_po_point'];
|
||||
// po_mb_point에 반영
|
||||
$sql = " update {$g4['point_table']}
|
||||
set po_mb_point = po_mb_point - '{$row['po_point']}'
|
||||
where mb_id = '$mb_id'
|
||||
and po_id > '{$row['po_id']}' ";
|
||||
sql_query($sql);
|
||||
|
||||
$sql= " update {$g4['member_table']} set mb_point = '{$sum_point}' where mb_id = '{$_POST['mb_id'][$k]}' ";
|
||||
$sum_point = get_point_sum($_POST['mb_id'][$k]);
|
||||
$sql= " update {$g4['member_table']} set mb_point = '$sum_point' where mb_id = '{$_POST['mb_id'][$k]}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
goto_url('./point_list.php?'.$qstr);
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user