From 9895fc405f3084b4fa55366dd572950751b9161c Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Sun, 8 Jan 2023 21:11:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/PayH5Controller.class.php | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/Application/Sdk/Controller/PayH5Controller.class.php b/Application/Sdk/Controller/PayH5Controller.class.php index b4df446..20e8d03 100644 --- a/Application/Sdk/Controller/PayH5Controller.class.php +++ b/Application/Sdk/Controller/PayH5Controller.class.php @@ -1652,7 +1652,45 @@ class PayH5Controller extends BaseController{ exit; } - }elseif(get_wx_pay_type() == 2){ + } 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'] = 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(get_wx_pay_type() == 2){ if($request['code']==1){ $this->add_spend($request,1);