|
|
@ -127,7 +127,7 @@ class WapPayController extends BaseController{
|
|
|
|
$this->add_deposit($request);
|
|
|
|
$this->add_deposit($request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$sqpay=new Sqpay();
|
|
|
|
$sqpay=new Sqpay();
|
|
|
|
$returl = C('pay_header'). "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
|
|
|
|
$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['secret'] = C("sqpay.key");
|
|
|
|
$data['merno'] = C("sqpay.partner");
|
|
|
|
$data['merno'] = C("sqpay.partner");
|
|
|
|
$data['amount'] = $request['price'];
|
|
|
|
$data['amount'] = $request['price'];
|
|
|
@ -135,7 +135,7 @@ class WapPayController extends BaseController{
|
|
|
|
$data['paymenttype'] = "ZFBZF";
|
|
|
|
$data['paymenttype'] = "ZFBZF";
|
|
|
|
$data['MerRemark'] = "mark";
|
|
|
|
$data['MerRemark'] = "mark";
|
|
|
|
$data['subject'] = "subject";
|
|
|
|
$data['subject'] = "subject";
|
|
|
|
$data['notifyurl'] = C('pay_header')."/callback.php/Notify/sq_callback";//通知
|
|
|
|
$data['notifyurl'] = C('PAY_DOMAIN')."/callback.php/Notify/sq_callback";//通知
|
|
|
|
$data['returnurl'] = $returl;
|
|
|
|
$data['returnurl'] = $returl;
|
|
|
|
$data['mchAppId'] = "wmtxkj.com";
|
|
|
|
$data['mchAppId'] = "wmtxkj.com";
|
|
|
|
$data['mchAppName'] = "mchAppName";
|
|
|
|
$data['mchAppName'] = "mchAppName";
|
|
|
@ -554,8 +554,7 @@ class WapPayController extends BaseController{
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*微信支付
|
|
|
|
*微信支付
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function weixin_pay()
|
|
|
|
public function weixin_pay() {
|
|
|
|
{
|
|
|
|
|
|
|
|
#获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组
|
|
|
|
#获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组
|
|
|
|
$request = json_decode(base64_decode(file_get_contents("php://input")), true);
|
|
|
|
$request = json_decode(base64_decode(file_get_contents("php://input")), true);
|
|
|
|
/* file_put_contents(dirname(__FILE__) . '/weixin_paywap.txt',json_encode($request)); */
|
|
|
|
/* file_put_contents(dirname(__FILE__) . '/weixin_paywap.txt',json_encode($request)); */
|
|
|
@ -609,7 +608,7 @@ class WapPayController extends BaseController{
|
|
|
|
//0 官方 1威富通
|
|
|
|
//0 官方 1威富通
|
|
|
|
if (get_wx_pay_type() == 0) {
|
|
|
|
if (get_wx_pay_type() == 0) {
|
|
|
|
if(empty(C('wei_xin.email'))|| empty(C('wei_xin.partner'))||empty(C('wei_xin.key'))){
|
|
|
|
if(empty(C('wei_xin.email'))|| empty(C('wei_xin.partner'))||empty(C('wei_xin.key'))){
|
|
|
|
$this->set_message(1009, "fail", "支付参数未配置");
|
|
|
|
$this->set_message(1009, "fail", "支付参数未配置");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$weixn = new Weixin();
|
|
|
|
$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'), true);
|
|
|
@ -622,24 +621,25 @@ class WapPayController extends BaseController{
|
|
|
|
$json_data['status'] = 200;
|
|
|
|
$json_data['status'] = 200;
|
|
|
|
if($request['sdk_version']==1){
|
|
|
|
if($request['sdk_version']==1){
|
|
|
|
$json_data['url'] = $is_pay['mweb_url'];
|
|
|
|
$json_data['url'] = $is_pay['mweb_url'];
|
|
|
|
$json_data['orderno'] =$request['pay_order_number'];
|
|
|
|
$json_data['orderno'] = $request['pay_order_number'];
|
|
|
|
$json_data['paytype'] ="wx";
|
|
|
|
$json_data['paytype'] = "wx";
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
if(!empty($request['scheme'])) {
|
|
|
|
if(!empty($request['scheme'])) {
|
|
|
|
$redirect_url = 'https://api.wmtxkj.com' . "/sdk.php/Spend/pay_success2/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
|
|
|
|
$redirect_url = C('PAY_DOMAIN') . "/sdk.php/Spend/pay_success2/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$redirect_url = 'https://api.wmtxkj.com' . "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'];
|
|
|
|
$redirect_url = C('PAY_DOMAIN') . "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$json_data['url'] = $is_pay['mweb_url'].'&redirect_url='.urlencode( $redirect_url );
|
|
|
|
$json_data['url'] = $is_pay['mweb_url'].'&redirect_url='.urlencode( $redirect_url );
|
|
|
|
$json_data['paytype'] ="wx";
|
|
|
|
$json_data['paytype'] ="wx";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$json_data['status'] = 500;
|
|
|
|
$json_data['status'] = 500;
|
|
|
|
$json_data['url'] = "https://" . 'api.wmtxkj.com';
|
|
|
|
$json_data['url'] = C('PAY_DOMAIN');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$json_data['cal_url'] = 'https://api.wmtxkj.com';
|
|
|
|
$json_data['cal_url'] = C('PAY_DOMAIN');
|
|
|
|
echo base64_encode(json_encode($json_data));exit;
|
|
|
|
echo base64_encode(json_encode($json_data));
|
|
|
|
// $this->redirect('WapPay/weixin_pay_view',['user_id'=>$request['user_id'],'game_id'=>$request['game_id']]);
|
|
|
|
exit;
|
|
|
|
|
|
|
|
// $this->redirect('WapPay/weixin_pay_view',['user_id'=>$request['user_id'],'game_id'=>$request['game_id']]);
|
|
|
|
} else if(get_wx_pay_type() == 1){ // 威富通
|
|
|
|
} else if(get_wx_pay_type() == 1){ // 威富通
|
|
|
|
if( empty(C('heepay.partner'))||empty(C('heepay.key'))){
|
|
|
|
if( empty(C('heepay.partner'))||empty(C('heepay.key'))){
|
|
|
|
$this->set_message(1009, "fail", "支付参数未配置");
|
|
|
|
$this->set_message(1009, "fail", "支付参数未配置");
|
|
|
@ -718,9 +718,9 @@ class WapPayController extends BaseController{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$request['pay_way'] = 8;
|
|
|
|
$request['pay_way'] = 8;
|
|
|
|
|
|
|
|
|
|
|
|
if($pay_amount*1<1){
|
|
|
|
if($pay_amount*1<1){
|
|
|
|
$this->set_message(1011,"fail","单笔交易金额必须大于1元");
|
|
|
|
$this->set_message(1011,"fail","单笔交易金额必须大于1元");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if($request['code']==1){
|
|
|
|
if($request['code']==1){
|
|
|
|
$this->add_spend($request);
|
|
|
|
$this->add_spend($request);
|
|
|
@ -738,9 +738,9 @@ class WapPayController extends BaseController{
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$json_data['status'] = 500;
|
|
|
|
$json_data['status'] = 500;
|
|
|
|
$json_data['msg']=$res['info'];
|
|
|
|
$json_data['msg']=$res['info'];
|
|
|
|
$json_data['url']='http://'.$_SERVER ['HTTP_HOST'];
|
|
|
|
$json_data['url']='http://'.$_SERVER ['HTTP_HOST'];
|
|
|
|
$json_data['cal_url'] = C("pay_header");
|
|
|
|
$json_data['cal_url'] = C("PAY_DOMAIN");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
echo base64_encode(json_encode($json_data)); exit;
|
|
|
|
echo base64_encode(json_encode($json_data)); exit;
|
|
|
@ -1016,7 +1016,8 @@ class WapPayController extends BaseController{
|
|
|
|
$data['merno'] = C('sqpay.partner');
|
|
|
|
$data['merno'] = C('sqpay.partner');
|
|
|
|
$data['subject'] = '游戏充值';
|
|
|
|
$data['subject'] = '游戏充值';
|
|
|
|
$data['ip'] = get_client_ip();
|
|
|
|
$data['ip'] = get_client_ip();
|
|
|
|
$data['returnurl'] = C('pay_header'). "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
|
|
|
|
$data['returnurl'] = C('PAY_DOMAIN'). "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
|
|
|
|
|
|
|
|
$data['notifyurl'] = C('PAY_DOMAIN')."/callback.php/Notify/sq_callback";
|
|
|
|
$data['amount'] = $request['price'];
|
|
|
|
$data['amount'] = $request['price'];
|
|
|
|
$data['appId'] = C('wei_xin.email');
|
|
|
|
$data['appId'] = C('wei_xin.email');
|
|
|
|
$data['secret'] = C('sqpay.key');
|
|
|
|
$data['secret'] = C('sqpay.key');
|
|
|
|