@ -23,35 +23,31 @@ class PayH5Controller extends BaseController{
if (!$this->userId) {
$this->error("用户未登入");
}
$request[' user_id'] = $this->userId;
$user_id = $this->userId;
$game_id = I('request.game_id');
// 支付验证 是否让支付
$payCheck = pay_check($this->userId);
if (!$payCheck['code']) {
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);
if ($pay_order_number) {
$payOrder = M("deposit", "tab_")->where(['pay_order_number' => $pay_order_number])->find();
if ($payOrder['pay_status'] == 1) {
$this->success("充值成功", "/sdk.php/");
}
$pay_order_number = $payOrder['pay_amount'];
$request['pay_order_number'] = $pay_order_number;
$price = $payOrder['pay_amount'];
} else {
$price = I('request.price');
$request['price'] = $price;
$request['pay_order_number'] = 'PF_'.date('Ymd').date('His').sp_random_string(4);
$request['user_id'] = $user_id;
$request['price'] = I('request.price');
$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, "充值金额有误..");
}
$price = $request['price'];
$price = round($price, 2);
if($price < = 0){
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(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";
$prefix = $param['code'] == 1 ? "SP_" : "PF_";
$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']);
switch ($param['apitype']) {
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;
}
$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'];
$prefix = "PF_";
$request['pay_way'] = C("PAY_WAY.WEIXIN");
$request['pay_status'] = 0;
$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');
//0 官方 1威富通 2俊付通