From 4c82631c41268740997b04f8e96f5c0ec8455c87 Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Sat, 8 Apr 2023 20:46:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/PayH5Controller.class.php | 63 ++++++++++--------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/Application/Sdk/Controller/PayH5Controller.class.php b/Application/Sdk/Controller/PayH5Controller.class.php index a25897c..617e18e 100644 --- a/Application/Sdk/Controller/PayH5Controller.class.php +++ b/Application/Sdk/Controller/PayH5Controller.class.php @@ -200,6 +200,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; + } } else{ // 支付宝第三方 if( empty(C('goldpig.partner'))||empty(C('goldpig.wooolid'))){ // $this->set_message(1009, "fail", "支付参数未配置"); @@ -857,42 +884,22 @@ class PayH5Controller extends BaseController{ } } 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']; - + $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 { - 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; + jsonOutput(0, "支付失败"); + exit; } - } elseif(get_wx_pay_type() == 2){ if($request['code']==1){