Merge branch 'dev' of wmtx/sdk into master

金菠菜官方支付、金菠菜汇付宝支付、197/198游戏隐藏客服
master
张谷诚 5 years ago committed by Gogs
commit 5f9db50129

@ -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) {
//获取回调订单信息

@ -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;
}

@ -75,6 +75,14 @@ class GameController extends BaseController{
} else {
$contact_cs[$k]['ios_url'] = $contact_cs[$k]['ios_url']."{$gap}action=openurl";
}
// 魔幻游戏 隐藏客服
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'] = "";
}
}
}

@ -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 || $request['game_id'] == 198) $data['APP_QQ'] = "";
$this->new_set_message(200,"成功",$data);
}
//获取客服问题 帮助中心

@ -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'=> '支付失败,请重试'.$json_data['ret_msg']]);
exit;
}
$this->add_spend($request,1);
}elseif(get_wx_pay_type() == 2){
if($request['code']==1){

@ -65,7 +65,7 @@
<div>请选择支付方式</div>
<img src="__IMG__/pay_way/dacha.png" alt="">
</div>
<if condition="C('alipay.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.zfb') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.zfb') eq 1)">
<if condition="C('alipay.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.zfb') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.zfb') eq 1) or (C('heepay.status') eq 1 and C('heepay.alipay') eq 1)">
<div class="payment_rest_way way_btn" data-type="alipay" data-url="{:U('PayH5/ali_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id'),'user_token'=>I('user_token'),'api_ver'=>2))}">
<div>
<img src="__IMG__/pay_way/zhifubao.png" alt="">
@ -177,7 +177,7 @@
<div>请选择支付方式</div>
<img src="__IMG__/pay_way/dacha.png" alt="">
</div>
<if condition="C('alipay.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.zfb') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.zfb') eq 1)">
<if condition="C('alipay.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.zfb') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.zfb') eq 1) or (C('heepay.status') eq 1 and C('heepay.alipay') eq 1)">
<div class="payment_rest_way way_btn" data-type="alipay" data-url="{:U('PayH5/ali_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id'),'user_token'=>I('user_token'),'api_ver'=>2))}">
<div>
<img src="__IMG__/pay_way/zhifubao.png" alt="">

@ -58,7 +58,7 @@
<div>请选择支付方式</div>
<img src="__IMG__/pay_way/dacha.png" alt="">
</div>
<if condition="C('alipay.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.zfb') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.zfb') eq 1)">
<if condition="C('alipay.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.zfb') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.zfb') eq 1) or (C('heepay.status') eq 1 and C('heepay.alipay') eq 1)">
<div class="payment_rest_way way_btn" data-type="alipay" data-url="{:U('PayH5/platform_alipay_pay', array('user_token' => I('user_token'), 'api_ver' => 2, 'game_id' => $game_id, 'price' => $money))}">
<div>
<img src="__IMG__/pay_way/zhifubao.png" alt="" >
@ -165,7 +165,7 @@
<div>请选择支付方式</div>
<img src="__IMG__/pay_way/dacha.png" alt="">
</div>
<if condition="C('alipay.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.zfb') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.zfb') eq 1)">
<if condition="C('alipay.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.zfb') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.zfb') eq 1) or (C('heepay.status') eq 1 and C('heepay.alipay') eq 1)">
<div class="payment_rest_way way_btn" data-type="alipay" data-url="{:U('PayH5/platform_alipay_pay', array('user_token' => I('user_token'), 'api_ver' => 2, 'game_id' => $game_id, 'price' => $money))}">
<div>
<img src="__IMG__/pay_way/zhifubao.png" alt="" >

@ -40,20 +40,28 @@ class Heepay {
$token_id=explode("</token_id>",$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 . '&notify_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='. $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'];//密钥
@ -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("<redirectUrl><![CDATA[",$xml);
// pp($string);
// pp($xml);
$token_id=explode("]]></redirectUrl>",$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 . '&notify_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("<redirectUrl><![CDATA[",$xml);
// pp($string);
$token_id=explode("]]></redirectUrl>",$string[1]);
return $token_id[0];
} */
//https服务器 POST请求
public function request_post($url = '', $post_data = array()) {

@ -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) {

Loading…
Cancel
Save