平台币微信支付 ajax 请求

master
tpingzhang 5 years ago
parent f8f9986d31
commit ca2d74ce5b

@ -254,3 +254,11 @@ function re_msg($code=200,$msg='',$data=[])
exit();
}
function jsonOutput($status=0, $msg='', $data=[]) {
$ret['status'] = $status;
$ret['msg'] = $msg;
$ret['data'] = $data;
echo json_encode($ret);
exit();
}

@ -588,14 +588,14 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`;
*/
public function platform_weixin_pay() {
if (!$this->userId) {
$this->error("用户未登入");
jsonOutput(0, "用户未登入");
}
$request['user_id'] = $this->userId;
// 支付验证 是否让支付
$payCheck = pay_check($this->userId);
if (!$payCheck['code']) {
$this->error($payCheck['msg']);
jsonOutput(0, $payCheck['msg']);
// echo json_encode(['code'=>0,'msg'=> $payCheck['msg']]);exit;
}
@ -604,7 +604,7 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`;
$game_id = I('request.game_id');
$user_id = $request['user_id'];
if($request['price']*1<=0 || $request['price'] > C('WX_PAY_LIMIT')) {
$this->new_set_message(0,"fail","充值金额有误", 3);
jsonOutput(0, "充值金额有误");
//redirect(U('Spend/notice',array('user_id'=>$user_id, 'is_platform' => 1, 'msg'=>'充值金额有误', 'game_id' => $game_id, 'user_token' => $this->userToken)));exit;
}
@ -631,7 +631,7 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`;
redirect($json_data['url']);
} */
}else{
$this->new_set_message(0,"fail","支付失败", 3);
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){

@ -72,10 +72,10 @@ $(function(){
},
success: function(r) {
if (r.status == 2) {
if (r.status == 1) {
window.location.href = r.data;
} else {
alert(r.info);
alert(r.msg);
}
}

Loading…
Cancel
Save