From a12e680c601da0920d8347cdcd7e63f5905bcd31 Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Fri, 13 Dec 2024 22:54:44 +0800 Subject: [PATCH] y --- .../Sdk/Controller/PayH5Controller.class.php | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/Application/Sdk/Controller/PayH5Controller.class.php b/Application/Sdk/Controller/PayH5Controller.class.php index cecdc4e..e2be600 100644 --- a/Application/Sdk/Controller/PayH5Controller.class.php +++ b/Application/Sdk/Controller/PayH5Controller.class.php @@ -1643,37 +1643,39 @@ class PayH5Controller extends BaseController{ $this->add_spend($request,1); } else { echo json_encode(['code'=>0,'msg'=> '支付失败']); - Log::write("weixin_pay支付失败".serialize($is_pay)); + Log::write("weixin_pay支付失败".serialize($result)); exit; } - } - - $weixn = new Weixin(); - $is_pay = json_decode($weixn->weixin_pay(!empty($request['title']) ? $request['title']: "充值", $request['pay_order_number'], $pay_amount, 'MWEB', 1, $pay_conf), true); - - if($is_pay['status']==1){ + } else { + $weixn = new Weixin(); + $is_pay = json_decode($weixn->weixin_pay(!empty($request['title']) ? $request['title']: "充值", $request['pay_order_number'], $pay_amount, 'MWEB', 1, $pay_conf), true); - if($request['code']==1){ - $redirectBaseUri = C('PAY_DOMAIN'); - $json_data['url'] = $is_pay['mweb_url'].'&redirect_url='.urlencode($redirectBaseUri."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/game_id/{$request['game_id']}/paytype/weixinpay"); - $request['pay_url'] = $json_data['url'] . "&tx_client=hideopen"; - $request['merchant_id'] = $pay_info['id']; - $request['merchant_way'] = self::WX_PAY; - $request['main_id'] = $main_id; - if (C('SHARE_ID.'.$pay_conf['partner']) == 'y') { - $request['share_status'] = 1; + if($is_pay['status']==1){ + + if($request['code']==1){ + $redirectBaseUri = C('PAY_DOMAIN'); + $json_data['url'] = $is_pay['mweb_url'].'&redirect_url='.urlencode($redirectBaseUri."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/game_id/{$request['game_id']}/paytype/weixinpay"); + $request['pay_url'] = $json_data['url'] . "&tx_client=hideopen"; + $request['merchant_id'] = $pay_info['id']; + $request['merchant_way'] = self::WX_PAY; + $request['main_id'] = $main_id; + if (C('SHARE_ID.'.$pay_conf['partner']) == 'y') { + $request['share_status'] = 1; + } + $this->add_spend($request,1); } - $this->add_spend($request,1); + + // $json_data['url'] = $is_pay['mweb_url'].'&redirect_url='.C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/game_id/{$request['game_id']}"; + // (is_ssl()?'https%3A%2F%2F':'http%3A%2F%2F'). $_SERVER ['HTTP_HOST'] . "%2Fsdk.php%2FSpend%2Fpay_success%2Forderno%2F".$request['pay_order_number'].'%2Fgame_id%2F'.$request['game_id'] ; + }else{ + echo json_encode(['code'=>0,'msg'=> '支付失败']); + Log::write("platform_weixin_pay支付失败".serialize($is_pay)); + exit; + // redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'支付失败', 'user_token' => $this->userToken)));exit; } - - // $json_data['url'] = $is_pay['mweb_url'].'&redirect_url='.C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/game_id/{$request['game_id']}"; - // (is_ssl()?'https%3A%2F%2F':'http%3A%2F%2F'). $_SERVER ['HTTP_HOST'] . "%2Fsdk.php%2FSpend%2Fpay_success%2Forderno%2F".$request['pay_order_number'].'%2Fgame_id%2F'.$request['game_id'] ; - }else{ - echo json_encode(['code'=>0,'msg'=> '支付失败']); - Log::write("platform_weixin_pay支付失败".serialize($is_pay)); - exit; - // redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'支付失败', 'user_token' => $this->userToken)));exit; } + + }elseif ($pay_info['channel'] == 5) { $request['pay_way'] = self::WX_PAY;