This commit is contained in:
root 2019-11-18 19:39:22 +08:00
parent 633d1f1f9b
commit 58d1711150
11 changed files with 28 additions and 26 deletions

View File

@ -45,9 +45,10 @@ PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
DEFAULT_INVITE_FORCE=0 V2BOARD_INVITE_FORCE=0
DEFAULT_INVITE_COMMISSION=10 V2BOARD_INVITE_COMMISSION=10
DEFAULT_INVITE_GEN_LIMIT=5 V2BOARD_INVITE_GEN_LIMIT=5
DEFAULT_STOP_REGISTER=0 V2BOARD_STOP_REGISTER=0
DEFAULT_EMAIL_VERIFY=0 V2BOARD_EMAIL_VERIFY=0
DEFAULT_INVITE_NEVER_EXPIRE=0 V2BOARD_INVITE_NEVER_EXPIRE=0
V2BOARD_APP_THEME=1

View File

@ -19,14 +19,14 @@ class ConfigController extends Controller
return response([ return response([
'data' => [ 'data' => [
'invite' => [ 'invite' => [
'invite_force' => (int)config('v2board.invite_force', env('DEFAULT_INVITE_FORCE')), 'invite_force' => (int)config('v2board.invite_force', env('V2BOARD_INVITE_FORCE')),
'invite_commission' => config('v2board.invite_commission', env('DEFAULT_INVITE_COMMISSION')), 'invite_commission' => config('v2board.invite_commission', env('V2BOARD_INVITE_COMMISSION')),
'invite_gen_limit' => config('v2board.invite_gen_limit', env('DEFAULT_INVITE_GEN_LIMIT')), 'invite_gen_limit' => config('v2board.invite_gen_limit', env('V2BOARD_INVITE_GEN_LIMIT')),
'invite_never_expire' => config('v2board.invite_never_expire', env('DEFAULT_NEVER_EXPIRE')) 'invite_never_expire' => config('v2board.invite_never_expire', env('V2BOARD_NEVER_EXPIRE'))
], ],
'site' => [ 'site' => [
'stop_register' => (int)config('v2board.stop_register', env('DEFAULT_STOP_REGISTER')), 'stop_register' => (int)config('v2board.stop_register', env('V2BOARD_STOP_REGISTER')),
'email_verify' => (int)config('v2board.email_verify', env('DEFAULT_EMAIL_VERIFY')), 'email_verify' => (int)config('v2board.email_verify', env('V2BOARD_EMAIL_VERIFY')),
'app_name' => config('v2board.app_name', env('APP_NAME')), 'app_name' => config('v2board.app_name', env('APP_NAME')),
'app_url' => config('v2board.app_url', env('APP_URL')) 'app_url' => config('v2board.app_url', env('APP_URL'))
], ],

View File

@ -72,7 +72,7 @@ class OrderController extends Controller
$order->total_amount = $plan[$request->input('cycle')]; $order->total_amount = $plan[$request->input('cycle')];
if ($user->invite_user_id) { if ($user->invite_user_id) {
$order->invite_user_id = $user->invite_user_id; $order->invite_user_id = $user->invite_user_id;
$order->commission_balance = $order->total_amount * (config('v2board.invite_commission', env('DEFAULT_INVITE_COMMISSION')) / 100); $order->commission_balance = $order->total_amount * (config('v2board.invite_commission', env('V2BOARD_INVITE_COMMISSION')) / 100);
} }
if (!$order->save()) { if (!$order->save()) {
abort(500, '订单创建失败'); abort(500, '订单创建失败');

View File

@ -13,7 +13,7 @@ class CommController extends Controller
{ {
public function isEmailVerify () { public function isEmailVerify () {
return response([ return response([
'data' => (int)config('v2board.email_verify', env('DEFAULT_EMAIL_VERIFY')) ? 1 : 0 'data' => (int)config('v2board.email_verify', env('V2BOARD_EMAIL_VERIFY')) ? 1 : 0
]); ]);
} }

View File

@ -15,15 +15,15 @@ use App\Models\InviteCode;
class RegisterController extends Controller class RegisterController extends Controller
{ {
public function index (RegisterIndex $request) { public function index (RegisterIndex $request) {
if ((int)config('v2board.stop_register', env('DEFAULT_STOP_REGISTER'))) { if ((int)config('v2board.stop_register', env('V2BOARD_STOP_REGISTER'))) {
abort(500, '本站已关闭注册'); abort(500, '本站已关闭注册');
} }
if ((int)config('v2board.invite_force', env('DEFAULT_INVITE_FOCE'))) { if ((int)config('v2board.invite_force', env('V2BOARD_INVITE_FOCE'))) {
if (empty($request->input('invite_code'))) { if (empty($request->input('invite_code'))) {
abort(500, '必须使用邀请码才可以注册'); abort(500, '必须使用邀请码才可以注册');
} }
} }
if ((int)config('v2board.email_verify', env('DEFAULT_EMAIL_VERIFY'))) { if ((int)config('v2board.email_verify', env('V2BOARD_EMAIL_VERIFY'))) {
$redisKey = 'sendEmailVerify:' . $request->input('email'); $redisKey = 'sendEmailVerify:' . $request->input('email');
if (empty($request->input('email_code'))) { if (empty($request->input('email_code'))) {
abort(500, '邮箱验证码不能为空'); abort(500, '邮箱验证码不能为空');
@ -49,12 +49,12 @@ class RegisterController extends Controller
->where('status', 0) ->where('status', 0)
->first(); ->first();
if (!$inviteCode) { if (!$inviteCode) {
if ((int)config('v2board.invite_force', env('DEFAULT_INVITE_FOCE'))) { if ((int)config('v2board.invite_force', env('V2BOARD_INVITE_FOCE'))) {
abort(500, '邀请码无效'); abort(500, '邀请码无效');
} }
} }
$user->invite_user_id = $inviteCode->user_id ? $inviteCode->user_id : null; $user->invite_user_id = $inviteCode->user_id ? $inviteCode->user_id : null;
if (!(int)config('v2board.invite_never_expire', env('DEFAULT_INVITE_NEVER_EXPIRE'))) { if (!(int)config('v2board.invite_never_expire', env('V2BOARD_INVITE_NEVER_EXPIRE'))) {
$inviteCode->status = 1; $inviteCode->status = 1;
$inviteCode->save(); $inviteCode->save();
} }
@ -63,7 +63,7 @@ class RegisterController extends Controller
if (!$user->save()) { if (!$user->save()) {
abort(500, '注册失败'); abort(500, '注册失败');
} }
if ((int)config('v2board.email_verify', env('DEFAULT_EMAIL_VERIFY'))) { if ((int)config('v2board.email_verify', env('V2BOARD_EMAIL_VERIFY'))) {
Redis::del($redisKey); Redis::del($redisKey);
} }
return response()->json([ return response()->json([

View File

@ -80,7 +80,7 @@ return [
'driver' => 'dynamodb', 'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'), 'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'), 'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'region' => env('AWS_V2BOARD_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'), 'endpoint' => env('DYNAMODB_ENDPOINT'),
], ],

View File

@ -59,7 +59,7 @@ return [
'driver' => 's3', 'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'), 'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'), 'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'), 'region' => env('AWS_V2BOARD_REGION'),
'bucket' => env('AWS_BUCKET'), 'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'), 'url' => env('AWS_URL'),
], ],

View File

@ -55,7 +55,7 @@ return [
'secret' => env('AWS_SECRET_ACCESS_KEY'), 'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'), 'queue' => env('SQS_QUEUE', 'your-queue-name'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'region' => env('AWS_V2BOARD_REGION', 'us-east-1'),
], ],
'redis' => [ 'redis' => [

View File

@ -27,7 +27,7 @@ return [
'ses' => [ 'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'), 'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'), 'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'region' => env('AWS_V2BOARD_REGION', 'us-east-1'),
], ],
]; ];

View File

@ -11,7 +11,7 @@
<script> <script>
window.v2board = { window.v2board = {
title: '{{$title}}', title: '{{$title}}',
theme: 1 theme: '{{$theme}}'
} }
</script> </script>
</head> </head>

View File

@ -13,6 +13,7 @@
Route::get('/', function () { Route::get('/', function () {
return view('app', [ return view('app', [
'title' => config('v2board.app_name', env('APP_NAME')) 'title' => config('v2board.app_name', env('APP_NAME')),
'theme' => config('v2board.app_theme', env('V2BOARD_APP_THEME'))
]); ]);
}); });