From c29bd836eb49b6af92e7f4b48a2ae80fb8564f5f Mon Sep 17 00:00:00 2001 From: Tokumeikoi Date: Mon, 11 May 2020 18:26:16 +0800 Subject: [PATCH] update --- app/Http/Controllers/Admin/OrderController.php | 12 +++++++++++- app/Services/OrderService.php | 3 +-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Admin/OrderController.php b/app/Http/Controllers/Admin/OrderController.php index 5b3395e2..e761eaaa 100644 --- a/app/Http/Controllers/Admin/OrderController.php +++ b/app/Http/Controllers/Admin/OrderController.php @@ -126,7 +126,17 @@ class OrderController extends Controller $order->trade_no = Helper::guid(); $order->total_amount = $request->input('total_amount'); - $orderService->setOrderType($user); + $order = $this->order; + if ($order->cycle === 'reset_price') { + $order->type = 4; + } else if ($user->plan_id !== NULL && $order->plan_id !== $user->plan_id) { + $order->type = 3; + } else if ($user->expired_at > time() && $order->plan_id == $user->plan_id) { + $order->type = 2; + } else { + $order->type = 1; + } + $orderService->setInvite($user); if (!$order->save()) { diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index 2128c308..7e4cac1d 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -46,8 +46,7 @@ class OrderService $order = $this->order; if ($order->cycle === 'reset_price') { $order->type = 4; - } - if ($user->plan_id !== NULL && $order->plan_id !== $user->plan_id) { + } else if ($user->plan_id !== NULL && $order->plan_id !== $user->plan_id) { if (!(int)config('v2board.plan_change_enable', 1)) abort(500, '目前不允许更改订阅,请联系客服或提交工单操作'); $order->type = 3; $this->getSurplusValue($user, $order);