From 7b1a76871a675c8f4e3f07220cf3de9905e5eb3a Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 3 Jul 2018 21:35:17 +0900 Subject: [PATCH] =?UTF-8?q?parseJsonPost=20=EA=B8=B0=EB=B0=98=20=EB=8F=99?= =?UTF-8?q?=EC=9E=91=20=ED=8F=AC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/j_map.php | 2 +- hwe/j_msg_decide_opt.php | 2 +- hwe/j_msg_get_recent.php | 3 +-- hwe/j_msg_submit.php | 2 +- hwe/js/map.js | 17 +++++++++-------- hwe/js/msg.js | 35 ++++++++++++++--------------------- 6 files changed, 27 insertions(+), 34 deletions(-) diff --git a/hwe/j_map.php b/hwe/j_map.php index 71e13179..f68a380c 100644 --- a/hwe/j_map.php +++ b/hwe/j_map.php @@ -13,7 +13,7 @@ $defaultPost = [ 'neutralView' => false, 'showMe' => true ]; -$post = WebUtil::parseJsonPost() + $defaultPost; +$post = Json::decode(Util::getReq('data', 'string', '{}')); if(!$session->isGameLoggedIn()){ $post['neutralView'] = true; diff --git a/hwe/j_msg_decide_opt.php b/hwe/j_msg_decide_opt.php index d0e438ef..ccad9d53 100644 --- a/hwe/j_msg_decide_opt.php +++ b/hwe/j_msg_decide_opt.php @@ -17,7 +17,7 @@ if (!$generalID) { ]); } -$jsonPost = WebUtil::parseJsonPost(); +$jsonPost = Json::decode(Util::getReq('data', 'string', '{}')); $msgID = Util::toInt($jsonPost['msgID']??null); $msgResponse = $jsonPost['response']??null; diff --git a/hwe/j_msg_get_recent.php b/hwe/j_msg_get_recent.php index d41cad51..c2a422e8 100644 --- a/hwe/j_msg_get_recent.php +++ b/hwe/j_msg_get_recent.php @@ -7,8 +7,7 @@ include('func.php'); $session = Session::requireGameLogin([])->setReadOnly(); $userID = Session::getUserID(); -$jsonPost = WebUtil::parseJsonPost(); -$reqSequence = (int)Util::array_get($jsonPost['sequence'], 0); +$reqSequence = Util::getReq('sequence', 'int', null); list($generalID, $nationID, $generalName) = DB::db()->queryFirstList( diff --git a/hwe/j_msg_submit.php b/hwe/j_msg_submit.php index f5e2a066..a4b54bcb 100644 --- a/hwe/j_msg_submit.php +++ b/hwe/j_msg_submit.php @@ -4,7 +4,7 @@ namespace sammo; include 'lib.php'; include 'func.php'; -$post = WebUtil::parseJsonPost(); +$post = Json::decode(Util::getReq('data', 'string', '{}')); '@phan-var mixed[] $post'; $v = new Validator($post); diff --git a/hwe/js/map.js b/hwe/js/map.js index 23ac1e9a..ec8d4af8 100644 --- a/hwe/js/map.js +++ b/hwe/js/map.js @@ -439,14 +439,15 @@ function reloadWorldMap(option){ url: option.targetJson, type: 'post', dataType:'json', - contentType: 'application/json', - data: JSON.stringify({ - neutralView:option.neutralView, - year:option.year, - month:option.month, - showMe:option.showMe, - aux:option.aux - }) + data: { + data: JSON.stringify({ + neutralView:option.neutralView, + year:option.year, + month:option.month, + showMe:option.showMe, + aux:option.aux + }) + } }); deferred diff --git a/hwe/js/msg.js b/hwe/js/msg.js index 8f3558a0..07d11238 100644 --- a/hwe/js/msg.js +++ b/hwe/js/msg.js @@ -34,11 +34,12 @@ function responseMessage(msgID, response){ url: 'j_msg_decide_opt.php', type: 'post', dataType:'json', - contentType: 'application/json', - data: JSON.stringify({ - msgID:msgID, - response:response - }) + data: { + data: JSON.stringify({ + msgID:msgID, + response:response + }) + } }).then(refreshMsg); } @@ -54,10 +55,9 @@ function fetchMsg(){ url: 'j_msg_get_recent.php', type: 'post', dataType:'json', - contentType: 'application/json', - data: JSON.stringify({ + data: { sequence:sequence - }) + } }); } @@ -373,11 +373,12 @@ function activateMessageForm(){ url:'j_msg_submit.php', type: 'post', dataType:'json', - contentType: 'application/json', - data: JSON.stringify({ - mailbox:parseInt(targetMailbox), - text:text - }) + data: { + data: JSON.stringify({ + mailbox:parseInt(targetMailbox), + text:text + }) + } }); } else{ @@ -404,10 +405,6 @@ jQuery(function($){ url:'j_basic_info.php', type: 'post', dataType:'json', - contentType: 'application/json', - data: JSON.stringify({ - - }) }).then(registerGlobal); //sender_list.json 은 서버측에선 캐시 가능한 데이터임. @@ -415,10 +412,6 @@ jQuery(function($){ url: 'j_msg_contact_list.php', type: 'post', dataType:'json', - contentType: 'application/json', - data: JSON.stringify({ - - }) }); var MessageList = fetchMsg();