快捷支付模板替换

master
zhengyongxing 5 years ago
parent fe90278a6c
commit c5674b5259

@ -304,138 +304,146 @@ class ShortcutController extends BaseController{
// $file=file_get_contents("./Application/Sdk/OrderNo/".$user_id."-".$game_id.".txt");
// $request = json_decode(think_decrypt($file),true);
// Log::write(serialize($request), Log::DEBUG);
$is_platform = 0;
if (I('request.code') == 0 && I('request.type') == 'platform') {
$is_platform = 1; // 平台币充值
}
//$prefix = ($is_platform == 1) ? 'PF_' : 'SP_';
//$request['pay_order_number'] = $prefix . date('Ymd') . date('His') . sp_random_string(4);
$request['game_id'] = I('request.game_id');
$game_id = $request['game_id'];
$request['user_id'] = I('request.user_id');
$user_id = $request['user_id'];
$request['code'] = I('request.code');
$payInfo = M('pay_info', 'tab_')->where([
'user_id' => I('user_id'),
'game_id' => I('game_id'),
'extend' => I('extend'),
])->order('id desc')->find();
$request['price'] = $payInfo['price'];
$userToken = I('request.user_token');
if (empty($request)) {
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>'登录数据不能为空', 'user_token' => $userToken)));exit;
}
// 支付验证 是否让支付
$payCheck = pay_check($request['user_id']);
if (!$payCheck['code']) {
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>$payCheck['msg'], 'user_token' => $userToken)));exit;
}
$game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();
if($game['pay_status'] == 0){
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>'该游戏暂时无法充值,请联系客服!', 'user_token' => $userToken)));exit;
}
if($request['price']*1<=0){
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>'充值金额有误', 'user_token' => $userToken)));exit;
}
C(api('Config/lists'));
if (!$is_platform) {
$request['extend'] = I('request.extend');
$extend_data = M('spend','tab_')->where(array('extend'=>$request['extend'],'game_id'=>$request['game_id']))->find();
if($extend_data){
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>$request['game_id'].'订单号重复,请关闭支付页面重新支付'.$request['extend'], 'user_token' => $userToken)));exit;
}
}
//折扣
$user = get_user_entity($request['user_id']);
$discount = $this->get_discount($request['game_id'],$user['promote_id'],$request['user_id']);
$discount = $discount['discount'];
$pay_amount = $discount * $request['price'] / 10;
if ($pay_amount < 0.01) {
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform, 'msg'=>'充值金额有误.'.$pay_amount, 'user_token' => $userToken)));exit;
}
if (!$is_platform) {
$this->other_price($request, $request['price']-$pay_amount);
}
// 平台币充值
if ($is_platform) {
$request['code'] = 0;
$request['user_id'] = I('request.user_id');
$request['price'] = intval(I('request.price'));
$request['game_id'] = I('request.game_id');
$request['pay_way'] = C("PAY_WAY.SQ_SHORTCUT"); // 支付方式(-1绑币 0:平台币,1:支付宝,2:微信(扫码)3微信app 4 威富通 5聚宝云 6竣付通 7苹果支付8金猪支付 9双乾支付-支付宝 10双乾支付-银联 15双乾支付-快捷
$request['pay_status'] = 0;
$request['spend_ip'] = get_client_ip();
$payInfo = M('pay_info', 'tab_')->where([
'user_id' => I('user_id'),
'game_id' => I('game_id'),
'extend' => I('extend'),
])->order('id desc')->find();
$request['pay_order_number'] = $payInfo['order_id'];
if (!$payInfo) {
return ;
}
} else { // 游戏充值
$request['code'] = 1;
$payInfo = M('pay_info', 'tab_')->where([
'user_id' => I('user_id'),
'game_id' => I('game_id'),
'extend' => I('extend'),
])->order('id desc')->find();
if ($payInfo) {
$info = json_decode($payInfo['info'], true);
$info['deduction_amount'] = $request['deduction_amount'];
$info['actual_amount'] = $request['actual_amount'];
$info['discount_amount'] = $request['discount_amount'];
$info['price'] = $request['price'];
$infosave = json_encode($info);
M('pay_info', 'tab_')->where([
'id' => $payInfo['id']
])->save([
'type' => 'sq_shortcut', // 游戏充值
//'order_id' => $request['pay_order_number'],
//'price' => $request['actual_amount'] ? $request['actual_amount'] : $request['price'],
'info' => $infosave
]);
$info['code'] = $request['code'];
$info['pay_order_number'] = $request['pay_order_number'];
$request = $info;
$request['pay_way'] = C("PAY_WAY.SQ_SHORTCUT");
$request['pay_status'] = 0;
$request['spend_ip'] = get_client_ip();
$request['pay_order_number'] = $payInfo['order_id'];
}
}
//0 官方 1双乾
if (get_shortcut_pay_type() == 0) {
// 暂时只有双乾
}elseif(get_shortcut_pay_type() == 1){
if($request['code']==1){
$this->add_spend($request,1);
}else{
$this->add_deposit($request,1);
}
}
$this->assign("pay_amount", $request['actual_amount']?$request['actual_amount']:$request['price']);
$this->assign("user_id", $request['user_id']);
$this->assign("game_id", $request['game_id']);
$this->assign("user_token", $userToken);
$this->assign("extend", I('extend'));
$this->assign("order_id", $request['pay_order_number']);
$this->display();
// $is_platform = 0;
// if (I('request.code') == 0 && I('request.type') == 'platform') {
// $is_platform = 1; // 平台币充值
// }
//
// //$prefix = ($is_platform == 1) ? 'PF_' : 'SP_';
// //$request['pay_order_number'] = $prefix . date('Ymd') . date('His') . sp_random_string(4);
// $request['game_id'] = I('request.game_id');
// $game_id = $request['game_id'];
// $request['user_id'] = I('request.user_id');
// $user_id = $request['user_id'];
// $request['code'] = I('request.code');
//
// $payInfo = M('pay_info', 'tab_')->where([
// 'user_id' => I('user_id'),
// 'game_id' => I('game_id'),
// 'extend' => I('extend'),
// ])->order('id desc')->find();
// $request['price'] = $payInfo['price'];
//
// $userToken = I('request.user_token');
//
// if (empty($request)) {
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>'登录数据不能为空', 'user_token' => $userToken)));exit;
// }
// // 支付验证 是否让支付
// $payCheck = pay_check($request['user_id']);
// if (!$payCheck['code']) {
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>$payCheck['msg'], 'user_token' => $userToken)));exit;
// }
//
// $game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();
// if($game['pay_status'] == 0){
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>'该游戏暂时无法充值,请联系客服!', 'user_token' => $userToken)));exit;
// }
// if($request['price']*1<=0){
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>'充值金额有误', 'user_token' => $userToken)));exit;
// }
//
// C(api('Config/lists'));
//
// if (!$is_platform) {
// $request['extend'] = I('request.extend');
// $extend_data = M('spend','tab_')->where(array('extend'=>$request['extend'],'game_id'=>$request['game_id']))->find();
// if($extend_data){
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform,'msg'=>$request['game_id'].'订单号重复,请关闭支付页面重新支付'.$request['extend'], 'user_token' => $userToken)));exit;
// }
// }
//
// //折扣
// $user = get_user_entity($request['user_id']);
// $discount = $this->get_discount($request['game_id'],$user['promote_id'],$request['user_id']);
// $discount = $discount['discount'];
// $pay_amount = $discount * $request['price'] / 10;
// if ($pay_amount < 0.01) {
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'is_platform'=> $is_platform, 'msg'=>'充值金额有误.'.$pay_amount, 'user_token' => $userToken)));exit;
// }
//
// if (!$is_platform) {
// $this->other_price($request, $request['price']-$pay_amount);
// }
//
// // 平台币充值
// if ($is_platform) {
// $request['code'] = 0;
// $request['user_id'] = I('request.user_id');
// $request['price'] = intval(I('request.price'));
// $request['game_id'] = I('request.game_id');
// $request['pay_way'] = C("PAY_WAY.SQ_SHORTCUT"); // 支付方式(-1绑币 0:平台币,1:支付宝,2:微信(扫码)3微信app 4 威富通 5聚宝云 6竣付通 7苹果支付8金猪支付 9双乾支付-支付宝 10双乾支付-银联 15双乾支付-快捷
// $request['pay_status'] = 0;
// $request['spend_ip'] = get_client_ip();
// $payInfo = M('pay_info', 'tab_')->where([
// 'user_id' => I('user_id'),
// 'game_id' => I('game_id'),
// 'extend' => I('extend'),
// ])->order('id desc')->find();
// $request['pay_order_number'] = $payInfo['order_id'];
//
// if (!$payInfo) {
// return ;
// }
// } else { // 游戏充值
// $request['code'] = 1;
// $payInfo = M('pay_info', 'tab_')->where([
// 'user_id' => I('user_id'),
// 'game_id' => I('game_id'),
// 'extend' => I('extend'),
// ])->order('id desc')->find();
// if ($payInfo) {
// $info = json_decode($payInfo['info'], true);
// $info['deduction_amount'] = $request['deduction_amount'];
// $info['actual_amount'] = $request['actual_amount'];
// $info['discount_amount'] = $request['discount_amount'];
// $info['price'] = $request['price'];
// $infosave = json_encode($info);
// M('pay_info', 'tab_')->where([
// 'id' => $payInfo['id']
// ])->save([
// 'type' => 'sq_shortcut', // 游戏充值
// //'order_id' => $request['pay_order_number'],
// //'price' => $request['actual_amount'] ? $request['actual_amount'] : $request['price'],
// 'info' => $infosave
// ]);
// $info['code'] = $request['code'];
// $info['pay_order_number'] = $request['pay_order_number'];
// $request = $info;
// $request['pay_way'] = C("PAY_WAY.SQ_SHORTCUT");
// $request['pay_status'] = 0;
// $request['spend_ip'] = get_client_ip();
// $request['pay_order_number'] = $payInfo['order_id'];
// }
// }
//
// //0 官方 1双乾
// if (get_shortcut_pay_type() == 0) {
// // 暂时只有双乾
// }elseif(get_shortcut_pay_type() == 1){
// if($request['code']==1){
// $this->add_spend($request,1);
// }else{
// $this->add_deposit($request,1);
// }
// }
//
// $this->assign("pay_amount", $request['actual_amount']?$request['actual_amount']:$request['price']);
// $this->assign("user_id", $request['user_id']);
// $this->assign("game_id", $request['game_id']);
// $this->assign("user_token", $userToken);
// $this->assign("extend", I('extend'));
// $this->assign("order_id", $request['pay_order_number']);
// $this->display();
$this->yee_step1();
}
@ -724,7 +732,7 @@ class ShortcutController extends BaseController{
$this->assign('goods_info',$request['goods_info']);
$this->display();
$this->display('yee_step1');
}

Loading…
Cancel
Save