This commit is contained in:
aozhiwei 2020-11-09 14:19:23 +08:00
parent a9815ee7ab
commit c981405d8c
2 changed files with 27 additions and 45 deletions

View File

@ -28,6 +28,27 @@ class PayController {
} }
} }
public function payNotify()
{
error_log(json_encode($_REQUEST));
$channel = '';
if (isset($_REQUEST['_poly_sdk_channel'])) {
$channel = $_REQUEST['_poly_sdk_channel'];
} else {
$channel = $_REQUEST['_channel'];
}
if (!empty($_REQUEST['_unified_channel'])) {
$channel = $_REQUEST['_unified_channel'];
}
$sdk = sdkwarpper\createSdkByChannel($channel);
if (!$sdk) {
echo 'is null';
} else {
$sdk->setChannel($channel);
$sdk->payNotify();
}
}
public function getPendingOrderList() public function getPendingOrderList()
{ {
if (!phpcommon\isValidSessionId($_REQUEST['account_id'], $_REQUEST['session_id'])) { if (!phpcommon\isValidSessionId($_REQUEST['account_id'], $_REQUEST['session_id'])) {
@ -50,29 +71,12 @@ class PayController {
$order_ctrl->deliver($_REQUEST['account_id'], $_REQUEST['cp_orderid']); $order_ctrl->deliver($_REQUEST['account_id'], $_REQUEST['cp_orderid']);
} }
public function payNotify()
{
error_log(json_encode($_REQUEST));
$channel = '';
if (isset($_REQUEST['_poly_sdk_channel'])) {
$channel = $_REQUEST['_poly_sdk_channel'];
} else {
$channel = $_REQUEST['_channel'];
}
if (!empty($_REQUEST['_unified_channel'])) {
$channel = $_REQUEST['_unified_channel'];
}
$sdk = sdkwarpper\createSdkByChannel($channel);
if (!$sdk) {
echo 'is null';
} else {
$sdk->setChannel($channel);
$sdk->payNotify();
}
}
public function queryOrderInfo() public function queryOrderInfo()
{ {
if (!phpcommon\isValidSessionId($_REQUEST['account_id'], $_REQUEST['session_id'])) {
phpcommon\sendError(1, 'session无效');
return;
}
require 'classes/OrderCtrl.php'; require 'classes/OrderCtrl.php';
$order_ctrl = new classes\OrderCtrl(); $order_ctrl = new classes\OrderCtrl();
$order_info = $order_ctrl->getOrder($_REQUEST['cp_orderid']); $order_info = $order_ctrl->getOrder($_REQUEST['cp_orderid']);
@ -84,7 +88,9 @@ class PayController {
'errcode' => 0, 'errcode' => 0,
'errmsg' => '', 'errmsg' => '',
'cp_orderid' => $order_info['orderid'], 'cp_orderid' => $order_info['orderid'],
'sp_orderid' => $order_info['sp_orderid'],
'status' => $order_info['status'], 'status' => $order_info['status'],
'itemid' => $order_info['itemid'],
)); ));
} }

View File

@ -21,7 +21,6 @@ class BaseSdk
function __construct() function __construct()
{ {
$this->order_ctrl = new classes\OrderCtrl(); $this->order_ctrl = new classes\OrderCtrl();
error_log('basesdk new');
} }
public function setChannel($channel) public function setChannel($channel)
@ -33,31 +32,8 @@ class BaseSdk
{ {
} }
public function getPendingOrderList()
{
}
public function payNotify() public function payNotify()
{ {
} }
public function deliver()
{
}
public function queryOrderInfo()
{
$order_info = $this->order_ctrl->getOrder($_REQUEST['cp_orderid']);
if (!$order_info) {
phpcommon\sendError(1, '订单不存在');
return;
}
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'cp_orderid' => $order_info['cp_orderid'],
'status' => $order_info['status'],
));
}
} }