From e84f04ed6ff0221324ef0dd303b5408feb689dba Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 31 Mar 2020 17:34:44 +0800 Subject: [PATCH 01/11] =?UTF-8?q?OA=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FengHuoApi2Controller.class.php | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Application/Sdk/Controller/FengHuoApi2Controller.class.php b/Application/Sdk/Controller/FengHuoApi2Controller.class.php index 877e2b19..fdd1d076 100644 --- a/Application/Sdk/Controller/FengHuoApi2Controller.class.php +++ b/Application/Sdk/Controller/FengHuoApi2Controller.class.php @@ -241,27 +241,33 @@ class FengHuoApi2Controller extends GetInfoBaseController{ // 默认排序:id降序 $order = 'login_time asc'; - $where['login_time'] = array('neq',0); +// $where['login_time'] = array('neq',0); $data = M('user_login_record','tab_') - ->field('user_id,game_name,server_name,login_time,user_account,game_player_name') + ->field('tab_user_login_record.id,tab_user_login_record.id,user_id,game_name,server_name,login_time,user_account,game_player_name,CASE WHEN promote_id = 0 THEN "官方渠道" ELSE account END as promote_account') + ->join("left join tab_promote as promote on tab_user_login_record.promote_id=promote.id") ->where($where) ->order($order) ->page($page, $row) - ->select(); - foreach ($data as $k=>$v){ - $promoteId = $v['promote_id']; - if($promoteId == 0){ - $data[$k]['promote_account'] = '官方渠道'; - }else{ - $promote_account = M('promote','tab_') - ->field('account') - ->where('id',$promoteId) - ->find(); - $data[$k]['promote_account'] = $promote_account; - } + ->select(false); + +// echo $data;die(); +// foreach ($data as $k=>$v){ +// $promoteId = $v['promote_id']; +// if($promoteId == 0){ +// $data[$k]['promote_account'] = '官方渠道'; +// }else{ +// $promote_account = M('promote','tab_') +// ->field('account') +// ->where('id',$promoteId) +// ->find(); +// +// $data[$k]['promote_account'] = $promote_account; +// } +// +// } - } +// dump($data);die(); if($data){ $result = [ From cb8fa24d5dce034df60075b9dde2e4bb2d0f1f4c Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 31 Mar 2020 19:02:35 +0800 Subject: [PATCH 02/11] =?UTF-8?q?OA=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sdk/Controller/FengHuoApi2Controller.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Sdk/Controller/FengHuoApi2Controller.class.php b/Application/Sdk/Controller/FengHuoApi2Controller.class.php index fdd1d076..c41c1ff7 100644 --- a/Application/Sdk/Controller/FengHuoApi2Controller.class.php +++ b/Application/Sdk/Controller/FengHuoApi2Controller.class.php @@ -249,7 +249,7 @@ class FengHuoApi2Controller extends GetInfoBaseController{ ->where($where) ->order($order) ->page($page, $row) - ->select(false); + ->select(); // echo $data;die(); // foreach ($data as $k=>$v){ From b5cb1436599189db65263183f1e82118050b0822 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Fri, 3 Apr 2020 11:39:52 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E7=A4=BC=E5=8C=85?= =?UTF-8?q?=E6=80=BB=E6=95=B0=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sdk/View/default/GameGiftPage/details.html | 2 +- Application/Sdk/View/default/GameGiftPage/lists.html | 2 +- Application/Sdk/View/default/GameGiftPage/receive.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Application/Sdk/View/default/GameGiftPage/details.html b/Application/Sdk/View/default/GameGiftPage/details.html index e9b549e4..c7ee7526 100644 --- a/Application/Sdk/View/default/GameGiftPage/details.html +++ b/Application/Sdk/View/default/GameGiftPage/details.html @@ -19,7 +19,7 @@

{$content.giftbag_name}

-

剩余{$content.novice_num}个

+
激活码:{$novice}
diff --git a/Application/Sdk/View/default/GameGiftPage/lists.html b/Application/Sdk/View/default/GameGiftPage/lists.html index f024e3ee..edc467ca 100644 --- a/Application/Sdk/View/default/GameGiftPage/lists.html +++ b/Application/Sdk/View/default/GameGiftPage/lists.html @@ -20,7 +20,7 @@

{$game.game_name}

-

礼包总数{$game.gift_num}

+
diff --git a/Application/Sdk/View/default/GameGiftPage/receive.html b/Application/Sdk/View/default/GameGiftPage/receive.html index 10681e34..f36a36e3 100644 --- a/Application/Sdk/View/default/GameGiftPage/receive.html +++ b/Application/Sdk/View/default/GameGiftPage/receive.html @@ -32,7 +32,7 @@

{$content.giftbag_name}

-

剩余{$content.novice_num}个

+
From 7b25ec926ee063bc0f00d64c0efe1bbba5f33c68 Mon Sep 17 00:00:00 2001 From: tping Date: Wed, 8 Apr 2020 18:31:06 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E9=AD=94=E5=B9=BB=E6=B8=B8=E6=88=8F=20?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=AE=A2=E6=9C=8D=20197?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sdk/Controller/GameController.class.php | 5 +++++ Application/Sdk/Controller/NoticeController.class.php | 3 +++ 2 files changed, 8 insertions(+) diff --git a/Application/Sdk/Controller/GameController.class.php b/Application/Sdk/Controller/GameController.class.php index 403aef19..9205e956 100644 --- a/Application/Sdk/Controller/GameController.class.php +++ b/Application/Sdk/Controller/GameController.class.php @@ -75,6 +75,11 @@ class GameController extends BaseController{ } else { $contact_cs[$k]['ios_url'] = $contact_cs[$k]['ios_url']."{$gap}action=openurl"; } + // 魔幻游戏 隐藏客服 + if ($data['game_id'] == 197) { + $contact_cs[$k]['act'] = ""; + $contact_cs[$k]['ios_url'] = ""; + } } } diff --git a/Application/Sdk/Controller/NoticeController.class.php b/Application/Sdk/Controller/NoticeController.class.php index e838caa1..37e7d264 100644 --- a/Application/Sdk/Controller/NoticeController.class.php +++ b/Application/Sdk/Controller/NoticeController.class.php @@ -402,11 +402,14 @@ class NoticeController extends BaseController{ //帮助中心客服 //yyh 2018 10 26 public function customer_contact(){ + $request = json_decode(base64_decode(file_get_contents("php://input")),true); $data['APP_QQ'] = C('APP_QQ'); $data['APP_TEL'] = C('APP_TEL'); $data['QQ_GROUP_KEY'] = C('QQ_GROUP_KEY'); $data['APP_QQ_GROUP'] = C('APP_QQ_GROUP'); $data['APP_EMAIL'] = C('APP_EMAIL'); + // 魔幻游戏 隐藏客服 + if ($request['game_id'] == 197) $data['APP_QQ'] = ""; $this->new_set_message(200,"成功",$data); } //获取客服问题 帮助中心 From 021afc22d1b9395d55b1a5ef875eaef6d855f270 Mon Sep 17 00:00:00 2001 From: tping Date: Wed, 8 Apr 2020 18:34:34 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E9=AD=94=E5=B9=BB=E6=B8=B8=E6=88=8F=20?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=AE=A2=E6=9C=8D=20197=20198?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sdk/Controller/GameController.class.php | 2 +- Application/Sdk/Controller/NoticeController.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Application/Sdk/Controller/GameController.class.php b/Application/Sdk/Controller/GameController.class.php index 9205e956..017ffe22 100644 --- a/Application/Sdk/Controller/GameController.class.php +++ b/Application/Sdk/Controller/GameController.class.php @@ -76,7 +76,7 @@ class GameController extends BaseController{ $contact_cs[$k]['ios_url'] = $contact_cs[$k]['ios_url']."{$gap}action=openurl"; } // 魔幻游戏 隐藏客服 - if ($data['game_id'] == 197) { + if ($data['game_id'] == 197 || $data['game_id'] == 198) { $contact_cs[$k]['act'] = ""; $contact_cs[$k]['ios_url'] = ""; } diff --git a/Application/Sdk/Controller/NoticeController.class.php b/Application/Sdk/Controller/NoticeController.class.php index 37e7d264..0493253c 100644 --- a/Application/Sdk/Controller/NoticeController.class.php +++ b/Application/Sdk/Controller/NoticeController.class.php @@ -409,7 +409,7 @@ class NoticeController extends BaseController{ $data['APP_QQ_GROUP'] = C('APP_QQ_GROUP'); $data['APP_EMAIL'] = C('APP_EMAIL'); // 魔幻游戏 隐藏客服 - if ($request['game_id'] == 197) $data['APP_QQ'] = ""; + if ($request['game_id'] == 197 || $request['game_id'] == 198) $data['APP_QQ'] = ""; $this->new_set_message(200,"成功",$data); } //获取客服问题 帮助中心 From 347c51ac617fc103ffb432b42511e5755226a8ac Mon Sep 17 00:00:00 2001 From: tping Date: Thu, 9 Apr 2020 15:49:25 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E9=AD=94=E5=B9=BB=E6=B8=B8=E6=88=8F=20?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=AE=A2=E6=9C=8D=20197=20198?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sdk/Controller/GameController.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Application/Sdk/Controller/GameController.class.php b/Application/Sdk/Controller/GameController.class.php index 017ffe22..91f53d73 100644 --- a/Application/Sdk/Controller/GameController.class.php +++ b/Application/Sdk/Controller/GameController.class.php @@ -77,7 +77,10 @@ class GameController extends BaseController{ } // 魔幻游戏 隐藏客服 if ($data['game_id'] == 197 || $data['game_id'] == 198) { + // android $contact_cs[$k]['act'] = ""; + $contact_cs[$k]['type'] = -1; + // IOS $contact_cs[$k]['ios_url'] = ""; } From a74da437d0393aa347924fc36d1afee21adeef9e Mon Sep 17 00:00:00 2001 From: tping Date: Thu, 9 Apr 2020 18:20:15 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E6=B1=87=E4=BB=98=E5=AE=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Common/Common/extend.php | 18 ++- .../Sdk/Controller/PayH5Controller.class.php | 109 +++++++++++++++++- .../Sdk/View/default/Spend/pay_way.html | 4 +- .../Sdk/View/default/UserH/platform_pay.html | 4 +- .../Library/Org/HeepaySDK/Heepay.class.php | 71 +++++++++++- 5 files changed, 185 insertions(+), 21 deletions(-) diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index dd34d75a..94558cd0 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -1782,15 +1782,15 @@ function get_wx_type(){ if(MODULE_NAME=='Media'||MODULE_NAME=='Media2'||MODULE_NAME=='Home'){ $map['name']=array('in',array('wei_xin','weixin','weixin_gf')); }elseif(MODULE_NAME=='Sdk'){ - $map['name']=array('in',array('wei_xin_app','weixin','weixin_gf','jft_wap','goldpig')); + $map['name']=array('in',array('heepay','wei_xin_app','weixin','weixin_gf','jft_wap','goldpig' )); }elseif(MODULE_NAME=='App'){ $map['name']=array('in',array('wei_xin_apps','weixin_app')); } $type=M('Tool','tab_')->where($map)->select(); foreach ($type as $k => $v) { - if($v['status']==1){ - $name=$v['name']; - } + if($v['status']==1){ + $name=$v['name']; + } } if($name=="weixin"){ return 1; @@ -1800,6 +1800,8 @@ function get_wx_type(){ return 2; }elseif($name=="goldpig" && C('goldpig.wx')){ return 3; + }elseif($name=="heepay" && C('heepay.wxpay')){ + return 4; }else{ return 0; } @@ -1969,14 +1971,14 @@ function get_shortcut_pay_type(){ //获取微信支付类型 0官方 1金猪wap 2双乾 function get_zfb_type($game_id=0, $user_id=0){ - if ($game_id) { + /* if ($game_id) { $game = M('game', 'tab_')->where(['id' => $game_id])->find(); if ($game && $game['pay_config']) { $payConf = json_decode($game['pay_config'], true); if ($payConf['zfb'] == 'gf') return 0; if ($payConf['zfb'] == 'sq') return 2; } - } + } */ if(C('alipay.status') == 1) {return 0;} $map['name']='goldpig'; @@ -1989,6 +1991,10 @@ function get_zfb_type($game_id=0, $user_id=0){ $map['name']='sqpay'; $type=M('Tool','tab_')->field('status')->where($map)->find(); if($type['status']==1 && C('sqpay.zfb')) return 2; // 双乾支付 + + $map['name']='heepay'; + $type=M('Tool','tab_')->field('status')->where($map)->find(); + if($type['status']==1 && C('heepay.alipay')) return 4; // 汇付宝 return 0; } diff --git a/Application/Sdk/Controller/PayH5Controller.class.php b/Application/Sdk/Controller/PayH5Controller.class.php index 9bbd0da3..416b1396 100644 --- a/Application/Sdk/Controller/PayH5Controller.class.php +++ b/Application/Sdk/Controller/PayH5Controller.class.php @@ -160,6 +160,49 @@ class PayH5Controller extends BaseController{ //echo json_encode(['code'=>0,'msg'=>$ret[0]['respMess'],'wap'=>1]); //exit; } + } elseif(get_zfb_type($game_id, $user_id) == 4) { // 汇付宝 + + $request['pay_way'] = C('PAY_WAY.WFT_PAY'); + $request['pay_status'] = 0; + $request['spend_ip'] = get_client_ip(); + + $this->add_deposit($request, 1); + + $pay['agent_id'] = C('heepay.partner');//商户号 + $pay['order_no'] = $request['pay_order_number']; + $pay['time'] = date('YmdHis', time()); + $pay['pay_type'] = 22; + $pay['amount'] = $request['price']; + $pay['user_ip'] = get_client_ip(); + $pay['sign_key'] = C('heepay.key');//密钥 + $pay['payerName'] = iconv("UTF-8", "gb2312//IGNORE", "万盟天下"); + $pay['number'] = 1; + $pay['goods_note']= "消费-".$request["pay_order_number"]; + $pay['device'] = "wap"; + $pay['bank_card_type'] = 0; + $pay['return_url'] = C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}"; + $pay['notifyurl'] = C('PAY_DOMAIN')."/callback.php/Notify/heepay_callback";//通知 + $heepay = new Heepay(); + $json_data = $heepay->alih5_pay($pay); + +// pp($json_data); + if($json_data['ret_code'] == "0000"){ + $json_data['url'] = $json_data['url']/* . "?tx_client=hideopen" */; + // 存入pay_url 继续支付 + M("deposit", "tab_")->where([ + 'extend' => $request['extend'], + 'game_id' => $request['game_id'], + 'pay_order_number' => $request["pay_order_number"] + ])->save([ + 'pay_url' => $json_data['url'] + ]); + $orderno = $request['pay_order_number']; + + } 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; + } } else{ // 支付宝第三方 if( empty(C('goldpig.partner'))||empty(C('goldpig.wooolid'))){ // $this->set_message(1009, "fail", "支付参数未配置"); @@ -423,6 +466,55 @@ class PayH5Controller extends BaseController{ echo json_encode(['code'=>0,'msg'=>$ret[0]['respMess'],'wap'=>1]); exit; } + } elseif(get_zfb_type($game_id, $user_id) == 4) { // 汇付宝 + + $request['pay_way'] = C('PAY_WAY.WFT_PAY'); + $request['pay_status'] = 0; + $request['spend_ip'] = get_client_ip(); + + $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); + + $pay['agent_id'] = C('heepay.partner');//商户号 + $pay['order_no'] = $request['pay_order_number']; + $pay['time'] = date('YmdHis', time()); + $pay['pay_type'] = 22; + $pay['amount'] = $request['price']; + $pay['user_ip'] = get_client_ip(); + $pay['sign_key'] = C('heepay.key');//密钥 + $pay['payerName'] = iconv("UTF-8", "gb2312//IGNORE", "万盟天下"); + $pay['number'] = 1; + $pay['goods_note']= "消费-".$request["pay_order_number"]; + $pay['device'] = "wap"; + $pay['bank_card_type'] = 0; + $pay['return_url'] = C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}"; + $pay['notifyurl'] = C('PAY_DOMAIN')."/callback.php/Notify/heepay_callback";//通知 + $heepay = new Heepay(); + $json_data = $heepay->alih5_pay($pay); + + if($json_data['ret_code'] == "0000"){ + $json_data['url'] = $json_data['url']/* . "?tx_client=hideopen" */; + // 存入pay_url 继续支付 + M("spend", "tab_")->where([ + 'extend' => $request['extend'], + 'game_id' => $request['game_id'], + 'pay_order_number' => $request["pay_order_number"] + ])->save([ + 'pay_url' => $json_data['url'] + ]); + $orderno = $request['pay_order_number']; + + } 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; + } + } else{ // 支付宝第三方 if( empty(C('goldpig.partner'))||empty(C('goldpig.wooolid'))){ // $this->set_message(1009, "fail", "支付参数未配置"); @@ -669,7 +761,7 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`; jsonOutput(0, "支付失败"); // redirect(U('Spend/notice',array('user_id'=>$user_id, 'is_platform' => 1,'game_id'=>$game_id,'msg'=>'支付失败', 'user_token' => $this->userToken)));exit; } - }elseif(get_wx_pay_type() == 1){ + }elseif(get_wx_pay_type() == 1){ // 汇付宝 $request['pay_way'] = C('PAY_WAY.WFT_PAY'); // 威富通wx $pay['agent_id'] = C('heepay.partner');//商户号 @@ -750,9 +842,9 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`; $pay['amount'] = $request['price']; $pay['user_ip'] = get_client_ip(); $pay['sign_key'] = C('heepay.key');//密钥 - $pay['payerName'] = "cs"; + $pay['payerName'] = ""; $pay['number'] = 1; - $pay['goods_note']="cs"; + $pay['goods_note']="游戏充值"; $pay['device'] = "wap"; $pay['bank_card_type'] = 0; $pay['return_url'] ='http://' . $_SERVER ['HTTP_HOST'] . "/sdk.php/Spend/pay_success/orderno/".$pay['order_no'].'/game_id/'.$request['game_id']; @@ -1396,10 +1488,15 @@ ADD COLUMN `pay_url` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER $pay['return_url'] = C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}"; $pay['notify_url'] = C('PAY_DOMAIN')."/callback.php/Notify/heepay_callback"; $heepay = new Heepay(); - $url = $heepay->wxh5_pay($pay); - $request['pay_url'] = $url/* ."&tx_client=hideopen" */; + $json_data = $heepay->wxh5_pay($pay); + if($json_data['ret_code'] == "0000"){ + $request['pay_url'] = $json_data['url'] . "&tx_client=hideopen"; + $this->add_spend($request,1); + } else { + echo json_encode(['code'=>0,'msg'=> '支付失败,请重试']); + exit; + } - $this->add_spend($request,1); }elseif(get_wx_pay_type() == 2){ if($request['code']==1){ diff --git a/Application/Sdk/View/default/Spend/pay_way.html b/Application/Sdk/View/default/Spend/pay_way.html index 67457bbe..234aba5e 100644 --- a/Application/Sdk/View/default/Spend/pay_way.html +++ b/Application/Sdk/View/default/Spend/pay_way.html @@ -65,7 +65,7 @@
请选择支付方式
- +
@@ -177,7 +177,7 @@
请选择支付方式
- +
diff --git a/Application/Sdk/View/default/UserH/platform_pay.html b/Application/Sdk/View/default/UserH/platform_pay.html index 8dca8260..641561f9 100644 --- a/Application/Sdk/View/default/UserH/platform_pay.html +++ b/Application/Sdk/View/default/UserH/platform_pay.html @@ -58,7 +58,7 @@
请选择支付方式
- +
@@ -165,7 +165,7 @@
请选择支付方式
- +
diff --git a/ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php b/ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php index a42fb653..a89c4d50 100644 --- a/ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php +++ b/ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php @@ -40,16 +40,24 @@ class Heepay { $token_id=explode("",$string[1]); return $token_id[0]; } + public function wxh5_pay($pay){ + $pay['pay_type'] = 30; + return $this->h5_pay($pay); + } + public function alih5_pay($pay){ + $pay['pay_type'] = 22; + return $this->h5_pay($pay); + } // 汇付宝 微信H5 - public function wxh5_pay($pay){ + public function h5_pay($pay){ /*************创建签名***************/ $sign_str = ''; $sign_str = $sign_str . 'version=1'; $sign_str = $sign_str . '&agent_id=' . $pay['agent_id']; $sign_str = $sign_str . '&agent_bill_id=' . $pay['order_no']; $sign_str = $sign_str . '&agent_bill_time=' . $pay['time']; - $sign_str = $sign_str . '&pay_type=30'; + $sign_str = $sign_str . '&pay_type=' . $pay['pay_type']; $sign_str = $sign_str . '&pay_amt=' . $pay['amount']; $sign_str = $sign_str . '¬ify_url='.$pay['notify_url']; $sign_str = $sign_str . '&return_url='.$pay['return_url']; @@ -71,7 +79,7 @@ class Heepay { $data=array( 'version'=>1, 'scene' => 'h5', - 'pay_type'=> 30,//支付类型 + 'pay_type'=> $pay['pay_type'],//支付类型 'agent_id'=>$pay['agent_id'],//商户号 'agent_bill_id'=>$pay['order_no'],//订单号 'pay_amt'=>$pay['amount'],//支付金额 @@ -89,11 +97,64 @@ class Heepay { 'sign'=>$sign, ); $xml=$this->request_post("https://Pay.Heepay.com/DirectPay/applypay.aspx", $data); + $xmls =simplexml_load_string($xml); + $url = simplexml_load_string($xmls.redirectUrl); + $xmljson= json_encode($xmls); + $ret=json_decode($xmljson,true); +// return $ret; + $string=explode("",$string[1]); - return $token_id[0]; + $ret['url']= $token_id[0]; + return $ret; } + + /* // 汇付宝 aliH5 + public function alih5_pay($pay){ + $sign_str = ''; + $sign_str = $sign_str . 'version=1'; + $sign_str = $sign_str . '&agent_id=' . $pay['agent_id']; + $sign_str = $sign_str . '&agent_bill_id=' . $pay['order_no']; + $sign_str = $sign_str . '&agent_bill_time=' . $pay['time']; + $sign_str = $sign_str . '&pay_type=22'; + $sign_str = $sign_str . '&pay_amt=' . $pay['amount']; + $sign_str = $sign_str . '¬ify_url='.$pay['notify_url']; + $sign_str = $sign_str . '&return_url='.$pay['return_url']; + $sign_str = $sign_str . '&user_ip='. str_replace($pay['user_ip'], "_", "."); + $sign_str = $sign_str . '&key=' . $pay['sign_key'];//密钥 + $sign = strtolower(md5($sign_str)); //签名值 + // var_dump($sign, $sign_str); + + $data=array( + 'version'=>1, + 'is_phone' => '1', + 'pay_type'=> 22,//支付类型 + 'agent_id'=>$pay['agent_id'],//商户号 + 'agent_bill_id'=>$pay['order_no'],//订单号 + 'pay_amt'=>$pay['amount'],//支付金额 + 'notify_url'=> $pay['notify_url'],//通知地址 + 'return_url' => $pay['return_url'], + 'user_ip'=>str_replace($pay['user_ip'], "_", "."),//用户ip + 'agent_bill_time'=>$pay['time'],//date('YmdHis', time()) 时间 + 'goods_name' => $pay['payerName'],//商品名 + 'remark'=> $pay['remark'],//备注 +// 'goods_num' => $pay['number'],//商品数量 + 'goods_note'=>$pay['goods_note'],//说明 + 'sign'=>$sign, + ); + $xml=$this->request_post("https://pay.heepay.com/Payment/Index.aspx", $data); + echo ($xml);die; + $xmls =simplexml_load_string($xml); + $xmljson= json_encode($xmls); + $ret=json_decode($xmljson,true); + return $ret; + + $string=explode("",$string[1]); + return $token_id[0]; + } */ //https服务器 POST请求 public function request_post($url = '', $post_data = array()) { From ac8a9dc8206f61e7716f2942eb4b89a0e29be16f Mon Sep 17 00:00:00 2001 From: tping Date: Thu, 9 Apr 2020 18:28:07 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sdk/Controller/PayH5Controller.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Sdk/Controller/PayH5Controller.class.php b/Application/Sdk/Controller/PayH5Controller.class.php index 416b1396..fa288d0c 100644 --- a/Application/Sdk/Controller/PayH5Controller.class.php +++ b/Application/Sdk/Controller/PayH5Controller.class.php @@ -1493,7 +1493,7 @@ ADD COLUMN `pay_url` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER $request['pay_url'] = $json_data['url'] . "&tx_client=hideopen"; $this->add_spend($request,1); } else { - echo json_encode(['code'=>0,'msg'=> '支付失败,请重试']); + echo json_encode(['code'=>0,'msg'=> '支付失败,请重试'.$json_data['ret_msg']]); exit; } From aefb5fa81d79135cad06b5297e25b349eef5f71f Mon Sep 17 00:00:00 2001 From: tping Date: Thu, 9 Apr 2020 18:53:30 +0800 Subject: [PATCH 09/11] =?UTF-8?q?ip=20=E6=8B=BC=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php b/ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php index a89c4d50..90ef4841 100644 --- a/ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php +++ b/ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php @@ -61,7 +61,7 @@ class Heepay { $sign_str = $sign_str . '&pay_amt=' . $pay['amount']; $sign_str = $sign_str . '¬ify_url='.$pay['notify_url']; $sign_str = $sign_str . '&return_url='.$pay['return_url']; - $sign_str = $sign_str . '&user_ip='. $pay['user_ip']; + $sign_str = $sign_str . '&user_ip='. str_replace('.', '-', $pay['user_ip']); $sign_str = $sign_str . '&bank_card_type='. $pay['bank_card_type']; $sign_str = $sign_str . '&remark=' . $pay['remark']; $sign_str = $sign_str . '&key=' . $pay['sign_key'];//密钥 From df81c76b99c32b732f8594856660489843ec7d8d Mon Sep 17 00:00:00 2001 From: tping Date: Thu, 9 Apr 2020 19:04:17 +0800 Subject: [PATCH 10/11] =?UTF-8?q?ip=20=E6=8B=BC=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php b/ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php index 90ef4841..6aba6d45 100644 --- a/ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php +++ b/ThinkPHP/Library/Org/HeepaySDK/Heepay.class.php @@ -61,7 +61,7 @@ class Heepay { $sign_str = $sign_str . '&pay_amt=' . $pay['amount']; $sign_str = $sign_str . '¬ify_url='.$pay['notify_url']; $sign_str = $sign_str . '&return_url='.$pay['return_url']; - $sign_str = $sign_str . '&user_ip='. str_replace('.', '-', $pay['user_ip']); + $sign_str = $sign_str . '&user_ip='. $pay['user_ip'];//str_replace('.', '-', $pay['user_ip']); $sign_str = $sign_str . '&bank_card_type='. $pay['bank_card_type']; $sign_str = $sign_str . '&remark=' . $pay['remark']; $sign_str = $sign_str . '&key=' . $pay['sign_key'];//密钥 From 20b17fdd9e153c8481eed20b92874b61618ef591 Mon Sep 17 00:00:00 2001 From: tping Date: Fri, 10 Apr 2020 10:32:17 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E9=87=91=E6=B3=A2=E8=8F=9C=20=E5=AE=98?= =?UTF-8?q?=E6=96=B9=E6=94=AF=E4=BB=98=E5=AE=9D=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Callback/Controller/Notify2Controller.class.php | 7 ++++++- ThinkPHP/Library/Think/Pay.class.php | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Application/Callback/Controller/Notify2Controller.class.php b/Application/Callback/Controller/Notify2Controller.class.php index ab60f90d..0706fc24 100644 --- a/Application/Callback/Controller/Notify2Controller.class.php +++ b/Application/Callback/Controller/Notify2Controller.class.php @@ -40,7 +40,12 @@ class Notify2Controller extends BaseController } Vendor('Alipay.AopSdk'); $aop = new \AopClient(); - $aop->alipayrsaPublicKey = file_get_contents("./Application/Sdk/SecretKey/alipay/alipay2_public_key.txt"); + +// $aop->alipayrsaPublicKey = file_get_contents("./Application/Sdk/SecretKey/alipay/alipay2_public_key.txt"); + $aop->alipayrsaPublicKey = C('alipay.pub_secret'); + if (!$aop->alipayrsaPublicKey) { + $aop->alipayrsaPublicKey = file_get_contents("./Application/Sdk/SecretKey/alipay/alipay2_public_key.txt"); + } $result = $aop->rsaCheckV1($notify,'','RSA2'); if ($result) { //获取回调订单信息 diff --git a/ThinkPHP/Library/Think/Pay.class.php b/ThinkPHP/Library/Think/Pay.class.php index 998dcc90..51850d69 100644 --- a/ThinkPHP/Library/Think/Pay.class.php +++ b/ThinkPHP/Library/Think/Pay.class.php @@ -116,7 +116,14 @@ class Pay $aop = new \AopClient(); $aop->appId = C('alipay.appid'); $aop->signType = 'RSA2'; - $aop->rsaPrivateKey = file_get_contents("./Application/Sdk/SecretKey/alipay/rsa2_private_key.txt"); + $aop->rsaPrivateKey = C('alipay.pri_secret'); + if (!$aop->rsaPrivateKey) { + $aop->rsaPrivateKey = file_get_contents("./Application/Sdk/SecretKey/alipay/rsa2_private_key.txt"); + } + $aop->alipayrsaPublicKey = C('alipay.pub_secret'); + if (!$aop->alipayrsaPublicKey) { + $aop->alipayrsaPublicKey = file_get_contents("./Application/Sdk/SecretKey/alipay/alipay2_public_key.txt"); + } $type = $vo->getPayMethod(); //file_put_contents(dirname(__FILE__) . '/newbuildRequestForm.txt',json_encode($vo->getOrderNo())); switch ($type) {