1
This commit is contained in:
parent
8dc4e103c2
commit
a9815ee7ab
@ -221,16 +221,64 @@ class OrderCtrl {
|
||||
));
|
||||
}
|
||||
|
||||
public function getInternetGamesConf($gameid)
|
||||
{
|
||||
$json_str = $json_string = file_get_contents('../config/internet_games.json');
|
||||
$jsonobj = json_decode($json_str, true);
|
||||
foreach ($jsonobj as $conf) {
|
||||
if ($conf['gameid'] == $gameid) {
|
||||
return $conf;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
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 ' .
|
||||
$row = $conn->execQueryOne('SELECT orderid, sp_orderid, itemid, status, sp_pay_result ' .
|
||||
'FROM orderinfo ' .
|
||||
'WHERE account_id=:account_id AND orderid=:orderid;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':orderid' => $cp_orderid
|
||||
)
|
||||
);
|
||||
if (empty($row)) {
|
||||
phpcommon\sendError(3, '不支持发货功能');
|
||||
return;
|
||||
}
|
||||
$gameid = phpcommon\extractGameId($receipt_info['account_id']);
|
||||
$game_conf = $this->getInternetGamesConf($gameid);
|
||||
if ($game_conf) {
|
||||
phpcommon\sendError(3, '不支持发货功能');
|
||||
return;
|
||||
}
|
||||
if ($row['status'] == 1) {
|
||||
phpcommon\sendError(1, '已经发货不能重复发货');
|
||||
return;
|
||||
}
|
||||
if ($row['sp_pay_result'] != 1) {
|
||||
phpcommon\sendError(2, '平台未确认');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE orderinfo SET ' .
|
||||
' status=1, ' .
|
||||
' confirmtime=:confirmtime ' .
|
||||
'WHERE orderid=:orderid;',
|
||||
array(
|
||||
':confirmtime' => time(),
|
||||
':orderid' => $cp_orderid
|
||||
));
|
||||
if (!$ret) {
|
||||
phpcommon\sendError(100, '服务器内部错误');
|
||||
return;
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'itemid' => $row['itemid']
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user