This commit is contained in:
root 2019-11-18 18:41:33 +08:00
parent 049faeee1f
commit 2ea750ecbd
5 changed files with 17 additions and 7 deletions

View File

@ -50,3 +50,4 @@ DEFAULT_INVITE_COMMISSION=10
DEFAULT_INVITE_GEN_LIMIT=5
DEFAULT_STOP_REGISTER=0
DEFAULT_EMAIL_VERIFY=0
DEFAULT_INVITE_NEVER_EXPIRE=0

View File

@ -21,7 +21,8 @@ class ConfigController extends Controller
'invite' => [
'invite_force' => (int)config('v2board.invite_force', env('DEFAULT_INVITE_FORCE')),
'invite_commission' => config('v2board.invite_commission', env('DEFAULT_INVITE_COMMISSION')),
'invite_gen_limit' => config('v2board.invite_gen_limit', env('DEFAULT_INVITE_GEN_LIMIT'))
'invite_gen_limit' => config('v2board.invite_gen_limit', env('DEFAULT_INVITE_GEN_LIMIT')),
'invite_never_expire' => config('v2board.invite_never_expire', env('DEFAULT_NEVER_EXPIRE'))
],
'site' => [
'stop_register' => (int)config('v2board.stop_register', env('DEFAULT_STOP_REGISTER')),

View File

@ -26,8 +26,12 @@ class LoginController extends Controller
if ($user->is_admin) {
$request->session()->put('is_admin', true);
}
return response([
$res = [
'data' => true
]);
];
if ($user->is_admin) {
$res['is_admin'] = true;
}
return response($res);
}
}

View File

@ -54,8 +54,10 @@ class RegisterController extends Controller
}
}
$user->invite_user_id = $inviteCode->user_id ? $inviteCode->user_id : null;
$inviteCode->status = 1;
$inviteCode->save();
if (!(int)config('v2board.invite_never_expire', env('DEFAULT_INVITE_NEVER_EXPIRE'))) {
$inviteCode->status = 1;
$inviteCode->save();
}
}
if (!$user->save()) {

View File

@ -10,11 +10,12 @@ class ConfigSave extends FormRequest
return [
'invite_force',
'invite_commission',
'invite_gen_limit',
'invite_nerver_expire',
'stop_register',
'email_verify',
'app_name',
'app_url',
'invite_gen_limit',
'server_token',
// alipay
'alipay_enable',
@ -39,9 +40,10 @@ class ConfigSave extends FormRequest
return [
'invite_force' => 'in:0,1',
'invite_commission' => 'integer',
'invite_gen_limit' => 'integer',
'invite_nerver_expire' => 'in:0,1',
'stop_register' => 'in:0,1',
'email_verify' => 'in:0,1',
'invite_gen_limit' => 'integer',
'server_token' => 'min:16',
'app_url' => 'url',
// alipay