master
elf 11 months ago
parent 070c664ff5
commit 3b14c64ef8

@ -73,7 +73,7 @@ class BaseController extends Controller
} }
$valueDetailLogModel = new \Sdk\Model\ValueDetailLogModel(); $valueDetailLogModel = new \Sdk\Model\ValueDetailLogModel();
if($d['pay_status'] == 0){ if(($d['pay_status'] == 0 && $d['pay_way'] != 41) || ($d['pay_real_status'] == 0 && $d['pay_way'] == 41)){
// 折扣优先处理 // 折扣优先处理
if ($d['discount_amount'] > 0) { // 折扣金额大于0 if ($d['discount_amount'] > 0) { // 折扣金额大于0
$balance = M('user', 'tab_')->where(array( $balance = M('user', 'tab_')->where(array(
@ -114,6 +114,7 @@ class BaseController extends Controller
// 当天累计充值 // 当天累计充值
$this->payTodayTotal($d['pay_amount'], $d['pay_way']); $this->payTodayTotal($d['pay_amount'], $d['pay_way']);
$data_save['pay_real_status'] = 1;
$data_save['pay_status'] = 0; $data_save['pay_status'] = 0;
$data_save['order_number'] = $data['trade_no']; $data_save['order_number'] = $data['trade_no'];
$data_save['payed_time'] = time(); $data_save['payed_time'] = time();
@ -241,7 +242,13 @@ class BaseController extends Controller
} }
} }
$data_save['pay_status'] = 1; if ($d['pay_way'] == 41) {
$data_save['pay_real_status'] = 1;
$data_save['pay_status'] = 0;
} else {
$data_save['pay_status'] = 1;
$data_save['pay_real_status'] = 1;
}
$data_save['order_number'] = $data['trade_no']; $data_save['order_number'] = $data['trade_no'];
$data_save['payed_time'] = time(); $data_save['payed_time'] = time();
$data_save['pay_time'] = $data_save['payed_time']; $data_save['pay_time'] = $data_save['payed_time'];

@ -1996,7 +1996,7 @@ function get_default_payment_config($way=1) {
} }
// 获取支付配置 way 1 支付宝 2微信 3快捷 // 获取支付配置 way 1 支付宝 2微信 3快捷
function get_payment_config($way=1, $game=0, $user_id=0, $pay_amount = 0) { function get_payment_config($way=1, $game=0, $user_id=0, $pay_amount = 0, $isPlatform = false) {
$time = time(); $time = time();
$company = get_promote_company($user_id); $company = get_promote_company($user_id);
@ -2016,9 +2016,13 @@ function get_payment_config($way=1, $game=0, $user_id=0, $pay_amount = 0) {
return ['code' => -3, 'msg' => '找不到游戏ID'.$game['id'], 'data' => []]; return ['code' => -3, 'msg' => '找不到游戏ID'.$game['id'], 'data' => []];
} }
// if ($pay_amount >= 500) { // $monthBegin = strtotime(date('Y-m-01 00:00:00'));
// return ['code' => 0, 'msg' => '', 'data' => ['id' => 3, 'channel' => 11, 'config' => '{}']]; // $monthEnd = date('Y-m-d', strtotime(date('Y-m-01') . '+1 month -1 day'));
// } // $payAmountRow = M('spend','tab_')->field('SUM(pay_amount) as sum_amount')->where(array('pay_way'=>41, 'pay_real_status'=>1, 'payed_time' => ['gt', $monthBegin], 'payed_time' => ['lt', $monthEnd]))->find();
// $payAmount = intval($payAmountRow['sum_amount']);
if ($user_id == 12 && !$isPlatform) {
return ['code' => 0, 'msg' => '', 'data' => ['id' => 3, 'channel' => 11, 'config' => '{}']];
}
$payment_rule = M('payment_rule', 'tab_')->where($map)->select(); $payment_rule = M('payment_rule', 'tab_')->where($map)->select();
$find_rule = false; $find_rule = false;

@ -912,7 +912,7 @@ class BaseController extends RestController
* 优先扣除绑币 和平台 处理 * 优先扣除绑币 和平台 处理
* $request $discountAmount 折扣价格 * $request $discountAmount 折扣价格
*/ */
public function other_price(&$request, $discountAmount=0) { public function other_price(&$request, $discountAmount=0, $pay_info = []) {
// 优先扣除绑定币平台币 // 优先扣除绑定币平台币
if ($request['code'] == '0') return $request; // 平台币充值 不做判断 if ($request['code'] == '0') return $request; // 平台币充值 不做判断
$deductionAmount = 0; $deductionAmount = 0;
@ -934,6 +934,11 @@ class BaseController extends RestController
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>"平台币足够,请关闭支付页面重新支付")));exit; redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>"平台币足够,请关闭支付页面重新支付")));exit;
} }
} }
$actualAmount = round($request['price'] - $discountAmount - $deductionAmount, 2).'';
if ($pay_info['channel'] == 11 && $deductionAmount > 0 && $actualAmount > 0) {
$deductionAmount = 0;
}
// 实际支付金额 = 支付总金额 - 折扣抵扣价格 - 绑币和平台币抵扣金额 // 实际支付金额 = 支付总金额 - 折扣抵扣价格 - 绑币和平台币抵扣金额
$request['actual_amount'] = round($request['price'] - $discountAmount - $deductionAmount, 2).''; $request['actual_amount'] = round($request['price'] - $discountAmount - $deductionAmount, 2).'';
$request['discount_amount'] = round($discountAmount, 2).''; $request['discount_amount'] = round($discountAmount, 2).'';

