fix itemlog display and logger

This commit is contained in:
Amberstone 2024-10-07 11:52:53 +09:00
parent 37a2c53f79
commit f2283d75e1
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
8 changed files with 162 additions and 85 deletions

View file

@ -52,10 +52,10 @@ $menu["config"]->addChildMenu("config", "홈페이지 상세관리", G5_ADMIN_UR
$menu["config"]->getLastAddedMenu()->addSubFile("/config_form_update.php");
if (Community::isInitCommunity()) {
$menu["config"]->addChildMenu("config", "메인슬라이드 관리", G5_ADMIN_URL . "/banner_list.php", true, 700, "\F2CC", 0);
$menu["config"]->addChildMenu("config", "메인슬라이드 관리", G5_ADMIN_URL . "/banner_list.php", true, 700, "\F66D", 0);
$menu["config"]->getLastAddedMenu()->addSubFile("/banner_form.php");
$menu["config"]->addChildMenu("config", "인트로 관리", G5_ADMIN_URL . "/intro_list.php", true, 700, "\F289", 0);
$menu["config"]->addChildMenu("config", "인트로 관리", G5_ADMIN_URL . "/intro_list.php", true, 710, "\F7BF", 0);
$menu["config"]->getLastAddedMenu()->addSubFile("/intro_form.php");
$menu["config"]->getLastAddedMenu()->addSubFile("/intro_form_update.php");
}

View file

@ -52,8 +52,8 @@ if (Community::isInitCommunity()) {
$menu["item"]->getLastAddedMenu()->addSubFile("/inventory_update.php");
$menu["item"]->addChildMenu("item", "레시피 관리", G5_ADMIN_URL . "/recipe_list.php", true, 0, "\F442", 0);
$menu["item"]->addChildMenu("item", "아이템 기록", G5_ADMIN_URL . "/itemlog_list.php", true, 0, "\F50F", 0);
$menu["item"]->addChildMenu("item", "아이템 구매 기록", G5_ADMIN_URL . "/order_list.php", true, 0, "\F50F", 0);
$menu["item"]->addChildMenu("item", "아이템 사용 기록", G5_ADMIN_URL . "/itemlog_list.php", true, 0, "\F50F", 0);
$menu["character"]->addChildMenu("character", "캐릭터 관리", G5_ADMIN_URL . "/character_list.php", true, 0, "\F379", 0);
$menu["character"]->getLastAddedMenu()->addSubFile("/character_list_update.php");

View file

@ -32,7 +32,7 @@ if ($take_type == 'A') {
$result = sql_query($sql);
for ($i = 0; $ch = sql_fetch_array($result); $i++) {
insert_inventory($ch['ch_id'], $it_id, $it, $item_count);
Item::giveItem($ch['ch_id'], $it_id, $it, $item_count, "시스템 지급");
}
} else {
// 개별지급
@ -43,10 +43,11 @@ if ($take_type == 'A') {
$ch = sql_fetch("select ch_id, ch_name from {$g5['character_table']} where ch_id = '{$ch_id}'");
}
if (!$ch['ch_id'])
if (!$ch['ch_id']) {
alert('존재하는 캐릭터가 아닙니다.');
}
insert_inventory($ch['ch_id'], $it_id, $it, $item_count);
Item::giveItem($ch['ch_id'], $it_id, $it, $item_count, "시스템 지급");
}
goto_url('./inventory_list.php?' . $qstr);

View file

@ -5,7 +5,7 @@ auth_check($auth[$sub_menu], 'r');
$token = get_token();
$sql_common = " FROM {$g5['item_modifylog']} o ";
$sql_common = " FROM {$g5['item_modify_table']} o ";
$sql_search = " WHERE (1) ";
if ($stx) {
@ -19,7 +19,7 @@ if ($stx) {
}
if (!$sst) {
$sst = "o.srl";
$sst = "o.im_id";
$sod = "DESC";
}
@ -58,7 +58,7 @@ $g5['title'] = '아이템 기록';
include_once './admin.head.php';
$colspan = 4; ?>
$colspan = 5; ?>
<div class="local_ov01 local_ov">
<?php echo $listall ?>
전체 <?php echo number_format($total_count) ?>
@ -79,10 +79,19 @@ $colspan = 4; ?>
text-align: left;
}
</style>
<form name="fmodifylist" id="fmodifylist" method="post" action="./itemlog_list_delete.php"
onsubmit="return fmodifylist_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 ?>">
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<colgroup>
<col style="width: 50px;" />
<col style="width: 150px;" />
<col />
<col style="width: 150px;" />
@ -90,6 +99,10 @@ $colspan = 4; ?>
</colgroup>
<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>
@ -105,13 +118,17 @@ $colspan = 4; ?>
$mb = get_member($row['mb_id']);
?>
<tr class="<?php echo $bg; ?>">
<td>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
<input type="hidden" name="im_id[<?php echo $i ?>]" value="<?php echo $row['im_id'] ?>" />
</td>
<td><?php echo get_text($ch['ch_name']); ?></td>
<td class="al">
<img src="<?= $it['it_img'] ?>" style="max-width: 30px;" />
<?php echo get_text($it['it_name']); ?>
</td>
<td><?php echo get_text($row['using_type']); ?></td>
<td><?php echo ($row['regdate'] == '0000-00-00 00:00:00') ? '' : $row['regdate'] ?></td>
<td><?php echo get_text($row['im_using_type']); ?></td>
<td><?php echo ($row['im_date'] == '0000-00-00 00:00:00') ? '' : $row['im_date'] ?></td>
</tr><?php
}
if ($i == 0)
@ -120,6 +137,27 @@ $colspan = 4; ?>
</tbody>
</table>
</div>
<div class="list_confirm">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
</div>
</form>
<?php
echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page=");
?><script>
function fmodifylist_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

@ -0,0 +1,20 @@
<?php
include_once "./_common.php";
check_demo();
auth_check($auth[$sub_menu], 'd');
check_token();
print_r($_POST);
for ($i = 0; $i < count($_POST['chk']); $i++) {
$k = $_POST['chk'][$i];
$temp_or_id = trim($_POST['im_id'][$k]);
if (!$temp_or_id) {
return;
}
sql_query("DELETE FROM {$g5['item_modify_table']} WHERE im_id = '{$temp_or_id}'");
}
goto_url('./order_list.php?' . $qstr);

View file

@ -69,8 +69,9 @@ class Item extends Module
{
global $g5;
self::addUseLog($inventory_id, $type . ($delete != 0 ? " (삭제)" : " (보존)"));
if ($delete === 0) {
self::addUseLog($inventory_id, $type);
sql_query("DELETE FROM {$g5['inventory_table']} WHERE in_id = '{$inventory_id}'");
}
}
@ -117,19 +118,26 @@ class Item extends Module
public static function addGetLog($it_id, $ch_id, $item = null, $type = '획득')
{
global $g5;
try {
if ($item == null || array_key_exists('it_id', $item)) {
$item = self::getItem($it_id);
}
$item = addslashes(base64_encode(json_encode($item)));
$item = $item ? addslashes(json_encode($item, JSON_UNESCAPED_UNICODE)) : "{}";
$sql = "INSERT INTO `{$g5['item_modify_table']}` SET
`it_id` = '{$it_id}',
`ch_id` = '{$ch_id}',
`it_count` = 1,
`using_type` = '{$type}',
`origin_item` = '{$item}'";
`im_using_type` = '{$type}',
`im_origin_item` = '{$item}'";
sql_query($sql);
if (sql_error_info()) {
throw new exception(sql_error_info());
}
} catch(Exception $x) {
}
}
/**
@ -139,9 +147,10 @@ class Item extends Module
public static function addUseLog($in_id, $type)
{
global $g5;
try {
$origin_item = sql_fetch("SELECT * FROM {$g5['inventory_table']} where in_id = '{$in_id}'");
$item = addslashes(base64_encode(json_encode($origin_item)));
$item = $origin_item ? addslashes(json_encode($origin_item, JSON_UNESCAPED_UNICODE)) : "{}";
$it_id = $origin_item['it_id'];
$ch_id = $origin_item['ch_id'];
@ -149,9 +158,16 @@ class Item extends Module
`it_id` = '{$it_id}',
`ch_id` = '{$ch_id}',
`it_count` = 1,
`using_type` = '{$type}',
`origin_item` = '{$item}'";
`im_using_type` = '{$type}',
`im_origin_item` = '{$item}'";
sql_query($sql);
if (sql_error_info()) {
throw new exception(sql_error_info());
}
} catch(Exception $x) {
}
}
}

View file

@ -38,7 +38,9 @@ function display_banner($skin = '', $start = true, $effect = 'slide', $speed = '
if (!$cache_fwrite)
include $cache_file;
}
} else if (!G5_USE_CACHE || $cache_fwrite) {
}
if (!G5_USE_CACHE || $cache_fwrite) {
$banner = [];
$sql = " select * from {$g5['banner_table']} where '" . G5_TIME_YMDHIS . "' between bn_begin_time and bn_end_time order by bn_order, bn_id desc ";
$result = sql_query($sql);