This commit is contained in:
root 2020-01-05 23:30:07 +08:00
parent 1cd0dbdd31
commit c68440ce32
4 changed files with 4 additions and 5 deletions

View File

@ -70,7 +70,7 @@ class CheckOrder extends Command
// change plan process
if ($order->type === 3) {
$transferEnableDifference = $plan->transfer_enable - ($user->transfer_enable / 1073741824);
$user->expired_at = $user->expired_at - ($transferEnableDifference * 1 * 60);
$user->expired_at = $user->expired_at - ($transferEnableDifference * config('v2board.plan_transfer_hour', 12) * 3600);
}
$user->transfer_enable = $plan->transfer_enable * 1073741824;
$user->enable = 1;

View File

@ -30,8 +30,8 @@ class ConfigController extends Controller
'app_name' => config('v2board.app_name', 'V2Board'),
'app_url' => config('v2board.app_url'),
'subscribe_url' => config('v2board.subscribe_url'),
'plan_update_fee' => config('v2board.plan_update_fee', 0.5),
'plan_is_update' => (int)config('v2board.plan_is_update', 1),
'plan_transfer_hour' => config('v2board.plan_transfer_hour', 12),
'try_out_enable' => (int)config('v2board.try_out_enable', 0),
'try_out_plan_id' => (int)config('v2board.try_out_plan_id'),
'try_out_day' => (int)config('v2board.try_out_day', 1)

View File

@ -45,7 +45,7 @@ class OrderController extends Controller
abort(500, '订单不存在');
}
$order['plan'] = Plan::find($order->plan_id);
$order['update_fee'] = config('v2board.plan_update_fee', 0.5);
$order['plan_transfer_hour'] = config('v2board.plan_transfer_hour', 12);
if (!$order['plan']) {
abort(500, '订阅不存在');
}
@ -115,7 +115,6 @@ class OrderController extends Controller
if ($user->expired_at > time() && $order->plan_id !== $user->plan_id) {
$order->type = 3;
if (!(int)config('v2board.plan_is_update', 1)) abort(500, '目前不允许更改订阅,请联系管理员');
// $order->total_amount = $order->total_amount + (ceil(($user->expired_at - time()) / 86400) * config('v2board.plan_update_fee', 0.5) * 100);
} else if ($user->expired_at > time() && $order->plan_id == $user->plan_id) {
$order->type = 2;
} else {

View File

@ -16,7 +16,7 @@ class ConfigSave extends FormRequest
'app_name' => '',
'app_url' => 'url',
'subscribe_url' => 'url',
'plan_update_fee' => 'numeric',
'plan_transfer_hour' => 'numeric',
'plan_is_update' => 'in:0,1',
'try_out_enable' => 'in:0,1',
'try_out_plan_id' => 'integer',