diff --git a/third_party/phpcommon b/third_party/phpcommon index 34d1c3a..fe26889 160000 --- a/third_party/phpcommon +++ b/third_party/phpcommon @@ -1 +1 @@ -Subproject commit 34d1c3a003d69d4cc0e13831c13a674456c6e0c6 +Subproject commit fe26889b998d8c241a5deef20eb165e3d4263e63 diff --git a/webapp/sdkwarpper/GoogleAndroid.php b/webapp/sdkwarpper/GoogleAndroid.php new file mode 100644 index 0000000..b577d6f --- /dev/null +++ b/webapp/sdkwarpper/GoogleAndroid.php @@ -0,0 +1,64 @@ +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; + } + +} diff --git a/webapp/sdkwarpper/UnifiedWeiXin.php b/webapp/sdkwarpper/UnifiedWeiXin.php index df533c0..7f68678 100644 --- a/webapp/sdkwarpper/UnifiedWeiXin.php +++ b/webapp/sdkwarpper/UnifiedWeiXin.php @@ -39,6 +39,10 @@ class UnifiedWeiXin extends BaseSdk { phpcommon\sendError(1, '参数错误,unified_trade_type必须为MWEB或JSAPI'); return; } + 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(); diff --git a/webapp/sdkwarpper/sdkwarpper.php b/webapp/sdkwarpper/sdkwarpper.php index e13097e..19e1f11 100644 --- a/webapp/sdkwarpper/sdkwarpper.php +++ b/webapp/sdkwarpper/sdkwarpper.php @@ -8,6 +8,11 @@ $g_platform_sdk_hash = array( 'sdk_file' => 'UnifiedWeiXin.php', 'class' => 'UnifiedWeiXin' ), + GOOGLE_ANDROID_CHANNEL => array( + 'channel' => GOOGLE_ANDROID_CHANNEL, + 'sdk_file' => 'GoogleAndroid.php', + 'class' => 'GoogleAndroid' + ), ); function createSdkByChannel($channel)