diff --git a/hwe/func.php b/hwe/func.php index f6d46f32..430b8a6e 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1054,10 +1054,10 @@ function increaseRefresh($type = "", $cnt = 1) 'ip' => $ip, 'date' => $date, 'path' => "refresh", - 'arg' => JSON::encode([ + 'arg' => Json::encode([ 'type' => $type, ]), - 'aux' => JSON::encode([ + 'aux' => Json::encode([ 'generalID' => $generalID, 'generalName' => $session->generalName, 'userName' => $session->userName, diff --git a/hwe/func_command.php b/hwe/func_command.php index eebd0ca2..74cdf284 100644 --- a/hwe/func_command.php +++ b/hwe/func_command.php @@ -213,7 +213,7 @@ function _setGeneralCommand(GeneralCommand $command, array $turnList):void { $db->update('general_turn', [ 'action'=>$commandName, - 'arg'=>Json::encode($arg, JSON::EMPTY_ARRAY_IS_DICT), + 'arg'=>Json::encode($arg, Json::EMPTY_ARRAY_IS_DICT), 'brief'=>$brief ], 'general_id = %i AND turn_idx IN %li', $generalID, $turnList); } @@ -233,7 +233,7 @@ function _setNationCommand(NationCommand $command, array $turnList):void { $db->update('nation_turn', [ 'action'=>$commandName, - 'arg'=>Json::encode($arg, JSON::EMPTY_ARRAY_IS_DICT), + 'arg'=>Json::encode($arg, Json::EMPTY_ARRAY_IS_DICT), 'brief'=>$brief ], 'nation_id = %i AND officer_level = %i AND turn_idx IN %li', $nationID, $officerLevel, $turnList); } diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index fdfae574..462c2048 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -899,7 +899,7 @@ function checkEmperior() 'tiger' => $tigerstr, 'eagle' => $eaglestr, 'gen' => $gen, - 'history' => JSON::encode($nationHistory), + 'history' => Json::encode($nationHistory), 'aux' => $statGeneral['aux'] ]); diff --git a/hwe/j_select_npc.php b/hwe/j_select_npc.php index d30b1435..13005ce4 100644 --- a/hwe/j_select_npc.php +++ b/hwe/j_select_npc.php @@ -36,7 +36,7 @@ if(!$member){ } $userNick = $member['name']; -$memberPenalty = JSON::decode($member['penalty'] ?? '{}'); +$memberPenalty = Json::decode($member['penalty'] ?? '{}'); $penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []); $pickResult = $db->queryFirstField('SELECT pick_result FROM select_npc_token WHERE `owner`=%i AND `valid_until`>=%s', $userID, $now); diff --git a/hwe/sammo/API/General/Join.php b/hwe/sammo/API/General/Join.php index 33343b13..9251cc47 100644 --- a/hwe/sammo/API/General/Join.php +++ b/hwe/sammo/API/General/Join.php @@ -155,7 +155,7 @@ class Join extends \sammo\BaseAPI return "잘못된 접근입니다!!!"; } - $memberPenalty = JSON::decode($member['penalty'] ?? "{}"); + $memberPenalty = Json::decode($member['penalty'] ?? "{}"); $penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []); $db = DB::db(); diff --git a/hwe/sammo/API/Message/SendMessage.php b/hwe/sammo/API/Message/SendMessage.php index b89d0115..0b3b450e 100644 --- a/hwe/sammo/API/Message/SendMessage.php +++ b/hwe/sammo/API/Message/SendMessage.php @@ -172,7 +172,7 @@ class SendMessage extends \sammo\BaseAPI return '장수가 없습니다.'; } - $penalty = JSON::decode($me['penalty'] ?? '{}'); + $penalty = Json::decode($me['penalty'] ?? '{}'); $limitState = checkLimit($me['refresh_score']); if ($limitState >= 2) { diff --git a/hwe/sammo/API/Nation/GeneralList.php b/hwe/sammo/API/Nation/GeneralList.php index dcf25d37..928340ce 100644 --- a/hwe/sammo/API/Nation/GeneralList.php +++ b/hwe/sammo/API/Nation/GeneralList.php @@ -313,7 +313,7 @@ class GeneralList extends \sammo\BaseAPI foreach ($rawGeneralList as $rawGeneral) { //General 생성? if (key_exists('aux', $rawGeneral)) { - $rawGeneral['aux'] = \sammo\JSON::decode($rawGeneral['aux']); + $rawGeneral['aux'] = \sammo\Json::decode($rawGeneral['aux']); } $item = []; diff --git a/src/sammo/APIHelper.php b/src/sammo/APIHelper.php index 82a83ab2..ea5b2096 100644 --- a/src/sammo/APIHelper.php +++ b/src/sammo/APIHelper.php @@ -93,8 +93,8 @@ class APIHelper 'ip' => $ip, 'date' => $date, 'path' => $actionPath, - 'arg' => JSON::encode($filteredArgs), - 'aux' => JSON::encode([ + 'arg' => Json::encode($filteredArgs), + 'aux' => Json::encode([ 'result' => false, 'state' => 'validate', 'reason' => $validateResult @@ -123,8 +123,8 @@ class APIHelper 'ip' => $ip, 'date' => $date, 'path' => $actionPath, - 'arg' => JSON::encode($filteredArgs), - 'aux' => JSON::encode([ + 'arg' => Json::encode($filteredArgs), + 'aux' => Json::encode([ 'result' => false, 'state' => 'launch', 'reason' => $result @@ -139,8 +139,8 @@ class APIHelper 'ip' => $ip, 'date' => $date, 'path' => $actionPath, - 'arg' => JSON::encode($filteredArgs), - 'aux' => JSON::encode([ + 'arg' => Json::encode($filteredArgs), + 'aux' => Json::encode([ 'result' => false, 'state' => 'launch', 'reason' => $recoveryType->info(), @@ -168,8 +168,8 @@ class APIHelper 'ip' => $ip, 'date' => $date, 'path' => $actionPath, - 'arg' => JSON::encode($filteredArgs), - 'aux' => JSON::encode([ + 'arg' => Json::encode($filteredArgs), + 'aux' => Json::encode([ 'result' => true, 'state' => 'cache_not_modified', ]), @@ -183,8 +183,8 @@ class APIHelper 'ip' => $ip, 'date' => $date, 'path' => $actionPath, - 'arg' => JSON::encode($filteredArgs), - 'aux' => JSON::encode([ + 'arg' => Json::encode($filteredArgs), + 'aux' => Json::encode([ 'result' => true, 'state' => 'cache_not_modified', ]), @@ -199,8 +199,8 @@ class APIHelper 'ip' => $ip, 'date' => $date, 'path' => $actionPath, - 'arg' => JSON::encode($filteredArgs), - 'aux' => JSON::encode([ + 'arg' => Json::encode($filteredArgs), + 'aux' => Json::encode([ 'result' => true, 'state' => 'success_simple', 'set_cache' => $setCache, @@ -216,8 +216,8 @@ class APIHelper 'ip' => $ip, 'date' => $date, 'path' => $actionPath, - 'arg' => JSON::encode($filteredArgs), - 'aux' => JSON::encode([ + 'arg' => Json::encode($filteredArgs), + 'aux' => Json::encode([ 'result' => true, 'state' => 'success_complex', 'set_cache' => $setCache, @@ -226,6 +226,7 @@ class APIHelper $result['result'] = $result['result'] ?? true; Json::die($result, $setCache ? 0 : Json::NO_CACHE); } catch (\Exception $e) { + $session = Session::getInstance(); $errMsg = $e->getMessage(); $errTrace = $e->getTraceAsString(); $logDB->insert('api_log', [ @@ -233,8 +234,8 @@ class APIHelper 'ip' => $ip, 'date' => $date, 'path' => $actionPath, - 'arg' => JSON::encode($filteredArgs), - 'aux' => JSON::encode([ + 'arg' => Json::encode($filteredArgs), + 'aux' => Json::encode([ 'result' => false, 'state' => 'error_exception', 'errMsg' => $errMsg, @@ -244,6 +245,7 @@ class APIHelper Json::dieWithReason("{$errMsg}\n{$errTrace}"); } catch (\Throwable $e) { logExceptionByCustomHandler($e, false); + $session = Session::getInstance(); $errMsg = $e->getMessage(); $errTrace = $e->getTraceAsString(); $logDB->insert('api_log', [ @@ -251,8 +253,8 @@ class APIHelper 'ip' => $ip, 'date' => $date, 'path' => $actionPath, - 'arg' => JSON::encode($filteredArgs), - 'aux' => JSON::encode([ + 'arg' => Json::encode($filteredArgs), + 'aux' => Json::encode([ 'result' => false, 'state' => 'error_throwable', 'errMsg' => $errMsg, @@ -261,14 +263,15 @@ class APIHelper ]); Json::dieWithReason("{$errMsg}\n{$errTrace}"); } catch (mixed $e) { + $session = Session::getInstance(); $errStr = strval($e); $logDB->insert('api_log', [ 'user_id' => $session->userID ?? 0, 'ip' => $ip, 'date' => $date, 'path' => $actionPath, - 'arg' => JSON::encode($filteredArgs), - 'aux' => JSON::encode([ + 'arg' => Json::encode($filteredArgs), + 'aux' => Json::encode([ 'result' => false, 'state' => 'error_mixed', 'errMsg' => $errStr,