This commit is contained in:
aozhiwei 2019-08-21 21:02:59 +08:00
parent e7418ee041
commit d0edfe6970
2 changed files with 31 additions and 2 deletions

View File

@ -53,6 +53,8 @@ DROP TABLE IF EXISTS `orderinfo`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `orderinfo` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`minigame_appid` varchar(60) DEFAULT '' COMMENT '支付小程序appid',
`minigame_accountid` varchar(60) DEFAULT '' COMMENT '支付小程序账号id(channel + "_" + gameid + "_" + openid)',
`orderid` varchar(60) DEFAULT '' COMMENT '订单id',
`accountid` varchar(60) DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`channel` int(11) NOT NULL COMMENT 'channel',
@ -60,7 +62,6 @@ CREATE TABLE `orderinfo` (
`openid` varchar(50) NOT NULL COMMENT '平台openid',
`itemid` int(11) NOT NULL COMMENT 'itemid',
`price` double NOT NULL COMMENT 'price',
`nickname` tinyblob COMMENT 'nickname',
`ipv4` varchar(50) NOT NULL DEFAULT '' COMMENT '账号创建时ipv4地址',
`status` int(11) NOT NULL DEFAULT '0' COMMENT '0: 新添加订单 1:已经完成订单',
`confirmtime` int(11) NOT NULL DEFAULT '0' COMMENT 'GameServer订单确认时间',

View File

@ -61,6 +61,8 @@ class PayController {
}
$nowtime = time();
$openid = phpcommon\extractOpenId($_REQUEST['account_id']);
$minigame_appid = self::SUB_APPID;
$minigame_accountid = $_REQUEST['account_id'];
{
$ipos = strpos($_REQUEST['data'], '_');
$gameid = substr($_REQUEST['data'], 0, $ipos);
@ -78,6 +80,8 @@ class PayController {
die();
}
$game_account_id = $jsonobj['account_id'];
$game_channel = phpcommon\extractChannel($jsonobj['account_id']);
$game_openid = phpcommon\extractOpenId($jsonobj['account_id']);
$amount = $jsonobj['price'];
$itemid = $jsonobj['itemid'];
$itemnum = $jsonobj['itemnum'];
@ -134,7 +138,31 @@ class PayController {
$xmlobj = new \SimpleXMLElement(base64_decode($response));
if ($xmlobj->RespCode == '0000') {
$conn = $this->getMysql($_REQUEST['account_id']);
# $ret = $conn->execScript();
$ret = $conn->execScript('INSERT INTO orderinfo(orderid, accountid, channel, gameid, openid, ' .
' itemid, price, ipv4, createtime, sp_orderid, ' .
' minigame_appid, minigame_accountid)' .
'VALUES(:orderid, :accountid, :channel, :gameid, :openid, :itemid, ' .
' :price, :ipv4, :createtime, :sp_orderid, :minigame_appid, :minigame_accountid);',
array(
':orderid' => $orderid,
':accountid' => $game_account_id,
':openid' => $game_openid,
':channel' => $game_channel,
':gameid' => $gameid,
':itemid' => $itemid,
':price' => $amount,
':ipv4' => phpcommon\getIPv4(),
':createtime' => time(),
':sp_orderid' => (string)$xmlobj->OrderNo,
':minigame_appid' => $minigame_appid,
':minigame_accountid' => $minigame_accountid,
));
if (!$ret) {
echo json_encode(array(
'errcode' => 2,
'errmsg' => '服务器内部错误',
));
}
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',