From dbbfc165c0250cb9ccbca6df1ae95e45247e409d Mon Sep 17 00:00:00 2001 From: tpingzhang <635929049@qq.com> Date: Sun, 29 Sep 2019 15:38:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=85=88=E6=89=A3=E9=99=A4=E7=BB=91?= =?UTF-8?q?=E5=B8=81=20=E5=B9=B3=E5=8F=B0=E5=B8=81=20=20=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=99=90=E9=A2=9D3000?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/BaseController.class.php | 41 ++++++++++++++++++- .../Sdk/Controller/UserController.class.php | 1 + 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/Application/Sdk/Controller/BaseController.class.php b/Application/Sdk/Controller/BaseController.class.php index f55299eed..9a57e1598 100644 --- a/Application/Sdk/Controller/BaseController.class.php +++ b/Application/Sdk/Controller/BaseController.class.php @@ -18,8 +18,11 @@ class BaseController extends RestController{ &&!preg_match("/wap_shortcut_pay/",GetCurUrl()) &&!preg_match("/shortcut_pay/",GetCurUrl()) &&!preg_match("/android_shortcut_pay/",GetCurUrl()) - &&!preg_match("/alipay_pay/",GetCurUrl()) + &&!preg_match("/wap_shortcut_pay/",GetCurUrl()) + &&!preg_match("/apple_weixin_pay/",GetCurUrl()) &&!preg_match("/Ipa365/",GetCurUrl()) + &&!preg_match("/user_login/",GetCurUrl()) + &&!preg_match("/platform_coin_deduction/",GetCurUrl()) ){ $data = json_decode(base64_decode(file_get_contents("php://input")),true); @@ -614,6 +617,7 @@ class BaseController extends RestController{ */ public function set_ratio($data,$type = 1){ $map['pay_order_number']=$data; + $map['pay_way'] = ($type==2) ? -1 : 0; // 判断支付类型 $spend=M("Spend","tab_")->where($map)->find(); $reb_map['game_id']=$spend['game_id']; $time = time(); @@ -676,4 +680,39 @@ class BaseController extends RestController{ $add['create_time']=time(); return $add; } + + /** + * 优先扣除绑币 和平台 处理 + * $request $discountAmount 折扣价格 + */ + public function other_price(&$request, $discountAmount=0) { + // 优先扣除绑定币平台币 + if ($request['code'] == '0') return $request; // 平台币充值 不做判断 + $deductionAmount = 0; + $user_id = $request['user_id']; + $game_id = $request['game_id']; + $balance = M ('user', 'tab_')->where (array( + 'id' => $user_id + ))->getField('balance'); + $bind_balance = M('user_play', 'tab_')->where(array( + 'user_id' => $user_id, + 'game_id' => $game_id + ))->getField('bind_balance'); + // 够抵扣的情况 不走这个接口 + $deductionAmount = $bind_balance + $balance; + if ($deductionAmount > $request['price']) { + if ($request['sdk_version'] == 1) + $this->set_message(1089,"fail",$deductionAmount."平台币足够,请关闭支付页面重新支付".$pay_amount); + else { + redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>"平台币足够,请关闭支付页面重新支付")));exit; + } + } + // 实际支付金额 = 支付总金额 - 折扣抵扣价格 - 绑币和平台币抵扣金额 + $request['actual_amount'] = round($request['price'] - $discountAmount - $deductionAmount, 2).''; + $request['discount_amount'] = round($discountAmount, 2).''; + $request['deduction_amount'] = round($deductionAmount, 2).''; + $request['price'] = round($request['actual_amount'], 2).''; + return $request; + //$this->set_message(1089,"fail",$request['price']."新支付".$pay_amount); + } } diff --git a/Application/Sdk/Controller/UserController.class.php b/Application/Sdk/Controller/UserController.class.php index 12cf3602f..478056ef8 100644 --- a/Application/Sdk/Controller/UserController.class.php +++ b/Application/Sdk/Controller/UserController.class.php @@ -1717,6 +1717,7 @@ class UserController extends BaseController } else if (pay_set_status('wei_xin_app') == 0 && pay_set_status('weixin') == 0 && pay_set_status('jft_wap') == 0) { $wx_game = 0; } + if ($request['price'] > C('WX_PAY_LIMIT')) $wx_game = 0; if (pay_set_status('alipay') == 1 || (pay_set_status('goldpig') == 1 && C('goldpig.zfb')) || (pay_set_status('sqpay') == 1 && C('sqpay.zfb')) ) {