JSON -> Json

- 대체 왜 어떤 파일에는 에러가 나지 않았는가
This commit is contained in:
2024-02-20 18:45:40 +09:00
parent 83abf44380
commit faff3f4e6a
8 changed files with 32 additions and 29 deletions
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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);
}
+1 -1
View File
@@ -899,7 +899,7 @@ function checkEmperior()
'tiger' => $tigerstr,
'eagle' => $eaglestr,
'gen' => $gen,
'history' => JSON::encode($nationHistory),
'history' => Json::encode($nationHistory),
'aux' => $statGeneral['aux']
]);
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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 = [];
+23 -20
View File
@@ -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,