From 3b14c64ef890b6ec8169ade29410c980f735a1f0 Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Tue, 12 Dec 2023 23:27:26 +0800 Subject: [PATCH] xg --- .../Callback/Controller/BaseController.class.php | 11 +++++++++-- Application/Common/Common/extend.php | 12 ++++++++---- Application/Sdk/Controller/BaseController.class.php | 7 ++++++- Application/Sdk/Controller/PayH5Controller.class.php | 10 ++++++---- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Application/Callback/Controller/BaseController.class.php b/Application/Callback/Controller/BaseController.class.php index 08d8feb..1fc8f50 100644 --- a/Application/Callback/Controller/BaseController.class.php +++ b/Application/Callback/Controller/BaseController.class.php @@ -73,7 +73,7 @@ class BaseController extends Controller } $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 $balance = M('user', 'tab_')->where(array( @@ -114,6 +114,7 @@ class BaseController extends Controller // 当天累计充值 $this->payTodayTotal($d['pay_amount'], $d['pay_way']); + $data_save['pay_real_status'] = 1; $data_save['pay_status'] = 0; $data_save['order_number'] = $data['trade_no']; $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['payed_time'] = time(); $data_save['pay_time'] = $data_save['payed_time']; diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index ee40077..f3527d9 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -1996,7 +1996,7 @@ function get_default_payment_config($way=1) { } // 获取支付配置 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(); $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' => []]; } - // if ($pay_amount >= 500) { - // return ['code' => 0, 'msg' => '', 'data' => ['id' => 3, 'channel' => 11, 'config' => '{}']]; - // } + // $monthBegin = strtotime(date('Y-m-01 00:00:00')); + // $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(); $find_rule = false; diff --git a/Application/Sdk/Controller/BaseController.class.php b/Application/Sdk/Controller/BaseController.class.php index ed1a9b5..850a41b 100644 --- a/Application/Sdk/Controller/BaseController.class.php +++ b/Application/Sdk/Controller/BaseController.class.php @@ -912,7 +912,7 @@ class BaseController extends RestController * 优先扣除绑币 和平台 处理 * $request $discountAmount 折扣价格 */ - public function other_price(&$request, $discountAmount=0) { + public function other_price(&$request, $discountAmount=0, $pay_info = []) { // 优先扣除绑定币平台币 if ($request['code'] == '0') return $request; // 平台币充值 不做判断 $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; } } + + $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['discount_amount'] = round($discountAmount, 2).''; diff --git a/Application/Sdk/Controller/PayH5Controller.class.php b/Application/Sdk/Controller/PayH5Controller.class.php index 4e1dd2d..768ec2a 100644 --- a/Application/Sdk/Controller/PayH5Controller.class.php +++ b/Application/Sdk/Controller/PayH5Controller.class.php @@ -69,7 +69,7 @@ class PayH5Controller extends BaseController{ } $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) { echo json_encode(['code'=>1010,'msg'=> $pay_info['msg']]); exit; @@ -425,13 +425,15 @@ class PayH5Controller extends BaseController{ $request['discount_amount'] = $discountAmount; $request['discount'] = $discount; } - $this->other_price($request, $discountAmount); - + $pay_info = get_payment_config(self::ALI_PAY, $game, $request['user_id'], $request['price']); if ($pay_info['code'] != 0) { echo json_encode(['code'=>1010,'msg'=> $pay_info['msg']]); exit; } + + $this->other_price($request, $discountAmount, $pay_info); + $main_id = $pay_info['data']['main_id']; $pay_conf = json_decode($pay_info['data']['config'], true); $pay_info = $pay_info['data']; @@ -876,7 +878,7 @@ class PayH5Controller extends BaseController{ } $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) { echo json_encode(['code'=>1010,'msg'=> $pay_info['msg']]); exit;