1
This commit is contained in:
parent
476d5d9d69
commit
f715cad303
@ -4,10 +4,12 @@ class PayController {
|
||||
|
||||
public function preOrder()
|
||||
{
|
||||
error_log(json_encode($_REQUEST));
|
||||
/*
|
||||
if (!phpcommon\isValidSessionId($_REQUEST['account_id'], $_REQUEST['session_id'])) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
$channel = phpcommon\extractChannel($_REQUEST['account_id']);
|
||||
if (!empty($_REQUEST['poly_sdk_channel'])) {
|
||||
$channel = $_REQUEST['poly_sdk_channel'];
|
||||
|
@ -9,6 +9,7 @@ use classes;
|
||||
|
||||
class BaseSdk
|
||||
{
|
||||
protected $real_channel = '0';
|
||||
protected $channel = '0';
|
||||
protected $gameid = 0;
|
||||
|
||||
|
@ -12,10 +12,42 @@ class UnifiedWeiXin extends BaseSdk {
|
||||
function __construct()
|
||||
{
|
||||
$this->channel = UNIFIED_WEIXIN_CHANNEL;
|
||||
$this->gameid = phpcommon\extractGameId($_REQUEST['account_id']);
|
||||
$this->real_channel = phpcommon\extractGameId($_REQUEST['account_id']);
|
||||
}
|
||||
|
||||
public function preOrder()
|
||||
{
|
||||
$params = array(
|
||||
'appid' => '1517300671',
|
||||
'mch_id' => 'aFUFoU2weMEqQouNvYLyMB23xJppuw5w',
|
||||
'nonce_str' => uniqid('201019'),
|
||||
'body' => '',
|
||||
'out_trade_no' => '',
|
||||
'total_fee' => '',
|
||||
'spbill_create_ip' => phpcommon\getIPv4(),
|
||||
'notify_url' => 'https://gamepay.kingsome.cn/webapp/paynotify/unified_weixin.php',
|
||||
'trade_type' => '',
|
||||
'scene_info' => '',
|
||||
);
|
||||
if (SERVER_ENV != _ONLINE) {
|
||||
$params['notify_url'] = 'https://gamepay-test.kingsome.cn/webapp/paynotify/unified_weixin.php';
|
||||
}
|
||||
$sign = phpcommon\wxPaySign($params,
|
||||
''
|
||||
);
|
||||
$params['sign'] = strtoupper($sign);
|
||||
error_log(json_encode($params));
|
||||
error_log(phpcommon\objectToXml($params));
|
||||
$response = '';
|
||||
if (phpcommon\HttpClient::postContent(
|
||||
'https://api.mch.weixin.qq.com/pay/unifiedorder',
|
||||
phpcommon\objectToXml($params),
|
||||
$response
|
||||
)) {
|
||||
|
||||
}
|
||||
echo $response;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user