快捷支付模板替换

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

Loading…
Cancel
Save