This commit is contained in:
root 2020-01-29 16:08:50 +08:00
parent 5fae1f2bd8
commit 6dd562df8c
16 changed files with 107 additions and 140 deletions

View File

@ -1,9 +1,9 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\Client;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User; use App\Models\User;
use App\Models\Plan; use App\Models\Plan;
use App\Models\Server; use App\Models\Server;

View File

@ -1,9 +1,9 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\Client;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User; use App\Models\User;
use App\Models\Plan; use App\Models\Plan;
use App\Models\Server; use App\Models\Server;

View File

@ -12,11 +12,6 @@ use App\Models\InviteCode;
class RegisterController extends Controller class RegisterController extends Controller
{ {
private function setTryOut()
{
}
public function index(RegisterIndex $request) public function index(RegisterIndex $request)
{ {
if ((int)config('v2board.stop_register', 0)) { if ((int)config('v2board.stop_register', 0)) {
@ -85,4 +80,17 @@ class RegisterController extends Controller
'data' => true 'data' => true
]); ]);
} }
public function pv(Request $request)
{
$inviteCode = InviteCode::where('code', $request->input('invite_code'))->first();
if ($inviteCode) {
$inviteCode->pv = $inviteCode->pv + 1;
$inviteCode->save();
}
return response([
'data' => true
]);
}
} }

View File

@ -1,7 +1,8 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\Coupon; use App\Models\Coupon;

View File

@ -1,9 +1,9 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User; use App\Models\User;
use App\Models\Order; use App\Models\Order;
use App\Models\InviteCode; use App\Models\InviteCode;

View File

@ -1,9 +1,9 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Notice; use App\Models\Notice;
use App\Utils\Helper; use App\Utils\Helper;

View File

