Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
82b7b27903 |
@ -257,6 +257,108 @@ class RechargeController
|
||||
));
|
||||
}
|
||||
|
||||
public function hwprePay()
|
||||
{
|
||||
$this->prePay();
|
||||
}
|
||||
|
||||
public function hwpayDone()
|
||||
{
|
||||
$this->purchaseDone();
|
||||
}
|
||||
|
||||
protected function hwpayDoneQuery()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
|
||||
$goodsid = $_REQUEST['goods_id'];
|
||||
$orderid = $_REQUEST['order_id'];
|
||||
$purchasetoken = $_REQUEST['token'];
|
||||
|
||||
if ($orderid == '') {
|
||||
die();
|
||||
}
|
||||
|
||||
$key = 'game2004api-purchase:' . $account_id . '-' . $orderid;
|
||||
$r = $this->getRedis($key);
|
||||
if (!$r) {
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'order_id' => $orderid,
|
||||
'status' => 0,
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
$user_purchase_str = $r->get($key);
|
||||
if (!empty($user_purchase_str)) {
|
||||
echo $user_purchase_str;
|
||||
return;
|
||||
}
|
||||
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$orderRow = $conn->execQueryOne(
|
||||
'SELECT * FROM orderinfo WHERE orderid=:orderid',
|
||||
array(
|
||||
':orderid' => $orderid
|
||||
)
|
||||
);
|
||||
|
||||
if ($orderRow) {
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'order_id' => $orderid,
|
||||
'status' => 1,
|
||||
));
|
||||
die();
|
||||
} else {
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'order_id' => $orderid,
|
||||
'status' => 0,
|
||||
));
|
||||
}
|
||||
|
||||
$url = '';
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
$url = 'https://payservice.kingsome.cn/api/ingame/hwpaid';
|
||||
} else {
|
||||
$url = 'https://payservice-test.kingsome.cn/api/ingame/hwpaid';
|
||||
}
|
||||
$sign = md5($account_id . $goodsid . 'f3a6a9a5-217a-4079-ab99-b5d69b8212be' . $_REQUEST['session_id'] . $orderid . $purchasetoken);
|
||||
$params = array(
|
||||
'account_id' => $account_id,
|
||||
'goods_id' => $goodsid,
|
||||
'session_id' => $_REQUEST['session_id'],
|
||||
'order_id' => $orderid,
|
||||
'token' => $purchasetoken,
|
||||
'user_ip' => phpcommon\getIPv4(),
|
||||
'sign' => $sign
|
||||
);
|
||||
|
||||
if (!phpcommon\HttpClient::get($url, $params, $rsp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_null($rsp) || empty($rsp)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function preparePay()
|
||||
{
|
||||
$this->prePay();
|
||||
@ -313,7 +415,7 @@ class RechargeController
|
||||
return;
|
||||
}
|
||||
|
||||
$response = json_decode($rsp, true);
|
||||
$response = json_decode($rsp, true);
|
||||
echo json_encode(array(
|
||||
'errcode' => $response['errcode'],
|
||||
'errmsg' => $response['errmsg'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user