From fc7b9ab3636d13e90bde045b6930b8e3fe7d6fb4 Mon Sep 17 00:00:00 2001 From: lihan <3398341942@qq.com> Date: Fri, 19 Oct 2018 20:31:46 +0800 Subject: [PATCH] 确认收货 --- app/pay/controller/PayController.php | 54 ++++++++++++++++++++++-------------------------------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/app/pay/controller/PayController.php b/app/pay/controller/PayController.php index bb229f7..c83b38c 100644 --- a/app/pay/controller/PayController.php +++ b/app/pay/controller/PayController.php @@ -116,38 +116,28 @@ class PayController extends HomeBaseController } } //组合支付 elseif ($order['pay_type'] == 2) { -// $pay_cash = (int)($request->param('pay_cash')); //支付的金额 -// $pay_num = (int)($request->param('pay_num')); //支付的积分 -// $balance = Db::name('user')->where(['id' => session('user.id')])->value('balance'); -// if (1 > 2) { -// $this->success('您的积分不足', '', false); -// } else { -// //先减余额 -// //$balance -= $pay_num; -// //Db::name('user')->update(['id' => session('user.id'), 'balance' => $balance]); -// Db::commit(); -// //session('goods.id', null); -// Db::name('zj_cart')->where(['id' => ['in', session('cart.id')]])->delete(); -// //session('cart.id', null); -// $info = [ -// 'attach' => $oid, -// 'openid' => session('user.openid'), -// 'body' => '微信支付-天生红商城', -// 'total_fee' => 1 -// ]; -// $this->wxPay($info); -// } - Db::commit(); - //session('goods.id', null); - Db::name('zj_cart')->where(['id' => ['in', session('cart.id')]])->delete(); - //session('cart.id', null); - $info = [ - 'attach' => $oid, - 'openid' => session('user.openid'), - 'body' => '微信支付-天生红商城', - 'total_fee' => 1 - ]; - $this->wxPay($info); + $pay_cash = (int)($request->param('pay_cash')); //支付的金额 + $pay_num = (int)($request->param('pay_num')); //支付的积分 + $balance = Db::name('user')->where(['id' => session('user.id')])->value('balance'); + if (1 > 2) { + $this->success('您的积分不足', '', false); + } else { + //先减余额 + $balance -= $pay_num; + Db::name('user')->update(['id' => session('user.id'), 'balance' => $balance]); + Db::commit(); + session('goods.id', null); + Db::name('zj_cart')->where(['id' => ['in', session('cart.id')]])->delete(); + session('cart.id', null); + $info = [ + 'attach' => $oid, + 'openid' => session('user.openid'), + 'body' => '微信支付-天生红商城', + 'total_fee' => $pay_cash + ]; + $this->wxPay($info); + } + } else { $this->success('请选择支付方式', '', false); } -- libgit2 0.24.0