This commit is contained in:
root 2020-01-12 02:02:45 +08:00
parent afa3c0aa52
commit 415850184e
4 changed files with 4 additions and 4 deletions

View File

@ -70,7 +70,7 @@ class CheckOrder extends Command
{
$plan = Plan::find($order->plan_id);
// change plan process, try out is enable and plan
if ($order->type === 3 && config('v2board.try_out_enable', 0) && config('v2board.try_out_plan_id') !== $user->plan_id) {
if ((int)$order->type === 3 && (int)config('v2board.try_out_plan_id') !== (int)$user->plan_id) {
$transferEnableDifference = $plan->transfer_enable - ($user->transfer_enable / 1073741824);
$user->expired_at = $user->expired_at - ($transferEnableDifference * config('v2board.plan_transfer_hour', 12) * 3600);
}

View File

@ -32,7 +32,7 @@ class ConfigController extends Controller
'app_name' => config('v2board.app_name', 'V2Board'),
'app_url' => config('v2board.app_url'),
'subscribe_url' => config('v2board.subscribe_url'),
'plan_is_update' => (int)config('v2board.plan_is_update', 1),
'plan_change_enable' => (int)config('v2board.plan_change_enable', 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'),

View File

@ -122,7 +122,7 @@ class OrderController extends Controller
// renew and change subscribe process
if ($user->expired_at > time() && $order->plan_id !== $user->plan_id) {
$order->type = 3;
if (!(int)config('v2board.plan_is_update', 1)) abort(500, '目前不允许更改订阅,请联系管理员');
if (!(int)config('v2board.plan_change_enable', 1)) abort(500, '目前不允许更改订阅,请联系管理员');
} else if ($user->expired_at > time() && $order->plan_id == $user->plan_id) {
$order->type = 2;
} else {

View File

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