1
This commit is contained in:
parent
7194cd0b5f
commit
a0dbdeb259
2
third_party/phpcommon
vendored
2
third_party/phpcommon
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 34d1c3a003d69d4cc0e13831c13a674456c6e0c6
|
Subproject commit fe26889b998d8c241a5deef20eb165e3d4263e63
|
64
webapp/sdkwarpper/GoogleAndroid.php
Normal file
64
webapp/sdkwarpper/GoogleAndroid.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sdkwarpper;
|
||||||
|
|
||||||
|
require 'BaseSdk.php';
|
||||||
|
|
||||||
|
use phpcommon;
|
||||||
|
use classes;
|
||||||
|
|
||||||
|
class GoogleAndroid extends BaseSdk {
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->conf_appid = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function loadConfig()
|
||||||
|
{
|
||||||
|
$config_name = "../config/game{$this->gameid}/{$this->channel}/config.php";
|
||||||
|
$this->config = require($config_name);
|
||||||
|
$this->conf_appid = $this->config['appid'];
|
||||||
|
$this->conf_package_name = $this->config['package_name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function payNotify()
|
||||||
|
{
|
||||||
|
if (!phpcommon\isValidSessionId($_REQUEST['_account_id'], $_REQUEST['_session_id'])) {
|
||||||
|
phpcommon\sendError(1, 'session无效');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->gameid = phpcommon\extractGameId($_REQUEST['_account_id']);
|
||||||
|
$this->real_channel = phpcommon\extractChannel($_REQUEST['_account_id']);
|
||||||
|
$this->loadConfig();
|
||||||
|
|
||||||
|
$packageName = $this->conf_package_name;
|
||||||
|
$productId = $_REQUEST['_itemid'];
|
||||||
|
$token = $_REQUEST['_purchase_token'];
|
||||||
|
|
||||||
|
$response = '';
|
||||||
|
$proxy = null;
|
||||||
|
if (SERVER_ENV != _ONLINE) {
|
||||||
|
$proxy = array(
|
||||||
|
"host" => "127.0.0.1",
|
||||||
|
"port" => 8118,
|
||||||
|
"user_pwd" => ""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (phpcommon\HttpClient::get(
|
||||||
|
"https://androidpublisher.googleapis.com/androidpublisher/v3/applications/" .
|
||||||
|
"{$packageName}/purchases/products/{$productId}/tokens/{$token}",
|
||||||
|
array(
|
||||||
|
'access_token' => '2134234'
|
||||||
|
),
|
||||||
|
$response,
|
||||||
|
$proxy)) {
|
||||||
|
phpcommon\sendError(2, '服务器内部错误');
|
||||||
|
}
|
||||||
|
error_log($response);
|
||||||
|
echo $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -39,6 +39,10 @@ class UnifiedWeiXin extends BaseSdk {
|
|||||||
phpcommon\sendError(1, '参数错误,unified_trade_type必须为MWEB或JSAPI');
|
phpcommon\sendError(1, '参数错误,unified_trade_type必须为MWEB或JSAPI');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!phpcommon\isValidSessionId($_REQUEST['account_id'], $_REQUEST['session_id'])) {
|
||||||
|
phpcommon\sendError(1, 'session无效');
|
||||||
|
return;
|
||||||
|
}
|
||||||
$this->gameid = phpcommon\extractGameId($_REQUEST['account_id']);
|
$this->gameid = phpcommon\extractGameId($_REQUEST['account_id']);
|
||||||
$this->real_channel = phpcommon\extractChannel($_REQUEST['account_id']);
|
$this->real_channel = phpcommon\extractChannel($_REQUEST['account_id']);
|
||||||
$this->loadConfig();
|
$this->loadConfig();
|
||||||
|
@ -8,6 +8,11 @@ $g_platform_sdk_hash = array(
|
|||||||
'sdk_file' => 'UnifiedWeiXin.php',
|
'sdk_file' => 'UnifiedWeiXin.php',
|
||||||
'class' => 'UnifiedWeiXin'
|
'class' => 'UnifiedWeiXin'
|
||||||
),
|
),
|
||||||
|
GOOGLE_ANDROID_CHANNEL => array(
|
||||||
|
'channel' => GOOGLE_ANDROID_CHANNEL,
|
||||||
|
'sdk_file' => 'GoogleAndroid.php',
|
||||||
|
'class' => 'GoogleAndroid'
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
function createSdkByChannel($channel)
|
function createSdkByChannel($channel)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user