mirror of
https://github.com/v2board/v2board.git
synced 2024-11-13 02:59:10 +08:00
update order change process
This commit is contained in:
parent
9ae3994705
commit
76c50e01bf
@ -72,8 +72,9 @@ class OrderController extends Controller
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDiffPrice(User $user, Plan $plan)
|
private function getDiffPrice(User $user)
|
||||||
{
|
{
|
||||||
|
$plan = Plan::find($user->plan_id);
|
||||||
if ($plan->month_price) {
|
if ($plan->month_price) {
|
||||||
$dayPrice = $plan->month_price / 30;
|
$dayPrice = $plan->month_price / 30;
|
||||||
} else if ($plan->quarter_price) {
|
} else if ($plan->quarter_price) {
|
||||||
@ -139,7 +140,7 @@ class OrderController extends Controller
|
|||||||
if ($user->expired_at > time() && $order->plan_id !== $user->plan_id) {
|
if ($user->expired_at > time() && $order->plan_id !== $user->plan_id) {
|
||||||
if (!(int)config('v2board.plan_change_enable', 1)) abort(500, '目前不允许更改订阅,请联系管理员');
|
if (!(int)config('v2board.plan_change_enable', 1)) abort(500, '目前不允许更改订阅,请联系管理员');
|
||||||
$order->type = 3;
|
$order->type = 3;
|
||||||
$order->diff_amount = $this->getDiffPrice($user, $plan);
|
$order->diff_amount = $this->getDiffPrice($user);
|
||||||
$order->total_amount = $order->total_amount + $order->diff_amount;
|
$order->total_amount = $order->total_amount + $order->diff_amount;
|
||||||
} else if ($user->expired_at > time() && $order->plan_id == $user->plan_id) {
|
} else if ($user->expired_at > time() && $order->plan_id == $user->plan_id) {
|
||||||
$order->type = 2;
|
$order->type = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user