@ -23,35 +23,31 @@ class PayH5Controller extends BaseController{
if (!$this->userId) {
if (!$this->userId) {
$this->error("用户未登入");
$this->error("用户未登入");
}
}
$request[' user_id'] = $this->userId;
$user_id = $this->userId;
$game_id = I('request.game_id');
$game_id = I('request.game_id');
// 支付验证 是否让支付
// 支付验证 是否让支付
$payCheck = pay_check($this->userId);
$payCheck = pay_check($this->userId);
if (!$payCheck['code']) {
if (!$payCheck['code']) {
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>$payCheck['msg'], 'user_token' => $this->userToken)));exit;
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>$payCheck['msg'], 'user_token' => $this->userToken)));exit;
// echo json_encode(['code'=>0,'msg'=> $payCheck['msg']]);exit;
}
}
$pay_order_number = I('request.pay_order_number', 0);
$request['user_id'] = $user_id;
if ($pay_order_number) {
$request['price'] = I('request.price');
$payOrder = M("deposit", "tab_")->where(['pay_order_number' => $pay_order_number])->find();
$pay_info = M('pay_info', 'tab_')->where([
if ($payOrder['pay_status'] == 1) {
'user_id' => $user_id,
$this->success("充值成功", "/sdk.php/");
'game_id' => $game_id,
}
'type' => 'platform_pay',
$pay_order_number = $payOrder['pay_amount'];
])->order('id desc')->find();
$request['pay_order_number'] = $pay_order_number;
if ($pay_info['price'] != $request['price']) {
$price = $payOrder['pay_amount'];
jsonOutput(0, "充值金额有误..");
} else {
$price = I('request.price');
$request['price'] = $price;
$request['pay_order_number'] = 'PF_'.date('Ymd').date('His').sp_random_string(4);
}
}
$price = $request['price'];
$price = round($price, 2);
$price = round($price, 2);
if($price < = 0){
if($price < = 0){
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'充值金额有误', 'user_token' => $this->userToken)));exit;
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'充值金额有误', 'user_token' => $this->userToken)));exit;
}
}
$request['pay_order_number'] = $pay_info['order_id'];
if(get_zfb_type()==0){ // 支付宝官方
if(get_zfb_type()==0){ // 支付宝官方
if(C('alipay.way')==1/* || ($request['is_create_ordernumer']==1 & & C('alipay.way')==0) */){ /* wap */
if(C('alipay.way')==1/* || ($request['is_create_ordernumer']==1 & & C('alipay.way')==0) */){ /* wap */
@ -522,6 +518,8 @@ class PayH5Controller extends BaseController{
$table = $param['code'] == 1 ? "spend" : "deposit";
$table = $param['code'] == 1 ? "spend" : "deposit";
$prefix = $param['code'] == 1 ? "SP_" : "PF_";
$prefix = $param['code'] == 1 ? "SP_" : "PF_";
$out_trade_no = $prefix.date('Ymd').date('His').sp_random_string(4);
$out_trade_no = $prefix.date('Ymd').date('His').sp_random_string(4);
if ($param['pay_order_number']) $out_trade_no = $param['pay_order_number'];
$user = get_user_entity($param['user_id']);
$user = get_user_entity($param['user_id']);
switch ($param['apitype']) {
switch ($param['apitype']) {
case 'swiftpass':
case 'swiftpass':
@ -601,12 +599,21 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`;
//redirect(U('Spend/notice',array('user_id'=>$user_id, 'is_platform' => 1, 'msg'=>'充值金额有误', 'game_id' => $game_id, 'user_token' => $this->userToken)));exit;
//redirect(U('Spend/notice',array('user_id'=>$user_id, 'is_platform' => 1, 'msg'=>'充值金额有误', 'game_id' => $game_id, 'user_token' => $this->userToken)));exit;
}
}
$pay_info = M('pay_info', 'tab_')->where([
'user_id' => $user_id,
'game_id' => $game_id,
'type' => 'platform_pay',
])->order('id desc')->find();
if ($pay_info['price'] != $request['price']) {
jsonOutput(0, "充值金额有误..");
}
$pay_amount = $request['price'];
$pay_amount = $request['price'];
$prefix = "PF_";
$prefix = "PF_";
$request['pay_way'] = C("PAY_WAY.WEIXIN");
$request['pay_way'] = C("PAY_WAY.WEIXIN");
$request['pay_status'] = 0;
$request['pay_status'] = 0;
$request['spend_ip'] = get_client_ip();
$request['spend_ip'] = get_client_ip();
$request['pay_order_number'] = 'PF_'.date('Ymd').date('His').sp_random_string(4);
$request['pay_order_number'] = $pay_info['order_id']; // 'PF_'.date('Ymd').date('His').sp_random_string(4);
$request['sdk_version'] = I('request.sdk_version');
$request['sdk_version'] = I('request.sdk_version');
//0 官方 1威富通 2俊付通
//0 官方 1威富通 2俊付通