正在显示
2 个修改的文件
包含
11 行增加
和
2 行删除
@@ -125,12 +125,18 @@ class Order extends Backend | @@ -125,12 +125,18 @@ class Order extends Backend | ||
125 | { | 125 | { |
126 | if ($ids) { | 126 | if ($ids) { |
127 | $pk = $this->model->getPk(); | 127 | $pk = $this->model->getPk(); |
128 | - $res = Db::name('order')->where($pk,$ids)->field('id,pay_order_sn,total_goods_price')->find(); | 128 | + $res = Db::name('order')->where($pk,$ids)->field('id,pay_order_sn,total_expense_price,total_price')->find(); |
129 | + if($res){ | ||
130 | + if($res['total_price'] == 0){ | ||
131 | + //支付总金额为0, | ||
132 | + $this->success('成功'); | ||
133 | + } | ||
129 | $status = config('verify.status'); | 134 | $status = config('verify.status'); |
130 | //处理退款逻辑 | 135 | //处理退款逻辑 |
131 | $config = config('verify.wx_pay'); | 136 | $config = config('verify.wx_pay'); |
132 | $app = Factory::payment($config); | 137 | $app = Factory::payment($config); |
133 | -// $security_price = $res['total_goods_price']*100; | 138 | + //退款金额 支付金额-运费 |
139 | +// $security_price = ($res['total_price'] - $res['total_expense_price'])*100; | ||
134 | $security_price = 1; | 140 | $security_price = 1; |
135 | $refundNumber = $this->genPayOrderSn('refund');//商户退款单号 | 141 | $refundNumber = $this->genPayOrderSn('refund');//商户退款单号 |
136 | $result = $app->refund->byOutTradeNumber($res['pay_order_sn'], $refundNumber, $security_price, $security_price, [ | 142 | $result = $app->refund->byOutTradeNumber($res['pay_order_sn'], $refundNumber, $security_price, $security_price, [ |
@@ -168,6 +174,8 @@ class Order extends Backend | @@ -168,6 +174,8 @@ class Order extends Backend | ||
168 | }else{ | 174 | }else{ |
169 | $this->error('退款失败'); | 175 | $this->error('退款失败'); |
170 | } | 176 | } |
177 | + } | ||
178 | + $this->error('未查到订单'); | ||
171 | 179 | ||
172 | } | 180 | } |
173 | $this->error(__('Parameter %s can not be empty', 'ids')); | 181 | $this->error(__('Parameter %s can not be empty', 'ids')); |
@@ -6,6 +6,7 @@ use app\admin\model\Collection; | @@ -6,6 +6,7 @@ use app\admin\model\Collection; | ||
6 | use app\admin\model\Rcoupon; | 6 | use app\admin\model\Rcoupon; |
7 | use app\common\controller\Api; | 7 | use app\common\controller\Api; |
8 | use fast\Http; | 8 | use fast\Http; |
9 | +use think\db\Query; | ||
9 | use think\Validate; | 10 | use think\Validate; |
10 | use think\Db; | 11 | use think\Db; |
11 | use think\db\Expression; | 12 | use think\db\Expression; |
-
请 注册 或 登录 后发表评论