1
This commit is contained in:
parent
9cf4e6ad49
commit
8ffd613375
2
third_party/phpcommon
vendored
2
third_party/phpcommon
vendored
@ -1 +1 @@
|
||||
Subproject commit 9272475127f415b44c4b425fb714a49e8805a62a
|
||||
Subproject commit 0f87f3917f015821aa6abe51f2df7de9b7ad2aa8
|
@ -2,21 +2,23 @@
|
||||
|
||||
namespace sdkwarpper;
|
||||
|
||||
require 'basesdk.php';
|
||||
require 'selfsdk.php';
|
||||
|
||||
$g_platform_sdk_hash = array(
|
||||
UNIFIED_WEIXIN_CHANNEL => array(
|
||||
'channel' => UNIFIED_WEIXIN_CHANNEL,
|
||||
'sdk_file' => 'unified_weixin.php',
|
||||
'class' => 'UnifiedWeiXin'
|
||||
),
|
||||
);
|
||||
|
||||
function createSdkByChannel($channel)
|
||||
{
|
||||
$channel_sdk_hash = array(
|
||||
SELFSDK_CHANNEL => 'SelfSdk',
|
||||
WEIXIN_CHANNEL => 'Weixin',
|
||||
H5_WANBA_CHANNEL => 'Wanba'
|
||||
);
|
||||
if (array_key_exists($channel, $channel_sdk_hash)) {
|
||||
$class_name = "sdkwarpper\\" . $channel_sdk_hash[$channel];
|
||||
return new $class_name;
|
||||
} else {
|
||||
return null;
|
||||
global $g_platform_sdk_hash;
|
||||
foreach ($g_platform_sdk_hash as $key => $value) {
|
||||
if ($value['channel'] == $channel) {
|
||||
require 'sdkwarpper/' . $value['sdk_file'];
|
||||
$class_name = "sdkwarpper\\" . $value['class'];
|
||||
return new $class_name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1,86 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace sdkwarpper;
|
||||
|
||||
use phpcommon;
|
||||
|
||||
class SelfSdk extends BaseSdk {
|
||||
|
||||
public function getOrderId()
|
||||
{
|
||||
|
||||
if (SERVER_ENV != _ONLINE) {
|
||||
$url = "http://127.0.0.1:7051/webapp/index.php?c=Pay&a=getOrderId";
|
||||
} else {
|
||||
$url = "https://center.kingsome.cn/api/games/click/$game_id";
|
||||
}
|
||||
|
||||
$response = '';
|
||||
$params = array(
|
||||
'accountid' => $_REQUEST['accountid'],
|
||||
'roleid' => $_REQUEST['roleid'],
|
||||
'rolename' => $_REQUEST['rolename'],
|
||||
'serverid' => $_REQUEST['serverid'],
|
||||
'itemid' => $_REQUEST['itemid'],
|
||||
'price' => $_REQUEST['price'],
|
||||
'sp_orderid' => 'testtttttt'
|
||||
);
|
||||
if (!phpcommon\HttpClient::get($url, $params, $response)) {
|
||||
phpcommon\sendError(100,'获取失败');
|
||||
return;
|
||||
}
|
||||
|
||||
error_log($response);
|
||||
$ret_info = json_decode($response, true);
|
||||
if ($ret_info['errcode'] == 0) {
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => ''
|
||||
));
|
||||
$data = array(
|
||||
'pay_type' => 1,
|
||||
'orderid' => $ret_info['orderid'],
|
||||
'payresult' => 1
|
||||
);
|
||||
$this->payNotify($data);
|
||||
} else {
|
||||
echo json_encode(array(
|
||||
'errcode' => $ret_info['errcode'],
|
||||
'errmsg' => $ret_info['errmsg'],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private function payNotify($data)
|
||||
{
|
||||
|
||||
if (SERVER_ENV != _ONLINE) {
|
||||
$url = "http://127.0.0.1:7051/webapp/index.php?c=Pay&a=payNotify";
|
||||
} else {
|
||||
$url = "https://center.kingsome.cn/api/games/click/$game_id";
|
||||
}
|
||||
|
||||
$response = '';
|
||||
$params = array(
|
||||
'pay_type' => $data['pay_type'],
|
||||
'orderid' => $data['orderid'],
|
||||
'payresult' => $data['payresult']
|
||||
);
|
||||
if (!phpcommon\HttpClient::get($url, $params, $response)) {
|
||||
phpcommon\sendError(100,'获取失败');
|
||||
return;
|
||||
}
|
||||
|
||||
error_log($response);
|
||||
|
||||
$ret_info = json_decode($response, true);
|
||||
|
||||
if ($ret_info['errcode'] == 0) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user