|
|
|
@ -16,6 +16,7 @@ use Sdk\Model\PayChannelInterntionModel;
|
|
|
|
|
use Sdk\Model\PayChannelIntentionModel;
|
|
|
|
|
use Org\SumaPay\Api as FFApi;
|
|
|
|
|
use Org\QzlPay\Api as QzlApi;
|
|
|
|
|
use Org\Kudian\Api as KDApi;
|
|
|
|
|
|
|
|
|
|
class PayH5Controller extends BaseController{
|
|
|
|
|
const ALI_PAY = 1;
|
|
|
|
@ -200,6 +201,33 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
|
|
|
|
|
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>$ret[0]['respMess'], 'user_token' => $this->userToken)));exit;
|
|
|
|
|
}
|
|
|
|
|
} elseif ($pay_info['channel'] == 6) { // 酷点
|
|
|
|
|
|
|
|
|
|
$request['pay_way'] = 11;
|
|
|
|
|
$request['pay_status'] = 0;
|
|
|
|
|
$request['spend_ip'] = get_client_ip();
|
|
|
|
|
|
|
|
|
|
$this->add_deposit($request, 1);
|
|
|
|
|
|
|
|
|
|
$notifyUrl = C('PAY_DOMAIN')."/callback.php/Notify/kd_callback";
|
|
|
|
|
$backUrl = C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}";
|
|
|
|
|
|
|
|
|
|
$body = '消费-' . $request["pay_order_number"];
|
|
|
|
|
$response = KDApi::h5Pay($request['pay_order_number'], $request['price']*100, $notifyUrl, $backUrl, 'ALIPAY', $body, get_client_ip());
|
|
|
|
|
|
|
|
|
|
if($response->isSuccess()) {
|
|
|
|
|
// 存入pay_url 继续支付
|
|
|
|
|
M("deposit", "tab_")->where([
|
|
|
|
|
'extend' => $request['extend'],
|
|
|
|
|
'game_id' => $request['game_id'],
|
|
|
|
|
'pay_order_number' => $request["pay_order_number"]
|
|
|
|
|
])->save([
|
|
|
|
|
'pay_url' => $response->getResult('url')
|
|
|
|
|
]);
|
|
|
|
|
$orderno = $request['pay_order_number'];
|
|
|
|
|
} else {
|
|
|
|
|
echo json_encode(['code'=>1001,'msg'=> "请求发起失败【{$response->getMsg()}】,请选择其他支付方式或联系客服"]);exit;
|
|
|
|
|
}
|
|
|
|
|
} elseif($pay_info['channel'] == 7) { // 丰付
|
|
|
|
|
|
|
|
|
|
$request['pay_way'] = 12;
|
|
|
|
@ -589,6 +617,43 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
} else {
|
|
|
|
|
echo json_encode(['code'=>1001,'msg'=> "请求发起失败【{$json_data['ret_msg']}】,请选择其他支付方式或联系客服"]);exit;
|
|
|
|
|
|
|
|
|
|
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>$ret[0]['respMess'], 'user_token' => $this->userToken)));exit;
|
|
|
|
|
}
|
|
|
|
|
} elseif($pay_info['channel'] == 6) { // 酷点
|
|
|
|
|
$request['pay_way'] = 11;
|
|
|
|
|
$request['pay_status'] = 0;
|
|
|
|
|
$request['spend_ip'] = get_client_ip();
|
|
|
|
|
$request['merchant_id'] = $pay_info['id'];
|
|
|
|
|
$request['merchant_way'] = 1;
|
|
|
|
|
$request['main_id'] = $main_id;
|
|
|
|
|
|
|
|
|
|
$ordercheck = M("spend","tab_")->where(array('pay_order_number'=>$request["pay_order_number"]))->find();
|
|
|
|
|
if ($ordercheck) {
|
|
|
|
|
$returl = U('Spend/notice',array('user_id'=>$ordercheck['user_id'],'game_id'=>$ordercheck['game_id'],'msg'=>'订单已经存在,请刷新充值页面重新下单!'));
|
|
|
|
|
echo json_encode(['code'=>0,'msg'=>'订单已经存在,请刷新充值页面重新下单!','wap'=>1]);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
$this->add_spend($request,1);
|
|
|
|
|
|
|
|
|
|
$notifyUrl = C('PAY_DOMAIN')."/callback.php/Notify/kd_callback";
|
|
|
|
|
$backUrl = C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}";
|
|
|
|
|
$body = '消费-' . $request["pay_order_number"];
|
|
|
|
|
$response = KDApi::h5Pay($request['pay_order_number'], $request['price']*100, $notifyUrl, $backUrl, 'ALIPAY', $body, get_client_ip());
|
|
|
|
|
|
|
|
|
|
if($response->isSuccess()){
|
|
|
|
|
// 存入pay_url 继续支付
|
|
|
|
|
M("spend", "tab_")->where([
|
|
|
|
|
'extend' => $request['extend'],
|
|
|
|
|
'game_id' => $request['game_id'],
|
|
|
|
|
'pay_order_number' => $request["pay_order_number"]
|
|
|
|
|
])->save([
|
|
|
|
|
'pay_url' => $response->getResult('url')
|
|
|
|
|
]);
|
|
|
|
|
$orderno = $request['pay_order_number'];
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
echo json_encode(['code'=>1001,'msg'=> "请求发起失败【{$response->getMsg()}】,请选择其他支付方式或联系客服"]);exit;
|
|
|
|
|
|
|
|
|
|
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>$ret[0]['respMess'], 'user_token' => $this->userToken)));exit;
|
|
|
|
|
}
|
|
|
|
|
} elseif($pay_info['channel'] == 7) { // 丰付
|
|
|
|
@ -850,9 +915,6 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*微信支付
|
|
|
|
|
* 增加
|
|
|
|
|
* ALTER TABLE `tab_deposit`
|
|
|
|
|
ADD COLUMN `pay_url` text NULL AFTER `check_sign`;
|
|
|
|
|
*/
|
|
|
|
|
public function platform_weixin_pay() {
|
|
|
|
|
if (!$this->userId) {
|
|
|
|
@ -975,6 +1037,24 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
jsonOutput(0, "支付失败");
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
} elseif($pay_info['channel'] == 6) { // 酷点
|
|
|
|
|
$request['pay_way'] = 21;
|
|
|
|
|
|
|
|
|
|
$notifyUrl = C('PAY_DOMAIN')."/callback.php/Notify/kd_callback";
|
|
|
|
|
$backUrl = C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}";
|
|
|
|
|
$body = '消费-' . $request["pay_order_number"];
|
|
|
|
|
$response = KDApi::h5Pay($request['pay_order_number'], $request['price']*100, $notifyUrl, $backUrl, 'WXPAY', $body, get_client_ip());
|
|
|
|
|
|
|
|
|
|
if($response->isSuccess()){
|
|
|
|
|
$request['pay_url'] = $response->getResult('url');
|
|
|
|
|
$request['merchant_id'] = $pay_info['id'];
|
|
|
|
|
$request['merchant_way'] = self::WX_PAY;
|
|
|
|
|
$request['main_id'] = $main_id;
|
|
|
|
|
$this->add_deposit($request, 1);
|
|
|
|
|
} else {
|
|
|
|
|
jsonOutput(0, "支付失败");
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
}elseif ($pay_info['channel'] == 7) { // 丰付
|
|
|
|
|
$request['pay_way'] = 22;
|
|
|
|
|
$body = "消费-".$request["pay_order_number"];
|
|
|
|
@ -1605,7 +1685,7 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//捕获异常
|
|
|
|
|
catch(Exception $e)
|
|
|
|
|
catch(\Exception $e)
|
|
|
|
|
{
|
|
|
|
|
echo 'Message: ' .$e->getMessage();
|
|
|
|
|
}
|
|
|
|
@ -1639,10 +1719,6 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*微信支付
|
|
|
|
|
*ALTER TABLE `tab_spend`
|
|
|
|
|
ADD COLUMN `pay_url` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER `old_promote_account`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
public function weixin_pay($user_id,$game_id) {
|
|
|
|
|
|
|
|
|
@ -1779,6 +1855,43 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
echo json_encode(['code'=>0,'msg'=> '支付失败,请重试'.$json_data['ret_msg']]);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
} elseif($pay_info['channel'] == 6) { // 酷点
|
|
|
|
|
$request['pay_way'] = 21;
|
|
|
|
|
$request['pay_status'] = 0;
|
|
|
|
|
$request['spend_ip'] = get_client_ip();
|
|
|
|
|
$request['merchant_id'] = $pay_info['id'];
|
|
|
|
|
$request['merchant_way'] = 2;
|
|
|
|
|
$request['main_id'] = $main_id;
|
|
|
|
|
|
|
|
|
|
$ordercheck = M("spend","tab_")->where(array('pay_order_number'=>$request["pay_order_number"]))->find();
|
|
|
|
|
if ($ordercheck) {
|
|
|
|
|
$returl = U('Spend/notice',array('user_id'=>$ordercheck['user_id'],'game_id'=>$ordercheck['game_id'],'msg'=>'订单已经存在,请刷新充值页面重新下单!'));
|
|
|
|
|
echo json_encode(['code'=>0,'msg'=>'订单已经存在,请刷新充值页面重新下单!','wap'=>1]);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
$this->add_spend($request,1);
|
|
|
|
|
|
|
|
|
|
$notifyUrl = C('PAY_DOMAIN')."/callback.php/Notify/kd_callback";
|
|
|
|
|
$backUrl = C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}";
|
|
|
|
|
$body = '消费-' . $request["pay_order_number"];
|
|
|
|
|
$response = KDApi::h5Pay($request['pay_order_number'], $request['price']*100, $notifyUrl, $backUrl, 'WXPAY', $body, get_client_ip());
|
|
|
|
|
|
|
|
|
|
if($response->isSuccess()){
|
|
|
|
|
// 存入pay_url 继续支付
|
|
|
|
|
M("spend", "tab_")->where([
|
|
|
|
|
'extend' => $request['extend'],
|
|
|
|
|
'game_id' => $request['game_id'],
|
|
|
|
|
'pay_order_number' => $request["pay_order_number"]
|
|
|
|
|
])->save([
|
|
|
|
|
'pay_url' => $response->getResult('url')
|
|
|
|
|
]);
|
|
|
|
|
$orderno = $request['pay_order_number'];
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
echo json_encode(['code'=>1001,'msg'=> "请求发起失败【{$response->getMsg()}】,请选择其他支付方式或联系客服"]);exit;
|
|
|
|
|
|
|
|
|
|
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>$ret[0]['respMess'], 'user_token' => $this->userToken)));exit;
|
|
|
|
|
}
|
|
|
|
|
} elseif($pay_info['channel'] == 7) { // 丰付
|
|
|
|
|
$request['pay_way'] = 22;
|
|
|
|
|
$request['pay_status'] = 0;
|
|
|
|
|