1. 打开`\app\common\repositories\store\order\StoreOrderRepository.php`文件,在1941行找到`orderRefundAllAfter`方法
2. 将方法内容替换为一下内容
    public function orderRefundAllAfter($order)
    {
        $statusRepository = app()->make(StoreOrderStatusRepository::class);
        $statusRepository->status($order['order_id'], $statusRepository::ORDER_STATUS_REFUND_ALL, '订单已全部退款');
        if ($order->activity_type == 10) {
            app()->make(StoreDiscountRepository::class)->incStock($order->orderProduct[0]['activity_id']);
        }
        $mainId = $order->main_id ?: $order->order_id;
        $count = $this->query([])->where('status', '<>', -1)->where(function ($query) use ($mainId) {
            $query->where('order_id', $mainId)->whereOr('main_id', $mainId);
        })->count();
        //拆单后完全退完
        if (!$count) {
            if ($order->main_id) {
                $order = $this->query(['order_id' => $mainId])->find();
            }
            $couponId = [];
            if ($order->coupon_id) {
                $couponId = explode(',', $order->coupon_id);
            }
            app()->make(MerchantRepository::class)->computedLockMoney($order);
            //总单所有订单全部退完
            if (!$this->query([])->where('status', '<>', -1)->where('group_order_id', $order->group_order_id)->count()) {
                if ($order->groupOrder->coupon_id) {
                    $couponId[] = $order->groupOrder->coupon_id;
                }
            }
            if (count($couponId)) {
                app()->make(StoreCouponUserRepository::class)->updates($couponId, ['status' => 0]);
            }
        }
        event('order.refundAll', compact('order'));
    }
3. 替换后重启 swoole 服务即可

 
                         
                         
                     
                         
                     
                     
                     
                     
                     
                             
                                    
 
                 
                         
                     
                 
         
         
             
         
         
         
		