@ -69,7 +69,7 @@ class PayH5Controller extends BaseController{
} }
$game = M('game', 'tab_')->where(['id' => $game_id])->find(); $game = M('game', 'tab_')->where(['id' => $game_id])->find();
$pay_info = get_payment_config(self::ALI_PAY, $game, $request['user_id'], $request['price']); $pay_info = get_payment_config(self::ALI_PAY, $game, $request['user_id'], $request['price'], true);
if ($pay_info['code'] != 0) { if ($pay_info['code'] != 0) {
echo json_encode(['code'=>1010,'msg'=> $pay_info['msg']]); echo json_encode(['code'=>1010,'msg'=> $pay_info['msg']]);
exit; exit;
@ -425,13 +425,15 @@ class PayH5Controller extends BaseController{
$request['discount_amount'] = $discountAmount; $request['discount_amount'] = $discountAmount;
$request['discount'] = $discount; $request['discount'] = $discount;
} }
$this->other_price($request, $discountAmount);
$pay_info = get_payment_config(self::ALI_PAY, $game, $request['user_id'], $request['price']); $pay_info = get_payment_config(self::ALI_PAY, $game, $request['user_id'], $request['price']);
if ($pay_info['code'] != 0) { if ($pay_info['code'] != 0) {
echo json_encode(['code'=>1010,'msg'=> $pay_info['msg']]); echo json_encode(['code'=>1010,'msg'=> $pay_info['msg']]);
exit; exit;
} }
$this->other_price($request, $discountAmount, $pay_info);
$main_id = $pay_info['data']['main_id']; $main_id = $pay_info['data']['main_id'];
$pay_conf = json_decode($pay_info['data']['config'], true); $pay_conf = json_decode($pay_info['data']['config'], true);
$pay_info = $pay_info['data']; $pay_info = $pay_info['data'];
@ -876,7 +878,7 @@ class PayH5Controller extends BaseController{
} }
$game = M('game', 'tab_')->where(['id' => $game_id])->find(); $game = M('game', 'tab_')->where(['id' => $game_id])->find();
$pay_info = get_payment_config(self::WX_PAY, $game, $request['user_id'], $request['price']); $pay_info = get_payment_config(self::WX_PAY, $game, $request['user_id'], $request['price'], true);
if ($pay_info['code'] != 0) { if ($pay_info['code'] != 0) {
echo json_encode(['code'=>1010,'msg'=> $pay_info['msg']]); echo json_encode(['code'=>1010,'msg'=> $pay_info['msg']]);
exit; exit;

Loading…
Cancel
Save