|
|
|
@ -64,12 +64,18 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
if ($check) {
|
|
|
|
|
echo json_encode(['code'=>1001,'msg'=> "请求发起失效,编号{$request['pay_order_number']},请选择其他支付方式或联系客服"]);exit;
|
|
|
|
|
}
|
|
|
|
|
if(get_zfb_type($game_id, $user_id)== -1){
|
|
|
|
|
echo json_encode(['code'=>1001,'msg'=> "暂不支持支付,请联系客服"]);
|
|
|
|
|
|
|
|
|
|
$pay_info = get_payment_config(1, $game, $request['user_id']);
|
|
|
|
|
if ($pay_info['code'] != 0) {
|
|
|
|
|
echo json_encode(['code'=>1010,'msg'=> $pay_info['msg']]);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
if(get_zfb_type($game_id, $user_id)==0){ // 支付宝官方
|
|
|
|
|
if(C('alipay.way')==1/* || ($request['is_create_ordernumer']==1 && C('alipay.way')==0) */){ /* wap */
|
|
|
|
|
$pay_conf = json_decode($pay_info['data']['config'], true);
|
|
|
|
|
$pay_info = $pay_info['data'];
|
|
|
|
|
$pay_conf['id'] = $pay_info['id'];
|
|
|
|
|
$pay_conf['merchant_id'] = $pay_info['id'];
|
|
|
|
|
|
|
|
|
|
if ($pay_info['channel'] == 1) { // 支付宝官方
|
|
|
|
|
|
|
|
|
|
$request['apitype'] = "alipay";
|
|
|
|
|
$request['config'] = "alipay";
|
|
|
|
@ -82,52 +88,32 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
|
|
|
|
|
//$request['callback'] = 'http://'.$_SERVER['HTTP_HOST']. "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
|
|
|
|
|
//$request['notifyurl'] = 'http://'.$_SERVER['HTTP_HOST']. "/callback.php/Notify/notify/apitype/alipay/method/notify";
|
|
|
|
|
$pay_url=$this->pay($request);
|
|
|
|
|
$pay_url=$this->pay($request, $pay_conf);
|
|
|
|
|
$request['pay_url'] = $pay_url['url']."&tx_client=hideopen";;
|
|
|
|
|
$orderno = $pay_url['out_trade_no'];
|
|
|
|
|
//echo $pay_url['url'];die;
|
|
|
|
|
// redirect($pay_url['url']);
|
|
|
|
|
// echo json_encode(['code'=>200,'msg'=>'','data'=>['url'=>$pay_url['url'],'wap'=>1]]);exit;
|
|
|
|
|
} else {/* app */
|
|
|
|
|
$game_set_data = get_game_set_info(I('request.game_id'));
|
|
|
|
|
$request['apitype'] = "alipay";
|
|
|
|
|
$request['config'] = "alipay";
|
|
|
|
|
$request['signtype'] = "MD5";
|
|
|
|
|
$request['server'] = "mobile.securitypay.pay";
|
|
|
|
|
$request['payway'] = C("PAY_WAY.ALIPAY"); // 1 支付宝
|
|
|
|
|
$request['title'] = "平台币充值"; //$request['price'];
|
|
|
|
|
$request['body'] = "平台币充值";
|
|
|
|
|
$data = $this->alipay_app_pay($request);
|
|
|
|
|
$md5_sign = $this->encrypt_md5(base64_encode($data['arg']), $game_set_data["access_key"]);
|
|
|
|
|
|
|
|
|
|
$data = array("orderInfo" => base64_encode($data['arg']), "out_trade_no" => $data['out_trade_no'], "order_sign" => $data['sign'], "md5_sign" => $md5_sign, "code" => 0);
|
|
|
|
|
$request['pay_url'] = json_encode($data);
|
|
|
|
|
$orderno = $data['out_trade_no'];
|
|
|
|
|
|
|
|
|
|
//echo json_encode(['code'=>200,'msg'=>'','data'=>['url'=>json_encode($data),'wap'=>0]]);exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 存入pay_url 继续支付
|
|
|
|
|
M("deposit", "tab_")->where([
|
|
|
|
|
'extend' => $request['extend'],
|
|
|
|
|
'game_id' => $request['game_id'],
|
|
|
|
|
'pay_order_number' => $orderno
|
|
|
|
|
])->save([
|
|
|
|
|
'pay_url' => $request['pay_url']
|
|
|
|
|
'pay_url' => $request['pay_url'],
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
}elseif(get_zfb_type($game_id, $user_id) == 2) { // 双乾
|
|
|
|
|
|
|
|
|
|
} elseif ($pay_info['channel'] == 4) { // 双乾
|
|
|
|
|
$request['pay_way'] = C('PAY_WAY.SQ_ALIPAY');
|
|
|
|
|
$request['pay_status'] = 0;
|
|
|
|
|
$request['spend_ip'] = get_client_ip();
|
|
|
|
|
|
|
|
|
|
$request['id'] = $pay_info['id'];
|
|
|
|
|
$request['merchant_id'] = $pay_info['id'];
|
|
|
|
|
$request['merchant_way'] = 1;
|
|
|
|
|
$this->add_deposit($request, 1);
|
|
|
|
|
|
|
|
|
|
$sqpay=new Sqpay();
|
|
|
|
|
$returl = C('PAY_DOMAIN'). "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
|
|
|
|
|
$data['secret'] = C("sqpay.key");
|
|
|
|
|
$data['merno'] = C("sqpay.partner");
|
|
|
|
|
$data['secret'] = $pay_conf['secret']; // C("sqpay.key");
|
|
|
|
|
$data['merno'] = $pay_conf['merno']; //C("sqpay.partner");
|
|
|
|
|
$data['amount'] = $request['price'];
|
|
|
|
|
$data['order_no'] = $request['pay_order_number'];
|
|
|
|
|
$data['paymenttype'] = "ZFBZF";
|
|
|
|
@ -163,7 +149,7 @@ 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) { // 汇付宝
|
|
|
|
|
} elseif ($pay_info['channel'] == 5) { // 汇付宝
|
|
|
|
|
|
|
|
|
|
$request['pay_way'] = C('PAY_WAY.WFT_PAY');
|
|
|
|
|
$request['pay_status'] = 0;
|
|
|
|
@ -403,8 +389,6 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
'pay_order_number' => $orderno
|
|
|
|
|
])->save([
|
|
|
|
|
'pay_url' => $request['pay_url'],
|
|
|
|
|
// 'merchant_id' => $pay_conf['id'],
|
|
|
|
|
'merchant_way' => 1
|
|
|
|
|
]);
|
|
|
|
|
} elseif ($pay_info['channel'] == 4) { // 双乾
|
|
|
|
|
// }elseif(get_zfb_type($game_id, $user_id) == 2) { // 双乾
|
|
|
|
@ -421,9 +405,9 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
echo json_encode(['code'=>0,'msg'=>'订单已经存在,请刷新充值页面重新下单!','wap'=>1]);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
$this->add_spend($request,1, $pay_conf);
|
|
|
|
|
$this->add_spend($request, 1);
|
|
|
|
|
}else{
|
|
|
|
|
$this->add_deposit($request, 1, $pay_conf);
|
|
|
|
|
$this->add_deposit($request, 1);
|
|
|
|
|
}
|
|
|
|
|
$sqpay=new Sqpay();
|
|
|
|
|
$returl = C('PAY_DOMAIN'). "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
|
|
|
|
@ -742,14 +726,27 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
echo json_encode(['code'=>1001,'msg'=> "请求发起失效,编号{$request['pay_order_number']},请选择其他支付方式或联系客服"]);exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$pay_info = get_payment_config(2, $game, $request['user_id']);
|
|
|
|
|
if ($pay_info['code'] != 0) {
|
|
|
|
|
echo json_encode(['code'=>1010,'msg'=> $pay_info['msg']]);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
$pay_conf = json_decode($pay_info['data']['config'], true);
|
|
|
|
|
$pay_info = $pay_info['data'];
|
|
|
|
|
$pay_conf['id'] = $pay_info['id'];
|
|
|
|
|
$pay_conf['merchant_id'] = $pay_info['id'];
|
|
|
|
|
|
|
|
|
|
//0 官方 1威富通 2俊付通
|
|
|
|
|
if (get_wx_pay_type() == 0) {
|
|
|
|
|
// if (get_wx_pay_type() == 0) {
|
|
|
|
|
if ($pay_info['channel'] == 2) {
|
|
|
|
|
$weixn = new Weixin();
|
|
|
|
|
$is_pay = json_decode($weixn->weixin_pay("充值", $request['pay_order_number'], $pay_amount, 'MWEB'), true);
|
|
|
|
|
$is_pay = json_decode($weixn->weixin_pay("充值", $request['pay_order_number'], $pay_amount, 'MWEB', 1, $pay_conf), true);
|
|
|
|
|
|
|
|
|
|
if($is_pay['status']==1){
|
|
|
|
|
$json_data['url'] = $is_pay['mweb_url'].'&redirect_url='.C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}";
|
|
|
|
|
$request['pay_url'] = $json_data['url']."&tx_client=hideopen";
|
|
|
|
|
$request['merchant_id'] = $pay_info['id'];
|
|
|
|
|
$request['merchant_way'] = 2;
|
|
|
|
|
$this->add_deposit($request, 1);
|
|
|
|
|
// .(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'] ;
|
|
|
|
|
/* if (I('request.api_ver') == 1) {
|
|
|
|
@ -760,7 +757,7 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
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 ($pay_info['channel'] == 5) { // 汇付宝
|
|
|
|
|
$request['pay_way'] = C('PAY_WAY.WFT_PAY'); // 威富通wx
|
|
|
|
|
|
|
|
|
|
$pay['agent_id'] = C('heepay.partner');//商户号
|
|
|
|
@ -1480,7 +1477,7 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
echo json_encode(['code'=>0,'msg'=> '支付失败']);exit;
|
|
|
|
|
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'支付失败', 'user_token' => $this->userToken)));exit;
|
|
|
|
|
}
|
|
|
|
|
}elseif(get_wx_pay_type() == 1){
|
|
|
|
|
}elseif ($pay_info['channel'] == 5) {
|
|
|
|
|
$request['pay_way'] = C('PAY_WAY.WFT_PAY'); // 威富通wx
|
|
|
|
|
|
|
|
|
|
$pay['agent_id'] = C('heepay.partner');//商户号
|
|
|
|
|