@ -1,9 +1,9 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\User;
use App\Http\Requests\OrderSave;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\OrderSave;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@ -25,7 +25,7 @@ class OrderController extends Controller
{ {
$model = Order::where('user_id', $request->session()->get('id')) $model = Order::where('user_id', $request->session()->get('id'))
->orderBy('created_at', 'DESC'); ->orderBy('created_at', 'DESC');
if (!empty($request->input('status'))) { if ($request->input('status') !== null) {
$model->where('status', $request->input('status')); $model->where('status', $request->input('status'));
} }
$order = $model->get(); $order = $model->get();

View File

@ -1,9 +1,9 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Plan; use App\Models\Plan;
class PlanController extends Controller class PlanController extends Controller

View File

@ -1,10 +1,10 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use App\Http\Controllers\Controller;
use App\Models\Server; use App\Models\Server;
use App\Models\ServerLog; use App\Models\ServerLog;
use App\Models\User; use App\Models\User;

View File

@ -1,10 +1,10 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Http\Requests\TicketSave; use App\Http\Requests\TicketSave;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Ticket; use App\Models\Ticket;
use App\Models\TicketMessage; use App\Models\TicketMessage;
use App\Utils\Helper; use App\Utils\Helper;

View File

@ -1,9 +1,9 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User; use App\Models\User;
use App\Models\Tutorial; use App\Models\Tutorial;

View File

@ -1,10 +1,10 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Http\Requests\UserUpdate; use App\Http\Requests\UserUpdate;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\User; use App\Models\User;
use App\Models\Plan; use App\Models\Plan;
use App\Models\Server; use App\Models\Server;

View File

@ -29,6 +29,7 @@ CREATE TABLE `v2_invite_code` (
`user_id` int(11) NOT NULL, `user_id` int(11) NOT NULL,
`code` char(32) NOT NULL, `code` char(32) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '0', `status` tinyint(1) NOT NULL DEFAULT '0',
`pv` int(11) NOT NULL DEFAULT '0',
`created_at` int(11) NOT NULL, `created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL, `updated_at` int(11) NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
@ -222,4 +223,4 @@ CREATE TABLE `v2_user` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- 2020-01-20 15:33:23 -- 2020-01-29 07:11:28

View File

@ -1,5 +1,5 @@
apps: apps:
- name : 'V2Board Queue' - name : 'V2Board'
script : 'php artisan queue:work --queue=verify_mail,other_mail' script : 'php artisan queue:work --queue=verify_mail,other_mail'
instances: 4 instances: 4
out_file : './storage/logs/queue/queue.log' out_file : './storage/logs/queue/queue.log'

View File

@ -19,139 +19,93 @@ Route::prefix('v1')
Route::prefix('admin') Route::prefix('admin')
->middleware('admin') ->middleware('admin')
->group(function () { ->group(function () {
// Config Route::any('/{class}/{action}', function($class, $action) {
Route::get('config/fetch', 'Admin\\ConfigController@fetch'); $ctrl = \App::make("\\App\\Http\\Controllers\\User\\" . ucfirst($class) . "Controller");
Route::post('config/save', 'Admin\\ConfigController@save'); try {
// Plan return \App::call([$ctrl, $action]);
Route::get('plan/fetch', 'Admin\\PlanController@fetch'); } catch (\Exception $e) {
Route::post('plan/save', 'Admin\\PlanController@save'); abort(404, 'not found');
Route::post('plan/drop', 'Admin\\PlanController@drop'); }
Route::post('plan/update', 'Admin\\PlanController@update'); });
// Server
Route::get('server/fetch', 'Admin\\ServerController@fetch');
Route::post('server/save', 'Admin\\ServerController@save');
Route::get('server/group/fetch', 'Admin\\ServerController@groupFetch');
Route::post('server/group/save', 'Admin\\ServerController@groupSave');
Route::post('server/group/drop', 'Admin\\ServerController@groupDrop');
Route::post('server/drop', 'Admin\\ServerController@drop');
Route::post('server/update', 'Admin\\ServerController@update');
// Order
Route::get('order/fetch', 'Admin\\OrderController@fetch');
Route::post('order/repair', 'Admin\\OrderController@repair');
Route::post('order/update', 'Admin\\OrderController@update');
// User
Route::get('user/fetch', 'Admin\\UserController@fetch');
Route::post('user/update', 'Admin\\UserController@update');
Route::get('user/id2UserInfo/{id}', 'Admin\\UserController@id2UserInfo');
// Stat
Route::get('stat/getOverride', 'Admin\\StatController@getOverride');
// Notice
Route::get('notice/fetch', 'Admin\\NoticeController@fetch');
Route::post('notice/save', 'Admin\\NoticeController@save');
Route::post('notice/update', 'Admin\\NoticeController@update');
Route::post('notice/drop', 'Admin\\NoticeController@drop');
// Ticket
Route::get('ticket/fetch', 'Admin\\TicketController@fetch');
Route::post('ticket/reply', 'Admin\\TicketController@reply');
Route::post('ticket/close', 'Admin\\TicketController@close');
// Mail
Route::post('mail/send', 'Admin\\MailController@send');
// Coupon
Route::get('coupon/fetch', 'Admin\\CouponController@fetch');
Route::post('coupon/save', 'Admin\\CouponController@save');
Route::post('coupon/drop', 'Admin\\CouponController@drop');
// Tutorial
Route::get('tutorial/fetch', 'Admin\\TutorialController@fetch');
Route::post('tutorial/save', 'Admin\\TutorialController@save');
Route::post('tutorial/show', 'Admin\\TutorialController@show');
Route::post('tutorial/drop', 'Admin\\TutorialController@drop');
}); });
// User // User
Route::prefix('user') Route::prefix('user')
->middleware('user') ->middleware('user')
->group(function () { ->group(function () {
// User Route::any('/{action}', function($action) {
Route::get('resetSecurity', 'UserController@resetSecurity'); $ctrl = \App::make("\\App\\Http\\Controllers\\UserController");
Route::get('logout', 'UserController@logout'); try {
Route::get('info', 'UserController@info'); return \App::call([$ctrl, $action]);
Route::post('changePassword', 'UserController@changePassword'); } catch (\Exception $e) {
Route::post('update', 'UserController@update'); abort(404, 'not found');
Route::get('getSubscribe', 'UserController@getSubscribe'); }
Route::get('getStat', 'UserController@getStat'); });
// Order Route::any('/{class}/{action}', function($class, $action) {
Route::post('order/save', 'OrderController@save'); $ctrl = \App::make("\\App\\Http\\Controllers\\User\\" . ucfirst($class) . "Controller");
Route::post('order/checkout', 'OrderController@checkout'); try {
Route::get('order/check', 'OrderController@check'); return \App::call([$ctrl, $action]);
Route::get('order/details', 'OrderController@details'); } catch (\Exception $e) {
Route::get('order/fetch', 'OrderController@fetch'); abort(404, 'not found');
Route::get('order/getPaymentMethod', 'OrderController@getPaymentMethod'); }
Route::post('order/cancel', 'OrderController@cancel'); });
// Plan
Route::get('plan/fetch', 'PlanController@fetch');
// Invite
Route::get('invite/save', 'InviteController@save');
Route::get('invite/fetch', 'InviteController@fetch');
Route::get('invite/details', 'InviteController@details');
// Tutorial
Route::get('tutorial/getSubscribeUrl', 'TutorialController@getSubscribeUrl');
Route::get('tutorial/getAppleID', 'TutorialController@getAppleID');
Route::get('tutorial/fetch', 'TutorialController@fetch');
// Notice
Route::get('notice/fetch', 'NoticeController@fetch');
// Ticket
Route::post('ticket/reply', 'TicketController@reply');
Route::post('ticket/close', 'TicketController@close');
Route::post('ticket/save', 'TicketController@save');
Route::get('ticket/fetch', 'TicketController@fetch');
// Server
Route::get('server/fetch', 'ServerController@fetch');
Route::get('server/log/fetch', 'ServerController@logFetch'); Route::get('server/log/fetch', 'ServerController@logFetch');
// Coupon
Route::post('coupon/check', 'CouponController@check');
}); });
// Passport // Passport
Route::prefix('passport') Route::prefix('passport')
->group(function () { ->group(function () {
// Register Route::any('/{class}/{action}', function($class, $action) {
Route::post('register', 'Passport\\RegisterController@index'); $ctrl = \App::make("\\App\\Http\\Controllers\\Passport\\" . ucfirst($class) . "Controller");
// Comm try {
Route::get('config', 'Passport\\CommController@config'); return \App::call([$ctrl, $action]);
Route::post('sendEmailVerify', 'Passport\\CommController@sendEmailVerify'); } catch (\Exception $e) {
// Login abort(404, 'not found');
Route::post('login', 'Passport\\LoginController@index'); }
Route::get('token2Login', 'Passport\\LoginController@token2Login'); });
Route::get('check', 'Passport\\LoginController@check');
// Forget
Route::post('forget', 'Passport\\ForgetController@index');
}); });
// No Auth // No Auth
Route::prefix('guest') Route::prefix('guest')
->group(function () { ->group(function () {
// Plan Route::any('/{class}/{action}', function($class, $action) {
Route::get('plan/fetch', 'Guest\\PlanController@fetch'); $ctrl = \App::make("\\App\\Http\\Controllers\\Guest\\" . ucfirst($class) . "Controller");
// Order try {
Route::post('order/alipayNotify', 'Guest\\OrderController@alipayNotify'); return \App::call([$ctrl, $action]);
Route::post('order/stripeNotify', 'Guest\\OrderController@stripeNotify'); } catch (\Exception $e) {
Route::post('order/bitpayXNotify', 'Guest\\OrderController@bitpayXNotify'); abort(404, 'not found');
Route::post('order/payTaroNotify', 'Guest\\OrderController@payTaroNotify'); }
});
}); });
// Client // Client
Route::prefix('client') Route::prefix('client')
->middleware('client') ->middleware('client')
->group(function () { ->group(function () {
// Client Route::any('/{action}', function($action) {
Route::get('subscribe', 'ClientController@subscribe'); $ctrl = \App::make("\\App\\Http\\Controllers\\ClientController");
// App try {
Route::get('app/data', 'AppController@data'); return \App::call([$ctrl, $action]);
Route::get('app/config', 'AppController@config'); } catch (\Exception $e) {
abort(404, 'not found');
}
});
Route::any('/{class}/{action}', function($class, $action) {
$ctrl = \App::make("\\App\\Http\\Controllers\\Client\\" . ucfirst($class) . "Controller");
try {
return \App::call([$ctrl, $action]);
} catch (\Exception $e) {
abort(404, 'not found');
}
});
}); });
// Server // Server
Route::prefix('server') Route::prefix('server')
->group(function () { ->group(function () {
// Deepbwork Route::any('/{class}/{action}', function($class, $action) {
Route::get('deepbwork/user', 'Server\\DeepbworkController@user'); $ctrl = \App::make("\\App\\Http\\Controllers\\Server\\" . ucfirst($class) . "Controller");
Route::get('deepbwork/config', 'Server\\DeepbworkController@config'); try {
Route::post('deepbwork/submit', 'Server\\DeepbworkController@submit'); return \App::call([$ctrl, $action]);
} catch (\Exception $e) {
abort(404, 'not found');
}
});
}); });
}); });

View File

@ -130,4 +130,7 @@ ALTER TABLE `v2_server_log`
CHANGE `rate` `rate` decimal(10,2) NOT NULL AFTER `d`; CHANGE `rate` `rate` decimal(10,2) NOT NULL AFTER `d`;
ALTER TABLE `v2_order` ALTER TABLE `v2_order`
DROP `method`; DROP `method`;
ALTER TABLE `v2_invite_code`
ADD `pv` int(11) NOT NULL DEFAULT '0' AFTER `status`;