Commit 027fb54b authored by wanjilong's avatar wanjilong

add: 修复 raw REQUEST,接收POST

parent 03040b99
...@@ -40,7 +40,8 @@ class OrderController extends Base ...@@ -40,7 +40,8 @@ class OrderController extends Base
public function refundAction() { public function refundAction() {
$params = $this->params; $params = $this->getRequest()->getPost();
if(!empty($params['order_item_id'])) { if(!empty($params['order_item_id'])) {
if(!is_array($params['order_item_id'])) { if(!is_array($params['order_item_id'])) {
$params['order_item_id'] = explode(',', $params['order_item_id']); $params['order_item_id'] = explode(',', $params['order_item_id']);
...@@ -50,7 +51,6 @@ class OrderController extends Base ...@@ -50,7 +51,6 @@ class OrderController extends Base
$params['order_item_id'] = []; $params['order_item_id'] = [];
} }
if(empty($params['order_id'])) { if(empty($params['order_id'])) {
throw new PayException(['cus' => 1]); throw new PayException(['cus' => 1]);
} }
......
...@@ -46,7 +46,7 @@ class Hook extends \Yaf\Plugin_Abstract { ...@@ -46,7 +46,7 @@ class Hook extends \Yaf\Plugin_Abstract {
} }
public function preDispatch(\Yaf\Request_Abstract $request, \Yaf\Response_Abstract $response) { public function preDispatch(\Yaf\Request_Abstract $request, \Yaf\Response_Abstract $response) {
// application/json形式,仅处理$_POST, 不整合$_GET, $_REQUEST // application/json形式,仅处理$_POST, 不整合$_GET
if($request->isPost() if($request->isPost()
&& $request->getServer('CONTENT_TYPE') == 'application/json') { && $request->getServer('CONTENT_TYPE') == 'application/json') {
...@@ -57,10 +57,13 @@ class Hook extends \Yaf\Plugin_Abstract { ...@@ -57,10 +57,13 @@ class Hook extends \Yaf\Plugin_Abstract {
} }
$_POST = json_decode($jsonPost, true); $_POST = json_decode($jsonPost, true);
if(!is_array($_POST)) { if(!is_array($_POST)) {
$_POST = []; $_POST = [];
FileLog::error('bp-gateway', 'json decode error raw:' . $jsonPost); FileLog::error('bp-gateway', 'json decode error raw:' . $jsonPost);
} }
$_REQUEST = array_merge($_REQUEST, $_POST);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment