<?php
|
include_once '/Common/CommFunc.php';
|
include_once '/Common/Logging.php';
|
include_once '/Common/PayOrder.php';
|
include_once "/ProjComm/CfgReader.php";
|
|
// https://open.x7sy.com/sdk_resources/documentDetails?document_id=8
|
// 二、【游戏支付】与【游戏支付回调】流程 -> 提供前端请求生成 订单号 及 订单签名
|
|
header("Content-type: text/html; charset=utf-8");
|
|
\Logging\CreateLogging("center.x7.paycreate.php");
|
\Logging\LogInfo("_POST:" . print_r($_POST, true));
|
|
$channel = $_POST["channel"];
|
$game_area = $_POST["game_area"];
|
$game_guid = $_POST["game_guid"];
|
$game_price = $_POST["game_price"];
|
$cpinfo = $_POST["cpinfo"];
|
$subject = $_POST["subject"];
|
|
if (!$channel || !$game_area || !$game_guid || !$game_price || !$subject) {
|
Ret(-1, "paramerror");
|
exit;
|
}
|
|
if (!\CfgReader\ReadConfig() || !\CfgReader\GetConfigData("x7", "Pubkey_" . $channel, $pubkey)) {
|
Ret(-1, "configerror");
|
exit;
|
}
|
|
$game_orderid = \PayOrder\CreatePayOrder($channel, $game_guid, $game_area, $game_price, $cpinfo);
|
if (!$game_orderid) {
|
Ret(-1, "inserterror");
|
exit;
|
}
|
|
$game_sign = md5("game_area=" . $game_area . "&game_guid=" . $game_guid . "&game_orderid=" . $game_orderid . "&game_price=" . $game_price . "&subject=" . $subject . $pubkey);
|
\Logging\LogInfo("game_orderid:" . $game_orderid . " game_sign:" . $game_sign);
|
|
Ret(0, "", array("game_orderid" => $game_orderid, "game_sign" => $game_sign, "notify_id" => -1));
|
exit;
|
|
function Ret($errorcode = 0, $errormsg = "", $retData = array())
|
{
|
$ret = array_merge(array("errorcode" => $errorcode, "errormsg" => $errormsg), $retData);
|
echo json_encode($ret);
|
}
|