건별로 적립된 포인트를 조회할 수 있도록 수정

This commit is contained in:
chicpro
2013-07-26 17:26:27 +09:00
parent 56232158a4
commit b14f5a37ab
8 changed files with 56 additions and 191 deletions

View File

@ -108,7 +108,8 @@ if(!sql_query(" select cf_point_term from {$g4['config_table']} ", false)) {
sql_query(" ALTER TABLE `{$g4['point_table']}`
ADD `po_use_point` int(11) NOT NULL DEFAULT '0' AFTER `po_point`,
ADD `po_expired` tinyint(4) NOT NULL DEFAULT '0' AFTER `po_use_point`,
ADD `po_expire_date` date NOT NULL DEFAULT '0000-00-00' AFTER `po_expired` ", false);
ADD `po_expire_date` date NOT NULL DEFAULT '0000-00-00' AFTER `po_expired`
ADD `po_mb_point` int(11) NOT NULL DEFAULT '0' AFTER `po_expire_date` ", false);
}
$g4['title'] = '환경설정';

View File

@ -113,28 +113,16 @@ function point_clear()
<li><?php echo subject_sort_link('po_point') ?>포인트<span class="sound_only"> 순 정렬</span></a></li>
</ul>
<form name="fpointlist" id="fpointlist" method="post" action="./point_list_delete.php" onsubmit="return fpointlist_submit(this);">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="token" value="<?php echo $token ?>">
<table class="tbl_pt_list">
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">포인트 내역 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<th scope="col">회원아이디</th>
<th scope="col">이름</th>
<th scope="col">별명</th>
<th scope="col">일시</th>
<th scope="col">포인트 내용</th>
<th scope="col">포인트</th>
<th scope="col">만료</th>
<th scope="col">일시</th>
<th scope="col">만료일</th>
<th scope="col">포인트합</th>
</tr>
</thead>
@ -156,20 +144,14 @@ function point_clear()
?>
<tr>
<td class="td_chk">
<input type="hidden" name="mb_id[<?php echo $i ?>]" value="<?php echo $row['mb_id'] ?>" id="mb_id_<?php echo $i ?>">
<input type="hidden" name="po_id[<?php echo $i ?>]" value="<?php echo $row['po_id'] ?>" id="po_id_<?php echo $i ?>">
<label for="chk_<?php echo $i; ?>" class="sound_only">내역</label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
</td>
<td class="td_mbid"><a href="?sfl=mb_id&amp;stx=<?php echo $row['mb_id'] ?>"><?php echo $row['mb_id'] ?></a></td>
<td class="td_mbname"><?php echo $row2['mb_name'] ?></td>
<td class="td_name sv_use"><div><?php echo $mb_nick ?></div></td>
<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'] == 1 ? '예' : '아니오'; ?></td>
<td class="td_bignum td_pt"><?php echo number_format($row2['mb_point']) ?></td>
<td class="td_time"><?php echo $row['po_datetime'] ?></td>
<td><?php echo $row['po_expire_date'] == '0000-00-00' ? '&nbsp;' : $row['po_expire_date']; ?></td>
<td class="td_bignum td_pt"><?php echo number_format($row['po_mb_point']) ?></td>
</tr>
<?php
@ -180,12 +162,6 @@ function point_clear()
?>
</tbody>
</table>
<div class="btn_list">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
</div>
</form>
</section>
<?php echo get_paging(G4_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
@ -236,24 +212,6 @@ function point_clear()
</section>
<script>
function fpointlist_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택삭제") {
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
return true;
}
</script>
<?php
include_once ('./admin.tail.php');
?>

View File

@ -1,52 +0,0 @@
<?php
$sub_menu = "200200";
include_once('./_common.php');
check_demo();
auth_check($auth[$sub_menu], 'd');
check_token();
$count = count($_POST['chk']);
if(!$count)
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_expire_date'] == '0000-00-00' || $row['po_expire_date'] >= G4_TIME_YMD) {
$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);
$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);
?>