JSON -> Json
- 대체 왜 어떤 파일에는 에러가 나지 않았는가
This commit is contained in:
+2
-2
@@ -1054,10 +1054,10 @@ function increaseRefresh($type = "", $cnt = 1)
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => "refresh",
|
'path' => "refresh",
|
||||||
'arg' => JSON::encode([
|
'arg' => Json::encode([
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
]),
|
]),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'generalID' => $generalID,
|
'generalID' => $generalID,
|
||||||
'generalName' => $session->generalName,
|
'generalName' => $session->generalName,
|
||||||
'userName' => $session->userName,
|
'userName' => $session->userName,
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ function _setGeneralCommand(GeneralCommand $command, array $turnList):void {
|
|||||||
|
|
||||||
$db->update('general_turn', [
|
$db->update('general_turn', [
|
||||||
'action'=>$commandName,
|
'action'=>$commandName,
|
||||||
'arg'=>Json::encode($arg, JSON::EMPTY_ARRAY_IS_DICT),
|
'arg'=>Json::encode($arg, Json::EMPTY_ARRAY_IS_DICT),
|
||||||
'brief'=>$brief
|
'brief'=>$brief
|
||||||
], 'general_id = %i AND turn_idx IN %li', $generalID, $turnList);
|
], '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', [
|
$db->update('nation_turn', [
|
||||||
'action'=>$commandName,
|
'action'=>$commandName,
|
||||||
'arg'=>Json::encode($arg, JSON::EMPTY_ARRAY_IS_DICT),
|
'arg'=>Json::encode($arg, Json::EMPTY_ARRAY_IS_DICT),
|
||||||
'brief'=>$brief
|
'brief'=>$brief
|
||||||
], 'nation_id = %i AND officer_level = %i AND turn_idx IN %li', $nationID, $officerLevel, $turnList);
|
], 'nation_id = %i AND officer_level = %i AND turn_idx IN %li', $nationID, $officerLevel, $turnList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -899,7 +899,7 @@ function checkEmperior()
|
|||||||
'tiger' => $tigerstr,
|
'tiger' => $tigerstr,
|
||||||
'eagle' => $eaglestr,
|
'eagle' => $eaglestr,
|
||||||
'gen' => $gen,
|
'gen' => $gen,
|
||||||
'history' => JSON::encode($nationHistory),
|
'history' => Json::encode($nationHistory),
|
||||||
'aux' => $statGeneral['aux']
|
'aux' => $statGeneral['aux']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ if(!$member){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$userNick = $member['name'];
|
$userNick = $member['name'];
|
||||||
$memberPenalty = JSON::decode($member['penalty'] ?? '{}');
|
$memberPenalty = Json::decode($member['penalty'] ?? '{}');
|
||||||
$penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
|
$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);
|
$pickResult = $db->queryFirstField('SELECT pick_result FROM select_npc_token WHERE `owner`=%i AND `valid_until`>=%s', $userID, $now);
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class Join extends \sammo\BaseAPI
|
|||||||
return "잘못된 접근입니다!!!";
|
return "잘못된 접근입니다!!!";
|
||||||
}
|
}
|
||||||
|
|
||||||
$memberPenalty = JSON::decode($member['penalty'] ?? "{}");
|
$memberPenalty = Json::decode($member['penalty'] ?? "{}");
|
||||||
$penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
|
$penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class SendMessage extends \sammo\BaseAPI
|
|||||||
return '장수가 없습니다.';
|
return '장수가 없습니다.';
|
||||||
}
|
}
|
||||||
|
|
||||||
$penalty = JSON::decode($me['penalty'] ?? '{}');
|
$penalty = Json::decode($me['penalty'] ?? '{}');
|
||||||
|
|
||||||
$limitState = checkLimit($me['refresh_score']);
|
$limitState = checkLimit($me['refresh_score']);
|
||||||
if ($limitState >= 2) {
|
if ($limitState >= 2) {
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
foreach ($rawGeneralList as $rawGeneral) {
|
foreach ($rawGeneralList as $rawGeneral) {
|
||||||
//General 생성?
|
//General 생성?
|
||||||
if (key_exists('aux', $rawGeneral)) {
|
if (key_exists('aux', $rawGeneral)) {
|
||||||
$rawGeneral['aux'] = \sammo\JSON::decode($rawGeneral['aux']);
|
$rawGeneral['aux'] = \sammo\Json::decode($rawGeneral['aux']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = [];
|
$item = [];
|
||||||
|
|||||||
+23
-20
@@ -93,8 +93,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'state' => 'validate',
|
'state' => 'validate',
|
||||||
'reason' => $validateResult
|
'reason' => $validateResult
|
||||||
@@ -123,8 +123,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'state' => 'launch',
|
'state' => 'launch',
|
||||||
'reason' => $result
|
'reason' => $result
|
||||||
@@ -139,8 +139,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'state' => 'launch',
|
'state' => 'launch',
|
||||||
'reason' => $recoveryType->info(),
|
'reason' => $recoveryType->info(),
|
||||||
@@ -168,8 +168,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => true,
|
'result' => true,
|
||||||
'state' => 'cache_not_modified',
|
'state' => 'cache_not_modified',
|
||||||
]),
|
]),
|
||||||
@@ -183,8 +183,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => true,
|
'result' => true,
|
||||||
'state' => 'cache_not_modified',
|
'state' => 'cache_not_modified',
|
||||||
]),
|
]),
|
||||||
@@ -199,8 +199,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => true,
|
'result' => true,
|
||||||
'state' => 'success_simple',
|
'state' => 'success_simple',
|
||||||
'set_cache' => $setCache,
|
'set_cache' => $setCache,
|
||||||
@@ -216,8 +216,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => true,
|
'result' => true,
|
||||||
'state' => 'success_complex',
|
'state' => 'success_complex',
|
||||||
'set_cache' => $setCache,
|
'set_cache' => $setCache,
|
||||||
@@ -226,6 +226,7 @@ class APIHelper
|
|||||||
$result['result'] = $result['result'] ?? true;
|
$result['result'] = $result['result'] ?? true;
|
||||||
Json::die($result, $setCache ? 0 : Json::NO_CACHE);
|
Json::die($result, $setCache ? 0 : Json::NO_CACHE);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
$session = Session::getInstance();
|
||||||
$errMsg = $e->getMessage();
|
$errMsg = $e->getMessage();
|
||||||
$errTrace = $e->getTraceAsString();
|
$errTrace = $e->getTraceAsString();
|
||||||
$logDB->insert('api_log', [
|
$logDB->insert('api_log', [
|
||||||
@@ -233,8 +234,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'state' => 'error_exception',
|
'state' => 'error_exception',
|
||||||
'errMsg' => $errMsg,
|
'errMsg' => $errMsg,
|
||||||
@@ -244,6 +245,7 @@ class APIHelper
|
|||||||
Json::dieWithReason("{$errMsg}\n{$errTrace}");
|
Json::dieWithReason("{$errMsg}\n{$errTrace}");
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
logExceptionByCustomHandler($e, false);
|
logExceptionByCustomHandler($e, false);
|
||||||
|
$session = Session::getInstance();
|
||||||
$errMsg = $e->getMessage();
|
$errMsg = $e->getMessage();
|
||||||
$errTrace = $e->getTraceAsString();
|
$errTrace = $e->getTraceAsString();
|
||||||
$logDB->insert('api_log', [
|
$logDB->insert('api_log', [
|
||||||
@@ -251,8 +253,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'state' => 'error_throwable',
|
'state' => 'error_throwable',
|
||||||
'errMsg' => $errMsg,
|
'errMsg' => $errMsg,
|
||||||
@@ -261,14 +263,15 @@ class APIHelper
|
|||||||
]);
|
]);
|
||||||
Json::dieWithReason("{$errMsg}\n{$errTrace}");
|
Json::dieWithReason("{$errMsg}\n{$errTrace}");
|
||||||
} catch (mixed $e) {
|
} catch (mixed $e) {
|
||||||
|
$session = Session::getInstance();
|
||||||
$errStr = strval($e);
|
$errStr = strval($e);
|
||||||
$logDB->insert('api_log', [
|
$logDB->insert('api_log', [
|
||||||
'user_id' => $session->userID ?? 0,
|
'user_id' => $session->userID ?? 0,
|
||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'state' => 'error_mixed',
|
'state' => 'error_mixed',
|
||||||
'errMsg' => $errStr,
|
'errMsg' => $errStr,
|
||||||
|
|||||||
Reference in New Issue
Block a user