正在显示
1 个修改的文件
包含
10 行增加
和
3 行删除
@@ -644,7 +644,10 @@ class Order extends Api | @@ -644,7 +644,10 @@ class Order extends Api | ||
644 | $skumodel->where('goods_spec_id',$value['goods_spec_id'])->setInc('stock_num',$value['total_num']); | 644 | $skumodel->where('goods_spec_id',$value['goods_spec_id'])->setInc('stock_num',$value['total_num']); |
645 | } | 645 | } |
646 | } | 646 | } |
647 | + // 已支付就退款 | ||
648 | + if($order['pay_status'] == '20'){ | ||
647 | $config = Service::getConfig('wechat'); | 649 | $config = Service::getConfig('wechat'); |
650 | + $config['app_id'] = $config['miniapp_id']; | ||
648 | $config['notify_url'] = $this->request->domain().'api/notify/refund/type/wechat'; | 651 | $config['notify_url'] = $this->request->domain().'api/notify/refund/type/wechat'; |
649 | $config['return_url'] = ''; | 652 | $config['return_url'] = ''; |
650 | $wechat = Pay::wechat($config); | 653 | $wechat = Pay::wechat($config); |
@@ -652,14 +655,18 @@ class Order extends Api | @@ -652,14 +655,18 @@ class Order extends Api | ||
652 | $param = [ | 655 | $param = [ |
653 | // 'total_fee' => $order['pay_price'], | 656 | // 'total_fee' => $order['pay_price'], |
654 | // 'refund_fee' => $order['pay_price'], | 657 | // 'refund_fee' => $order['pay_price'], |
655 | - 'total_fee' => 0.01, | ||
656 | - 'refund_fee' => 0.01, | 658 | + 'total_fee' => 1, |
659 | + 'refund_fee' => 1, | ||
657 | 'out_trade_no' => $order['order_no'], | 660 | 'out_trade_no' => $order['order_no'], |
658 | 'out_refund_no' => $refund_no | 661 | 'out_refund_no' => $refund_no |
659 | ]; | 662 | ]; |
660 | $wechat->refund($param); | 663 | $wechat->refund($param); |
661 | $order->refund_no = $refund_no; | 664 | $order->refund_no = $refund_no; |
662 | - $order->isUpdate()->save(); | 665 | + $order->refund_time = time(); |
666 | + } | ||
667 | + // 状态变为已取消 | ||
668 | + $order->order_status = '20'; | ||
669 | + $order->isUpdate(true)->save(); | ||
663 | $this->success('取消成功'); | 670 | $this->success('取消成功'); |
664 | } | 671 | } |
665 | 672 |
-
请 注册 或 登录 后发表评论