From 8afa863d918d5690b8a0f6f76837ee4bb16b33d8 Mon Sep 17 00:00:00 2001 From: tping Date: Fri, 20 Aug 2021 15:25:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=98=E6=89=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/ExchangeController.class.php | 10 +++++++++- Application/Sdk/Controller/PayH5Controller.class.php | 3 +-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Application/Sdk/Controller/ExchangeController.class.php b/Application/Sdk/Controller/ExchangeController.class.php index acd790a2..698a86bf 100644 --- a/Application/Sdk/Controller/ExchangeController.class.php +++ b/Application/Sdk/Controller/ExchangeController.class.php @@ -103,9 +103,17 @@ class ExchangeController extends BaseController{ $out_trade_no = $prefix.date('Ymd').date('His').sp_random_string(4); if (C('PAY_TEST')) $out_trade_no = $out_trade_no."_test"; $request['pay_order_number'] = $out_trade_no; - + $user_entity = get_user_entity($request['user_id']); $game_name = isset($request['game_name']) ? $request['game_name'] : M('game', 'tab_')->where(['id' => $request['game_id']])->getField('game_name'); + + // 折扣 + $request['discount'] = 10; + $discount = get_discount($request['game_id'], $request['user_id']); + if ($discount < 10) { + $request['discount'] = $discount; + } + M("pay_info", "tab_")->add([ 'user_id' => $request['user_id'], 'game_id' => $request['game_id'], diff --git a/Application/Sdk/Controller/PayH5Controller.class.php b/Application/Sdk/Controller/PayH5Controller.class.php index b243e91e..9acd0cd1 100644 --- a/Application/Sdk/Controller/PayH5Controller.class.php +++ b/Application/Sdk/Controller/PayH5Controller.class.php @@ -1203,8 +1203,7 @@ class PayH5Controller extends BaseController{ $request['pay_way'] = 0; $request['spend_ip'] = get_client_ip(); $user_entity = get_user_entity($request['user_id']); - $spend = M('spend','tab_')->where(['pay_order_number' => $request['pay_order_number']])->find(); - if ($spend && $spend['discount_amount'] > 0) { + if (isset($request['discount']) && $request['discount'] < 10) { $discountInfo = discountInfo($request['game_id']); if (!$discountInfo) { redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>urlencode('折扣无效,请重试!'), 'user_token' => $this->userToken)));exit;