1
This commit is contained in:
parent
67f159d31c
commit
8dc4e103c2
@ -65,6 +65,20 @@ class OrderCtrl {
|
|||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getOrderBySpOrderId($account_id, $channel, $sp_orderid)
|
||||||
|
{
|
||||||
|
$conn = $this->getMysql($this->getStrDNA($account_id));
|
||||||
|
$row = $conn->execQueryOne('SELECT * FROM orderinfo ' .
|
||||||
|
'WHERE account_id=:account_id AND channel=:channel AND sp_orderid=:sp_orderid;',
|
||||||
|
array(
|
||||||
|
':account_id' => $account_id,
|
||||||
|
':channel' => $channel,
|
||||||
|
':sp_orderid' => $sp_orderid,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
public function getReceipt($receipt_id)
|
public function getReceipt($receipt_id)
|
||||||
{
|
{
|
||||||
$conn = $this->getMysql($this->getStrDNA($receipt_id));
|
$conn = $this->getMysql($this->getStrDNA($receipt_id));
|
||||||
@ -110,6 +124,11 @@ class OrderCtrl {
|
|||||||
return $this->internalAddOrder($pre_order_info);
|
return $this->internalAddOrder($pre_order_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addComplateOrder($order_info)
|
||||||
|
{
|
||||||
|
return $this->internalAddOrder($order_info);
|
||||||
|
}
|
||||||
|
|
||||||
private function internalAddOrder($order_info)
|
private function internalAddOrder($order_info)
|
||||||
{
|
{
|
||||||
$gameid = phpcommon\extractGameId($order_info['account_id']);
|
$gameid = phpcommon\extractGameId($order_info['account_id']);
|
||||||
@ -177,4 +196,41 @@ class OrderCtrl {
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPendingOrderList($account_id)
|
||||||
|
{
|
||||||
|
$conn = $this->getMysql($this->getStrDNA($account_id));
|
||||||
|
$rows = $conn->execQuery('SELECT orderid, sp_orderid, itemid, status FROM orderinfo ' .
|
||||||
|
'WHERE account_id=:account_id AND status != 2;',
|
||||||
|
array(
|
||||||
|
':account_id' => $account_id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$data = array();
|
||||||
|
foreach ($rows as $row ) {
|
||||||
|
array_push($data, array(
|
||||||
|
'cp_orderid' => $row['orderid'],
|
||||||
|
'sp_orderid' => $row['sp_orderid'],
|
||||||
|
'itemid' => $row['itemid'],
|
||||||
|
'status' => $row['status'],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
echo json_encode(array(
|
||||||
|
'errcode' => 0,
|
||||||
|
'errmsg' => '',
|
||||||
|
'order_list' => $data
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deliver($account_id, $cp_orderid)
|
||||||
|
{
|
||||||
|
$conn = $this->getMysql($this->getStrDNA($account_id));
|
||||||
|
$row = $conn->execQueryOne('SELECT orderid, sp_orderid, itemid, status FROM orderinfo ' .
|
||||||
|
'WHERE account_id=:account_id AND orderid=:orderid;',
|
||||||
|
array(
|
||||||
|
':account_id' => $account_id,
|
||||||
|
':orderid' => $cp_orderid
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use classes;
|
||||||
|
|
||||||
class PayController {
|
class PayController {
|
||||||
|
|
||||||
public function preOrder()
|
public function preOrder()
|
||||||
@ -26,6 +28,28 @@ class PayController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPendingOrderList()
|
||||||
|
{
|
||||||
|
if (!phpcommon\isValidSessionId($_REQUEST['account_id'], $_REQUEST['session_id'])) {
|
||||||
|
phpcommon\sendError(1, 'session无效');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
require 'classes/OrderCtrl.php';
|
||||||
|
$order_ctrl = new classes\OrderCtrl();
|
||||||
|
$order_ctrl->getPendingOrderList($_REQUEST['account_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deliver()
|
||||||
|
{
|
||||||
|
if (!phpcommon\isValidSessionId($_REQUEST['account_id'], $_REQUEST['session_id'])) {
|
||||||
|
phpcommon\sendError(1, 'session无效');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
require 'classes/OrderCtrl.php';
|
||||||
|
$order_ctrl = new classes\OrderCtrl();
|
||||||
|
$order_ctrl->deliver($_REQUEST['account_id'], $_REQUEST['cp_orderid']);
|
||||||
|
}
|
||||||
|
|
||||||
public function payNotify()
|
public function payNotify()
|
||||||
{
|
{
|
||||||
error_log(json_encode($_REQUEST));
|
error_log(json_encode($_REQUEST));
|
||||||
|
@ -56,9 +56,39 @@ class GoogleAndroid extends BaseSdk {
|
|||||||
$response,
|
$response,
|
||||||
$proxy)) {
|
$proxy)) {
|
||||||
phpcommon\sendError(2, '服务器内部错误');
|
phpcommon\sendError(2, '服务器内部错误');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
error_log($response);
|
error_log($response);
|
||||||
echo $response;
|
echo $response;
|
||||||
|
|
||||||
|
$receipt_info = array();
|
||||||
|
$receipt_db = $this->order_ctrl->getReceipt($receipt_info['purchaseToken']);
|
||||||
|
$order_db = $this->order_ctrl->getOrderBySpOrderId(
|
||||||
|
$_REQUEST['account_id'],
|
||||||
|
$this->real_channel,
|
||||||
|
$receipt_info['purchaseToken']
|
||||||
|
);
|
||||||
|
if ($receipt_db) {
|
||||||
|
if ($receipt_db['account_id'] != $_REQUEST['account_id']) {
|
||||||
|
phpcommon\sendError(2, '账号id不匹配');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($order_db) {
|
||||||
|
echo json_encode(array(
|
||||||
|
'errcode' => 0,
|
||||||
|
'errmsg' => '',
|
||||||
|
|
||||||
|
'cp_orderid' => $order_db['orderid'],
|
||||||
|
'status' => $order_db['status'],
|
||||||
|
));
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
phpcommon\sendError(2, '订单不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$cp_orderid = $this->genOrderId($_REQUEST['account_id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user