상점 기능 업데이트
상점에서 아이템 진열 시, 다수의 아이템을 소모하여 구매할 수 있도록 기능을 업데이트 하였습니다. ◇ 소모 아이템 : 소모 아이템 갯수 설정 가능
This commit is contained in:
parent
8f78e77f48
commit
900cacdcaa
6 changed files with 122 additions and 95 deletions
|
|
@ -223,8 +223,8 @@ if($config['cf_class_title']) {
|
|||
<td>
|
||||
<input type="hidden" name="sh_has_item" id="sh_has_item" value="<?=$shop['sh_has_item']?>" />
|
||||
<input type="text" name="sh_has_item_name" value="<?=get_item_name($shop['sh_has_item'])?>" id="sh_has_item_name" onkeyup="get_ajax_item(this, 'has_item_list', 'sh_has_item');" />
|
||||
<input type="text" name="sh_has_item_count" value="<?=$shop['sh_has_item_count']?>" size="5"/> 개
|
||||
<div id="has_item_list" class="ajax-list-box"><div class="list"></div></div>
|
||||
|
||||
</td></tr><tr>
|
||||
<td class="bo-right">소모여부</td>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ $sql_common = "
|
|||
sh_use_rank = '{$sh_use_rank}',
|
||||
sh_has_item = '{$sh_has_item}',
|
||||
sh_use_has_item = '{$sh_use_has_item}',
|
||||
sh_has_item_count = '{$sh_has_item_count}',
|
||||
sh_has_title = '{$sh_has_title}',
|
||||
sh_use_has_title = '{$sh_use_has_title}',
|
||||
sh_use = '{$sh_use}',
|
||||
|
|
|
|||
|
|
@ -47,7 +47,14 @@ $listall = '<a href="'.$_SERVER['PHP_SELF'].'" class="ov_listall">전체목록</
|
|||
$g5['title'] = '상점 관리';
|
||||
include_once('./admin.head.php');
|
||||
|
||||
$colspan = 13;
|
||||
/*******************************
|
||||
구매 아이템 갯수 설정
|
||||
*******************************/
|
||||
if(!sql_query(" SELECT sh_has_item_count from {$g5['shop_table']} limit 1 ", false)) {
|
||||
sql_query(" ALTER TABLE {$g5['shop_table']} ADD `sh_has_item_count` int(11) NOT NULL DEFAULT '0' AFTER `sh_has_item`");
|
||||
}
|
||||
|
||||
$colspan = 19;
|
||||
?>
|
||||
|
||||
<div class="local_ov01 local_ov">
|
||||
|
|
@ -98,51 +105,41 @@ $colspan = 13;
|
|||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<caption><?php echo $g5['title']; ?> 목록</caption>
|
||||
<colgroup>
|
||||
<col style="width: 40px;" />
|
||||
<col />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" rowspan="2" class="bo-right">
|
||||
<label for="chkall" class="sound_only">진열정보 전체</label>
|
||||
<th scope="col" class="bo-right">
|
||||
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
|
||||
</th>
|
||||
<th scope="col" rowspan="2">분류</th>
|
||||
<th scope="col" rowspan="2">아이템</th>
|
||||
<th scope="col" rowspan="2">진열기간</th>
|
||||
<th scope="col">분류</th>
|
||||
<th scope="col" colspan="2">아이템</th>
|
||||
<th scope="col">진열기간</th>
|
||||
<th scope="col" colspan="2">구매금액</th>
|
||||
<th scope="col" colspan="2">구매<?=$config['cf_exp_name']?></th>
|
||||
<th scope="col" colspan="4">교환아이템</th>
|
||||
<th scope="col" colspan="2">교환타이틀</th>
|
||||
<th scope="col">구매갯수</th>
|
||||
<th scope="col">재고갯수</th>
|
||||
<th scope="col">순서</th>
|
||||
<th scope="col">관리</th>
|
||||
</tr>
|
||||
|
||||
<th scope="col" class="bo-left bo-no-bottom">구매금액</th>
|
||||
<th scope="col" class="bo-left bo-no-bottom">구매경험치</th>
|
||||
<th scope="col" class="bo-left bo-no-bottom">교환아이템</th>
|
||||
<th scope="col" class="bo-left bo-no-bottom">교환타이틀</th>
|
||||
<th scope="col" class="bo-left bo-no-bottom">구매갯수</th>
|
||||
<th scope="col" rowspan="2" class="bo-left">순서</th>
|
||||
<th scope="col" rowspan="2" class="bo-left">관리</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col" class="bo-left">소모성</th>
|
||||
<th scope="col" class="bo-left">소모성</th>
|
||||
<th scope="col" class="bo-left">소모성</th>
|
||||
<th scope="col" class="bo-left">소모성</th>
|
||||
<th scope="col" class="bo-left">재고갯수</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $shop=sql_fetch_array($result); $i++) {
|
||||
$one_update = '<a href="./shop_form.php?w=u&sh_id='.$shop['sh_id'].'&'.$qstr.'">수정</a>';
|
||||
$bg = 'bg'.($i%2);
|
||||
|
||||
$is_order_limit = false;
|
||||
?>
|
||||
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td rowspan="2" class="txt-center">
|
||||
<td style="width:30px; padding:0;" class="txt-center">
|
||||
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
|
||||
<input type="hidden" name="sh_id[<?php echo $i ?>]" value="<?php echo $shop['sh_id'] ?>" />
|
||||
</td>
|
||||
|
||||
<td rowspan="2">
|
||||
<select name="ca_name[<?php echo $i ?>]">
|
||||
<td style="width:100px;">
|
||||
<select name="ca_name[<?php echo $i ?>]" style="width:100%;">
|
||||
<option value="">카테고리</option>
|
||||
<? for($k =0; $k < count($category); $k++) {
|
||||
if(!$category[$k]) continue;
|
||||
|
|
@ -151,21 +148,23 @@ $colspan = 13;
|
|||
<? } ?>
|
||||
</select>
|
||||
</td>
|
||||
<td rowspan="2" class="txt-left">
|
||||
<td style="width:27px; padding:0; border-right-width:0;">
|
||||
<? if($shop['it_id']) { ?>
|
||||
<img src="<?=get_item_img($shop['it_id'])?>" style="max-width: 20px;"/>
|
||||
<?=get_item_name($shop['it_id'])?>
|
||||
<img src="<?=get_item_img($shop['it_id'])?>" style="max-width:20px; max-height:20px;"/>
|
||||
<? } ?>
|
||||
</td>
|
||||
<td style="text-align:left; padding-left:0;">
|
||||
<? if($shop['it_id']) { echo get_item_name($shop['it_id']); } ?>
|
||||
</td>
|
||||
|
||||
<td rowspan="2" class="txt-left">
|
||||
<? if($shop['sh_date_s']) { ?>
|
||||
<td class="txt-left">
|
||||
<? if($shop['sh_date_s']) { $is_order_limit = true; ?>
|
||||
<p><?=date('Y-m-d', strtotime($shop['sh_date_s']))?> ~ <?=date('Y-m-d', strtotime($shop['sh_date_e']))?></p>
|
||||
<? } ?>
|
||||
<? if($shop['sh_time_s']) { ?>
|
||||
<? if($shop['sh_time_s']) { $is_order_limit = true; ?>
|
||||
<p><?=$shop['sh_time_s']?>시 ~ <?=$shop['sh_time_e']?>시</p>
|
||||
<? } ?>
|
||||
<? if($shop['sh_week']) {
|
||||
<? if($shop['sh_week']) { $is_order_limit = true;
|
||||
echo "<p>";
|
||||
$str_week = explode("||", $shop['sh_week']);
|
||||
$add_str = "";
|
||||
|
|
@ -175,27 +174,50 @@ $colspan = 13;
|
|||
<?=$add_str.$yoil[$str_week[$k]]?>
|
||||
<?
|
||||
$add_str = ", ";
|
||||
} echo "</p>"; } ?>
|
||||
} echo "</p>"; }
|
||||
|
||||
if(!$is_order_limit) { echo "<span style='opacity:.5;'>상시판매</span>"; }
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input type="text" name="sh_money[<?php echo $i ?>]" value="<?php echo get_text($shop['sh_money']) ?>" size="3">
|
||||
<td style="width:30px; padding:0; border-right-width:0;">
|
||||
<input type="checkbox" name="sh_use_money[<?php echo $i ?>]" value="1" <?php echo $shop['sh_use_money']?"checked":"" ?>>
|
||||
</td>
|
||||
<td style="width:80px; padding-left:0;">
|
||||
<input type="text" name="sh_money[<?php echo $i ?>]" value="<?php echo get_text($shop['sh_money']) ?>" style="width:100%;">
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input type="text" name="sh_exp[<?php echo $i ?>]" value="<?php echo get_text($shop['sh_exp']) ?>" size="3">
|
||||
<td style="width:30px; padding:0; border-right-width:0;">
|
||||
<input type="checkbox" name="sh_use_exp[<?php echo $i ?>]" value="1" <?php echo $shop['sh_use_exp']?"checked":"" ?>>
|
||||
</td>
|
||||
<td style="width:80px; padding-left:0;">
|
||||
<input type="text" name="sh_exp[<?php echo $i ?>]" value="<?php echo get_text($shop['sh_exp']) ?>" style="width:100%;">
|
||||
</td>
|
||||
|
||||
<td class="txt-left">
|
||||
|
||||
<td style="width:30px; padding:0; border-right-width:0;">
|
||||
<input type="checkbox" name="sh_use_has_item[<?php echo $i ?>]" value="1" <?php echo $shop['sh_use_has_item']?"checked":"" ?>>
|
||||
</td>
|
||||
<td style="width:27px; padding:0; border-right-width:0;">
|
||||
<? if($shop['sh_has_item']) { ?>
|
||||
<img src="<?=get_item_img($shop['sh_has_item'])?>" style="max-width: 20px;"/>
|
||||
<?=get_item_name($shop['sh_has_item'])?>
|
||||
<? } else { ?>
|
||||
-
|
||||
<img src="<?=get_item_img($shop['sh_has_item'])?>" style="max-width:20px; max-height:20px;"/>
|
||||
<? } ?>
|
||||
</td>
|
||||
<td style="text-align:left; padding-left:0; padding-right:0; border-right-width:0;">
|
||||
<? if($shop['sh_has_item']) { echo get_item_name($shop['sh_has_item']); } else { echo "-"; } ?>
|
||||
</td>
|
||||
<td style="width:60px;">
|
||||
<input type="text" name="sh_has_item_count[<?php echo $i ?>]" value="<?php echo get_text($shop['sh_has_item_count']) ?>" style="width:70%;">개
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td style="width:30px; padding:0; border-right-width:0;">
|
||||
<input type="checkbox" name="sh_use_has_title[<?php echo $i ?>]" value="1" <?php echo $shop['sh_use_has_title']?"checked":"" ?>>
|
||||
</td>
|
||||
<td style="text-align:left; padding-left:0;">
|
||||
<? if($shop['sh_has_title']) { ?>
|
||||
<?=get_title_image($shop['sh_has_title'])?>
|
||||
<? } else { ?>
|
||||
|
|
@ -203,34 +225,21 @@ $colspan = 13;
|
|||
<? } ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input type="text" name="sh_limit[<?php echo $i ?>]" value="<?php echo get_text($shop['sh_limit']) ?>" size="5">
|
||||
<td style="width:50px;">
|
||||
<input type="text" name="sh_limit[<?php echo $i ?>]" value="<?php echo get_text($shop['sh_limit']) ?>" style="width:100%;">
|
||||
</td>
|
||||
<td rowspan="2">
|
||||
<input type="text" name="sh_order[<?php echo $i ?>]" value="<?php echo get_text($shop['sh_order']) ?>" size="5">
|
||||
<td style="width:50px;">
|
||||
<input type="text" name="sh_qty[<?php echo $i ?>]" value="<?php echo get_text($shop['sh_qty']) ?>" style="width:100%;">
|
||||
</td>
|
||||
<td rowspan="2" class="td_mngsmall">
|
||||
<td style="width:50px;">
|
||||
<input type="text" name="sh_order[<?php echo $i ?>]" value="<?php echo get_text($shop['sh_order']) ?>" style="width:100%;">
|
||||
</td>
|
||||
<td style="width:50px;" class="td_mngsmall">
|
||||
<?php echo $one_update ?>
|
||||
<?php echo $one_copy ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="<?php echo $bg; ?>">
|
||||
<td class="bo-no-left">
|
||||
<input type="checkbox" name="sh_use_money[<?php echo $i ?>]" value="1" <?php echo $shop['sh_use_money']?"checked":"" ?>>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="sh_use_exp[<?php echo $i ?>]" value="1" <?php echo $shop['sh_use_exp']?"checked":"" ?>>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="sh_use_has_item[<?php echo $i ?>]" value="1" <?php echo $shop['sh_use_has_item']?"checked":"" ?>>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="sh_use_has_title[<?php echo $i ?>]" value="1" <?php echo $shop['sh_use_has_title']?"checked":"" ?>>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="sh_qty[<?php echo $i ?>]" value="<?php echo get_text($shop['sh_qty']) ?>" size="5">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
if ($i == 0)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ if ($_POST['act_button'] == "선택수정") {
|
|||
sh_use_exp = '{$_POST['sh_use_exp'][$k]}',
|
||||
sh_use_has_title = '{$_POST['sh_use_has_title'][$k]}',
|
||||
sh_use_has_item = '{$_POST['sh_use_has_item'][$k]}',
|
||||
sh_has_item_count = '{$_POST['sh_has_item_count'][$k]}',
|
||||
sh_order = '{$_POST['sh_order'][$k]}'
|
||||
where sh_id = '{$_POST['sh_id'][$k]}' ";
|
||||
sql_query($sql);
|
||||
|
|
|
|||
|
|
@ -8,13 +8,20 @@ if($item['sh_id']) {
|
|||
$money = "";
|
||||
$add_str = "";
|
||||
|
||||
if($item['sh_money']) {
|
||||
if($item['sh_money'] && $item['sh_use_money']) {
|
||||
$money .= $add_str.$item['sh_money'].' '.$config['cf_money_pice'];
|
||||
$add_str = ", ";
|
||||
}
|
||||
|
||||
if($item['sh_exp']) {
|
||||
if($item['sh_exp'] && $item['sh_use_exp']) {
|
||||
$money .= $add_str.$item['sh_exp'].' '.$config['cf_exp_pice'];
|
||||
$add_str = ", ";
|
||||
}
|
||||
|
||||
if($item['sh_has_item'] && $item['sh_use_has_item']) {
|
||||
$item['sh_has_item_count'] = ($item['sh_has_item_count'] == '' || $item['sh_has_item_count'] == '0') ? 1 : $item['sh_has_item_count'];
|
||||
$money .= $add_str.get_item_name($item['sh_has_item']).' '.$item['sh_has_item_count'].'개';
|
||||
$add_str = ", ";
|
||||
}
|
||||
|
||||
if($item['it_content2']) {
|
||||
|
|
|
|||
|
|
@ -50,15 +50,18 @@ if($character['ch_id'] && $character['ch_state'] == '승인') {
|
|||
|
||||
if($item['sh_has_item']) {
|
||||
// 구매 아이템 존재 시
|
||||
$in = sql_fetch("select in_id from {$g5['inventory_table']} where ch_id = '{$character['ch_id']}' and it_id = '{$item['sh_has_item']}'");
|
||||
if(!$in['in_id']) {
|
||||
$item['sh_has_item_count'] = $item['sh_has_item_count'] == 0 ? 1 : $item['sh_has_item_count'];
|
||||
$in = sql_fetch("select count(in_id) as cnt, in_id from {$g5['inventory_table']} where ch_id = '{$character['ch_id']}' and it_id = '{$item['sh_has_item']}'");
|
||||
|
||||
if($in['cnt'] < $item['sh_has_item_count']) {
|
||||
// 필요 아이템 미소유
|
||||
$has_item_name = get_item_name($item['sh_has_item']);
|
||||
$msg .= $has_item_name.j($has_item_name, '이')." 있어야 살 수 있습니다.<br />";
|
||||
$msg .= $has_item_name.j($has_item_name, '이')." ".$item['sh_has_item_count']."개 있어야 살 수 있습니다.<br />";
|
||||
$is_able_buy = false;
|
||||
} else if($item['sh_use_has_item']) {
|
||||
// 아이템 소모
|
||||
$use_inventory_item = $in['in_id'];
|
||||
$use_inventory_item = $item['sh_has_item'];
|
||||
$use_inventory_item_count = $item['sh_has_item_count'];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -146,10 +149,16 @@ if($character['ch_id'] && $character['ch_state'] == '승인') {
|
|||
$ex_point = $use_exp_point * -1;
|
||||
insert_exp($character['ch_id'], $ex_point, $ex_content, $action);
|
||||
}
|
||||
|
||||
if($use_inventory_item) {
|
||||
// 아이템 제거
|
||||
sql_query("delete from {$g5['inventory_table']} where in_id = '{$use_inventory_item}'");
|
||||
$item_result = sql_query("select in_id from {$g5['inventory_table']} where ch_id = '{$character['ch_id']}' and it_id = '{$use_inventory_item}' order by se_ch_name asc, in_id asc limit 0, {$use_inventory_item_count}");
|
||||
for($k = 0; $in = sql_fetch_array($item_result); $k++) {
|
||||
// 인벤에서 제거
|
||||
delete_inventory($in['in_id'], 0);
|
||||
}
|
||||
}
|
||||
|
||||
if($use_has_title) {
|
||||
// 타이틀 제거
|
||||
sql_query("delete from {$g5['title_has_table']} where hi_id = '{$use_has_title}'");
|
||||
|
|
|
|||
Loading…
Reference in a new issue