This commit is contained in:
root 2020-01-11 13:36:52 +08:00
parent 35f954cd84
commit f7fdfadfb0
87 changed files with 1241 additions and 947 deletions

View File

@ -60,12 +60,14 @@ class CheckOrder extends Command
} }
} }
private function orderHandle ($order) { private function orderHandle($order)
{
$user = User::find($order->user_id); $user = User::find($order->user_id);
return $this->buy($order, $user); return $this->buy($order, $user);
} }
private function buy ($order, $user) { private function buy($order, $user)
{
$plan = Plan::find($order->plan_id); $plan = Plan::find($order->plan_id);
// change plan process // change plan process
if ($order->type === 3) { if ($order->type === 3) {
@ -83,15 +85,20 @@ class CheckOrder extends Command
} }
} }
private function getTime ($str, $timestamp) { private function getTime($str, $timestamp)
{
if ($timestamp < time()) { if ($timestamp < time()) {
$timestamp = time(); $timestamp = time();
} }
switch ($str) { switch ($str) {
case 'month_price': return strtotime('+1 month', $timestamp); case 'month_price':
case 'quarter_price': return strtotime('+3 month', $timestamp); return strtotime('+1 month', $timestamp);
case 'half_year_price': return strtotime('+6 month', $timestamp); case 'quarter_price':
case 'year_price': return strtotime('+12 month', $timestamp); return strtotime('+3 month', $timestamp);
case 'half_year_price':
return strtotime('+6 month', $timestamp);
case 'year_price':
return strtotime('+12 month', $timestamp);
} }
} }
} }

View File

@ -47,7 +47,8 @@ class SendRemindMail extends Command
} }
} }
private function remindExpire ($user) { private function remindExpire($user)
{
if (($user->expired_at - 86400) < time() && $user->expired_at > time()) { if (($user->expired_at - 86400) < time() && $user->expired_at > time()) {
SendEmail::dispatch([ SendEmail::dispatch([
'email' => $user->email, 'email' => $user->email,
@ -61,11 +62,12 @@ class SendRemindMail extends Command
} }
} }
private function remindTraffic ($user) { private function remindTraffic($user)
{
if ($this->remindTrafficIsWarnValue(($user->u + $user->d), $user->transfer_enable)) { if ($this->remindTrafficIsWarnValue(($user->u + $user->d), $user->transfer_enable)) {
$sendCount = MailLog::where('created_at', '>=', strtotime(date('Y-m-1'))) $sendCount = MailLog::where('created_at', '>=', strtotime(date('Y-m-1')))
->where('template_name', 'mail.sendRemindTraffic') ->where('template_name', 'mail.sendRemindTraffic')
->count(); ->count();
if ($sendCount > 0) return; if ($sendCount > 0) return;
SendEmail::dispatch([ SendEmail::dispatch([
'email' => $user->email, 'email' => $user->email,
@ -79,7 +81,8 @@ class SendRemindMail extends Command
} }
} }
private function remindTrafficIsWarnValue ($ud, $transfer_enable) { private function remindTrafficIsWarnValue($ud, $transfer_enable)
{
if ($ud <= 0) return false; if ($ud <= 0) return false;
if (($ud / $transfer_enable * 100) < 80) return false; if (($ud / $transfer_enable * 100) < 80) return false;
return true; return true;

View File

@ -47,7 +47,8 @@ class V2boardCache extends Command
$this->setMonthRegisterTotal(); $this->setMonthRegisterTotal();
} }
private function setMonthIncome() { private function setMonthIncome()
{
Cache::put( Cache::put(
'month_income', 'month_income',
Order::where('created_at', '>=', strtotime(date('Y-m-1'))) Order::where('created_at', '>=', strtotime(date('Y-m-1')))
@ -57,7 +58,8 @@ class V2boardCache extends Command
); );
} }
private function setMonthRegisterTotal() { private function setMonthRegisterTotal()
{
Cache::put( Cache::put(
'month_register_total', 'month_register_total',
User::where('created_at', '>=', strtotime(date('Y-m-1'))) User::where('created_at', '>=', strtotime(date('Y-m-1')))

View File

@ -46,39 +46,41 @@ class V2boardInstall extends Command
\Artisan::call('key:generate'); \Artisan::call('key:generate');
sleep(2); sleep(2);
\Artisan::call('config:cache'); \Artisan::call('config:cache');
DB::connection()->getPdo(); DB::connection()->getPdo();
$file = \File::get(base_path() . '/install.sql'); $file = \File::get(base_path() . '/install.sql');
if (!$file) { if (!$file) {
abort(500, '数据库文件不存在'); abort(500, '数据库文件不存在');
} }
$sql = str_replace("\n", "", $file); $sql = str_replace("\n", "", $file);
$sql = preg_split("/;/", $sql); $sql = preg_split("/;/", $sql);
if (!is_array($sql)) { if (!is_array($sql)) {
abort(500, '数据库文件格式有误'); abort(500, '数据库文件格式有误');
} }
$this->info('正在导入数据库请稍等...'); $this->info('正在导入数据库请稍等...');
foreach($sql as $item) { foreach ($sql as $item) {
try { try {
DB::select(DB::raw($item)); DB::select(DB::raw($item));
} catch (\Exception $e) {} } catch (\Exception $e) {
}
} }
$email = ''; $email = '';
while (!$email) { while (!$email) {
$email = $this->ask('请输入管理员邮箱?'); $email = $this->ask('请输入管理员邮箱?');
} }
$password = ''; $password = '';
while (!$password) { while (!$password) {
$password = $this->ask('请输入管理员密码?'); $password = $this->ask('请输入管理员密码?');
} }
if (!$this->registerAdmin($email, $password)) { if (!$this->registerAdmin($email, $password)) {
abort(500, '管理员账号注册失败,请重试'); abort(500, '管理员账号注册失败,请重试');
} }
$this->info('一切就绪'); $this->info('一切就绪');
\File::put(base_path() . '/.lock', time()); \File::put(base_path() . '/.lock', time());
} }
private function registerAdmin ($email, $password) { private function registerAdmin($email, $password)
{
$user = new User(); $user = new User();
$user->email = $email; $user->email = $email;
$user->password = password_hash($password, PASSWORD_DEFAULT); $user->password = password_hash($password, PASSWORD_DEFAULT);

View File

@ -39,22 +39,23 @@ class V2boardUpdate extends Command
public function handle() public function handle()
{ {
\Artisan::call('config:cache'); \Artisan::call('config:cache');
DB::connection()->getPdo(); DB::connection()->getPdo();
$file = \File::get(base_path() . '/update.sql'); $file = \File::get(base_path() . '/update.sql');
if (!$file) { if (!$file) {
abort(500, '数据库文件不存在'); abort(500, '数据库文件不存在');
} }
$sql = str_replace("\n", "", $file); $sql = str_replace("\n", "", $file);
$sql = preg_split("/;/", $sql); $sql = preg_split("/;/", $sql);
if (!is_array($sql)) { if (!is_array($sql)) {
abort(500, '数据库文件格式有误'); abort(500, '数据库文件格式有误');
} }
$this->info('正在导入数据库请稍等...'); $this->info('正在导入数据库请稍等...');
foreach($sql as $item) { foreach ($sql as $item) {
try { try {
DB::select(DB::raw($item)); DB::select(DB::raw($item));
} catch (\Exception $e) {} } catch (\Exception $e) {
} }
}
$this->info('更新完毕'); $this->info('更新完毕');
} }
} }

View File

@ -19,7 +19,7 @@ class Kernel extends ConsoleKernel
/** /**
* Define the application's command schedule. * Define the application's command schedule.
* *
* @param \Illuminate\Console\Scheduling\Schedule $schedule * @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void * @return void
*/ */
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
@ -44,7 +44,7 @@ class Kernel extends ConsoleKernel
*/ */
protected function commands() protected function commands()
{ {
$this->load(__DIR__.'/Commands'); $this->load(__DIR__ . '/Commands');
require base_path('routes/console.php'); require base_path('routes/console.php');
} }

View File

@ -29,7 +29,7 @@ class Handler extends ExceptionHandler
/** /**
* Report or log an exception. * Report or log an exception.
* *
* @param \Exception $exception * @param \Exception $exception
* @return void * @return void
*/ */
public function report(Exception $exception) public function report(Exception $exception)
@ -40,8 +40,8 @@ class Handler extends ExceptionHandler
/** /**
* Render an exception into an HTTP response. * Render an exception into an HTTP response.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Exception $exception * @param \Exception $exception
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function render($request, Exception $exception) public function render($request, Exception $exception)

View File

@ -11,11 +11,13 @@ use App\Models\User;
class ConfigController extends Controller class ConfigController extends Controller
{ {
public function init () { public function init()
{
} }
public function fetch () { public function fetch()
{
return response([ return response([
'data' => [ 'data' => [
'invite' => [ 'invite' => [
@ -62,7 +64,8 @@ class ConfigController extends Controller
]); ]);
} }
public function save (ConfigSave $request) { public function save(ConfigSave $request)
{
$data = $request->input(); $data = $request->input();
$array = \Config::get('v2board'); $array = \Config::get('v2board');
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
@ -72,7 +75,7 @@ class ConfigController extends Controller
$array[$k] = $v; $array[$k] = $v;
} }
$data = var_export($array, 1); $data = var_export($array, 1);
if(!\File::put(base_path() . '/config/v2board.php', "<?php\n return $data ;")) { if (!\File::put(base_path() . '/config/v2board.php', "<?php\n return $data ;")) {
abort(500, '修改失败'); abort(500, '修改失败');
} }
\Artisan::call('config:cache'); \Artisan::call('config:cache');

View File

@ -10,13 +10,15 @@ use App\Utils\Helper;
class CouponController extends Controller class CouponController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
return response([ return response([
'data' => Coupon::all() 'data' => Coupon::all()
]); ]);
} }
public function save (CouponSave $request) { public function save(CouponSave $request)
{
$params = $request->only([ $params = $request->only([
'name', 'name',
'type', 'type',
@ -26,23 +28,24 @@ class CouponController extends Controller
'limit_use' 'limit_use'
]); ]);
if (!$request->input('id')) { if (!$request->input('id')) {
$params['code'] = Helper::randomChar(8); $params['code'] = Helper::randomChar(8);
if (!Coupon::create($params)) { if (!Coupon::create($params)) {
abort(500, '创建失败'); abort(500, '创建失败');
} }
} else { } else {
if (!Coupon::find($request->input('id'))->update($params)) { if (!Coupon::find($request->input('id'))->update($params)) {
abort(500, '保存失败'); abort(500, '保存失败');
} }
} }
return response([ return response([
'data' => true 'data' => true
]); ]);
} }
public function drop (Request $request) { public function drop(Request $request)
{
if (empty($request->input('id'))) { if (empty($request->input('id'))) {
abort(500, '参数有误'); abort(500, '参数有误');
} }

View File

@ -10,7 +10,8 @@ use App\Jobs\SendEmail;
class MailController extends Controller class MailController extends Controller
{ {
public function send (MailSend $request) { public function send(MailSend $request)
{
if ($request->input('type') == 2 && empty($request->input('receiver'))) { if ($request->input('type') == 2 && empty($request->input('receiver'))) {
abort(500, '收件人不能为空'); abort(500, '收件人不能为空');
} }

View File

@ -10,13 +10,15 @@ use Cache;
class NoticeController extends Controller class NoticeController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
return response([ return response([
'data' => Notice::orderBy('id', 'DESC')->get() 'data' => Notice::orderBy('id', 'DESC')->get()
]); ]);
} }
public function save (NoticeSave $request) { public function save(NoticeSave $request)
{
$data = $request->only([ $data = $request->only([
'title', 'title',
'content', 'content',
@ -36,7 +38,8 @@ class NoticeController extends Controller
]); ]);
} }
public function drop (Request $request) { public function drop(Request $request)
{
if (empty($request->input('id'))) { if (empty($request->input('id'))) {
abort(500, '参数错误'); abort(500, '参数错误');
} }

View File

@ -11,7 +11,8 @@ use App\Models\Plan;
class OrderController extends Controller class OrderController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
$current = $request->input('current') ? $request->input('current') : 1; $current = $request->input('current') ? $request->input('current') : 1;
$pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10; $pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10;
$orderModel = Order::orderBy('created_at', 'DESC'); $orderModel = Order::orderBy('created_at', 'DESC');
@ -42,7 +43,8 @@ class OrderController extends Controller
]); ]);
} }
public function update (OrderUpdate $request) { public function update(OrderUpdate $request)
{
$updateData = $request->only([ $updateData = $request->only([
'status', 'status',
'commission_status' 'commission_status'
@ -63,7 +65,8 @@ class OrderController extends Controller
]); ]);
} }
public function repair (Request $request) { public function repair(Request $request)
{
if (empty($request->input('trade_no'))) { if (empty($request->input('trade_no'))) {
abort(500, '参数错误'); abort(500, '参数错误');
} }

View File

@ -12,13 +12,15 @@ use App\Models\User;
class PlanController extends Controller class PlanController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
return response([ return response([
'data' => Plan::get() 'data' => Plan::get()
]); ]);
} }
public function save (PlanSave $request) { public function save(PlanSave $request)
{
if ($request->input('id')) { if ($request->input('id')) {
$plan = Plan::find($request->input('id')); $plan = Plan::find($request->input('id'));
if (!$plan) { if (!$plan) {
@ -41,7 +43,8 @@ class PlanController extends Controller
]); ]);
} }
public function drop (Request $request) { public function drop(Request $request)
{
if (Order::where('plan_id', $request->input('id'))->first()) { if (Order::where('plan_id', $request->input('id'))->first()) {
abort(500, '该订阅下存在订单无法删除'); abort(500, '该订阅下存在订单无法删除');
} }
@ -59,7 +62,8 @@ class PlanController extends Controller
]); ]);
} }
public function update (PlanUpdate $request) { public function update(PlanUpdate $request)
{
$updateData = $request->only([ $updateData = $request->only([
'show', 'show',
'renew' 'renew'

View File

@ -14,7 +14,8 @@ use Cache;
class ServerController extends Controller class ServerController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
$server = Server::get(); $server = Server::get();
for ($i = 0; $i < count($server); $i++) { for ($i = 0; $i < count($server); $i++) {
if (!empty($server[$i]['tags'])) { if (!empty($server[$i]['tags'])) {
@ -32,7 +33,8 @@ class ServerController extends Controller
]); ]);
} }
public function save (ServerSave $request) { public function save(ServerSave $request)
{
$params = $request->only([ $params = $request->only([
'show', 'show',
'group_id', 'group_id',
@ -58,18 +60,18 @@ class ServerController extends Controller
} }
} }
if ($request->input('id')) { if ($request->input('id')) {
$server = Server::find($request->input('id')); $server = Server::find($request->input('id'));
if (!$server) { if (!$server) {
abort(500, '服务器不存在'); abort(500, '服务器不存在');
} }
if (!$server->update($params)) { if (!$server->update($params)) {
abort(500, '保存失败'); abort(500, '保存失败');
} }
return response([ return response([
'data' => true 'data' => true
]); ]);
} }
if (!Server::create($params)) { if (!Server::create($params)) {
abort(500, '创建失败'); abort(500, '创建失败');
@ -80,7 +82,8 @@ class ServerController extends Controller
]); ]);
} }
public function groupFetch (Request $request) { public function groupFetch(Request $request)
{
if ($request->input('group_id')) { if ($request->input('group_id')) {
return response([ return response([
'data' => [ServerGroup::find($request->input('group_id'))] 'data' => [ServerGroup::find($request->input('group_id'))]
@ -91,7 +94,8 @@ class ServerController extends Controller
]); ]);
} }
public function groupSave (Request $request) { public function groupSave(Request $request)
{
if (empty($request->input('name'))) { if (empty($request->input('name'))) {
abort(500, '组名不能为空'); abort(500, '组名不能为空');
} }
@ -108,7 +112,8 @@ class ServerController extends Controller
]); ]);
} }
public function groupDrop (Request $request) { public function groupDrop(Request $request)
{
if ($request->input('id')) { if ($request->input('id')) {
$serverGroup = ServerGroup::find($request->input('id')); $serverGroup = ServerGroup::find($request->input('id'));
if (!$serverGroup) { if (!$serverGroup) {
@ -135,7 +140,8 @@ class ServerController extends Controller
]); ]);
} }
public function drop (Request $request) { public function drop(Request $request)
{
if ($request->input('id')) { if ($request->input('id')) {
$server = Server::find($request->input('id')); $server = Server::find($request->input('id'));
if (!$server) { if (!$server) {
@ -147,7 +153,8 @@ class ServerController extends Controller
]); ]);
} }
public function update (ServerUpdate $request) { public function update(ServerUpdate $request)
{
$params = $request->only([ $params = $request->only([
'show', 'show',
]); ]);

View File

@ -14,7 +14,8 @@ use Cache;
class StatController extends Controller class StatController extends Controller
{ {
public function getOverride (Request $request) { public function getOverride(Request $request)
{
return response([ return response([
'data' => [ 'data' => [
'month_income' => Cache::get('month_income'), 'month_income' => Cache::get('month_income'),

View File

@ -10,7 +10,8 @@ use Illuminate\Support\Facades\DB;
class TicketController extends Controller class TicketController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
if ($request->input('id')) { if ($request->input('id')) {
$ticket = Ticket::where('id', $request->input('id')) $ticket = Ticket::where('id', $request->input('id'))
->first(); ->first();
@ -43,7 +44,8 @@ class TicketController extends Controller
]); ]);
} }
public function reply (Request $request) { public function reply(Request $request)
{
if (empty($request->input('id'))) { if (empty($request->input('id'))) {
abort(500, '参数错误'); abort(500, '参数错误');
} }
@ -75,7 +77,8 @@ class TicketController extends Controller
]); ]);
} }
public function close (Request $request) { public function close(Request $request)
{
if (empty($request->input('id'))) { if (empty($request->input('id'))) {
abort(500, '参数错误'); abort(500, '参数错误');
} }

View File

@ -9,13 +9,15 @@ use App\Models\Tutorial;
class TutorialController extends Controller class TutorialController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
return response([ return response([
'data' => Tutorial::all() 'data' => Tutorial::all()
]); ]);
} }
public function save (TutorialSave $request) { public function save(TutorialSave $request)
{
$params = $request->only([ $params = $request->only([
'title', 'title',
'description', 'description',
@ -23,22 +25,23 @@ class TutorialController extends Controller
'icon' 'icon'
]); ]);
if (!$request->input('id')) { if (!$request->input('id')) {
if (!Tutorial::create($params)) { if (!Tutorial::create($params)) {
abort(500, '创建失败'); abort(500, '创建失败');
} }
} else { } else {
if (!Tutorial::find($request->input('id'))->update($params)) { if (!Tutorial::find($request->input('id'))->update($params)) {
abort(500, '保存失败'); abort(500, '保存失败');
} }
} }
return response([ return response([
'data' => true 'data' => true
]); ]);
} }
public function show (Request $request) { public function show(Request $request)
{
if (empty($request->input('id'))) { if (empty($request->input('id'))) {
abort(500, '参数有误'); abort(500, '参数有误');
} }
@ -56,7 +59,8 @@ class TutorialController extends Controller
]); ]);
} }
public function drop (Request $request) { public function drop(Request $request)
{
if (empty($request->input('id'))) { if (empty($request->input('id'))) {
abort(500, '参数有误'); abort(500, '参数有误');
} }

View File

@ -11,7 +11,8 @@ use App\Models\Plan;
class UserController extends Controller class UserController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
$current = $request->input('current') ? $request->input('current') : 1; $current = $request->input('current') ? $request->input('current') : 1;
$pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10; $pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10;
$userModel = User::orderBy('created_at', 'DESC'); $userModel = User::orderBy('created_at', 'DESC');
@ -35,7 +36,8 @@ class UserController extends Controller
]); ]);
} }
public function id2UserInfo ($id) { public function id2UserInfo($id)
{
if (empty($id)) { if (empty($id)) {
abort(500, '参数错误'); abort(500, '参数错误');
} }
@ -50,17 +52,18 @@ class UserController extends Controller
]); ]);
} }
public function update (UserUpdate $request) { public function update(UserUpdate $request)
$updateData = $request->only([ {
'email', $updateData = $request->only([
'password', 'email',
'transfer_enable', 'password',
'expired_at', 'transfer_enable',
'expired_at',
'banned', 'banned',
'plan_id', 'plan_id',
'commission_rate', 'commission_rate',
'is_admin' 'is_admin'
]); ]);
$user = User::find($request->input('id')); $user = User::find($request->input('id'));
if (!$user) { if (!$user) {
abort(500, '用户不存在'); abort(500, '用户不存在');
@ -69,9 +72,9 @@ class UserController extends Controller
abort(500, '邮箱已被使用'); abort(500, '邮箱已被使用');
} }
if (isset($updateData['password'])) { if (isset($updateData['password'])) {
$updateData['password'] = password_hash($updateData['password'], PASSWORD_DEFAULT); $updateData['password'] = password_hash($updateData['password'], PASSWORD_DEFAULT);
} else { } else {
unset($updateData['password']); unset($updateData['password']);
} }
$updateData['transfer_enable'] = $updateData['transfer_enable'] * 1073741824; $updateData['transfer_enable'] = $updateData['transfer_enable'] * 1073741824;
if (isset($updateData['plan_id'])) { if (isset($updateData['plan_id'])) {

View File

@ -16,7 +16,8 @@ class AppController extends Controller
CONST SOCKS_PORT = 10010; CONST SOCKS_PORT = 10010;
CONST HTTP_PORT = 10011; CONST HTTP_PORT = 10011;
public function data (Request $request) { public function data(Request $request)
{
$user = $request->user; $user = $request->user;
$nodes = []; $nodes = [];
if ($user->plan_id) { if ($user->plan_id) {
@ -49,7 +50,8 @@ class AppController extends Controller
]); ]);
} }
public function config (Request $request) { public function config(Request $request)
{
if (empty($request->input('server_id'))) { if (empty($request->input('server_id'))) {
abort(500, '参数错误'); abort(500, '参数错误');
} }
@ -77,17 +79,23 @@ class AppController extends Controller
$json->outbound->streamSettings->network = $server->network; $json->outbound->streamSettings->network = $server->network;
if ($server->settings) { if ($server->settings) {
switch ($server->network) { switch ($server->network) {
case 'tcp': $json->outbound->streamSettings->tcpSettings = json_decode($server->settings); case 'tcp':
$json->outbound->streamSettings->tcpSettings = json_decode($server->settings);
break; break;
case 'kcp': $json->outbound->streamSettings->kcpSettings = json_decode($server->settings); case 'kcp':
$json->outbound->streamSettings->kcpSettings = json_decode($server->settings);
break; break;
case 'ws': $json->outbound->streamSettings->wsSettings = json_decode($server->settings); case 'ws':
$json->outbound->streamSettings->wsSettings = json_decode($server->settings);
break; break;
case 'http': $json->outbound->streamSettings->httpSettings = json_decode($server->settings); case 'http':
$json->outbound->streamSettings->httpSettings = json_decode($server->settings);
break; break;
case 'domainsocket': $json->outbound->streamSettings->dsSettings = json_decode($server->settings); case 'domainsocket':
$json->outbound->streamSettings->dsSettings = json_decode($server->settings);
break; break;
case 'quic': $json->outbound->streamSettings->quicSettings = json_decode($server->settings); case 'quic':
$json->outbound->streamSettings->quicSettings = json_decode($server->settings);
break; break;
} }
} }

View File

@ -12,133 +12,138 @@ use Symfony\Component\Yaml\Yaml;
class ClientController extends Controller class ClientController extends Controller
{ {
public function subscribe (Request $request) { public function subscribe(Request $request)
{
$user = $request->user; $user = $request->user;
$server = []; $server = [];
if ($user->expired_at > time()) { if ($user->expired_at > time()) {
$servers = Server::where('show', 1) $servers = Server::where('show', 1)
->orderBy('name') ->orderBy('name')
->get(); ->get();
foreach ($servers as $item) { foreach ($servers as $item) {
$groupId = json_decode($item['group_id']); $groupId = json_decode($item['group_id']);
if (in_array($user->group_id, $groupId)) { if (in_array($user->group_id, $groupId)) {
array_push($server, $item); array_push($server, $item);
} }
} }
} }
if(isset($_SERVER['HTTP_USER_AGENT'])) { if (isset($_SERVER['HTTP_USER_AGENT'])) {
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Quantumult%20X') !== false) { if (strpos($_SERVER['HTTP_USER_AGENT'], 'Quantumult%20X') !== false) {
die($this->quantumultX($user, $server)); die($this->quantumultX($user, $server));
} }
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Quantumult') !== false) { if (strpos($_SERVER['HTTP_USER_AGENT'], 'Quantumult') !== false) {
die($this->quantumult($user, $server)); die($this->quantumult($user, $server));
} }
if(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'clash') !== false) { if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'clash') !== false) {
die($this->clash($user, $server)); die($this->clash($user, $server));
} }
} }
die($this->origin($user, $server)); die($this->origin($user, $server));
} }
private function quantumultX ($user, $server) { private function quantumultX($user, $server)
$uri = ''; {
foreach($server as $item) { $uri = '';
$uri .= "vmess=".$item->host.":".$item->port.", method=none, password=".$user->v2ray_uuid.", fast-open=false, udp-relay=false, tag=".$item->name; foreach ($server as $item) {
if ($item->network == 'ws') { $uri .= "vmess=" . $item->host . ":" . $item->port . ", method=none, password=" . $user->v2ray_uuid . ", fast-open=false, udp-relay=false, tag=" . $item->name;
$uri .= ', obfs=ws'; if ($item->network == 'ws') {
if ($item->settings) { $uri .= ', obfs=ws';
$wsSettings = json_decode($item->settings); if ($item->settings) {
if (isset($wsSettings->path)) $uri .= ', obfs-uri=' . $wsSettings->path; $wsSettings = json_decode($item->settings);
if (isset($wsSettings->headers->Host)) $uri .= ', obfs-host=' . $wsSettings->headers->Host; if (isset($wsSettings->path)) $uri .= ', obfs-uri=' . $wsSettings->path;
} if (isset($wsSettings->headers->Host)) $uri .= ', obfs-host=' . $wsSettings->headers->Host;
}
}
$uri .= "\r\n";
} }
$uri .= "\r\n"; return base64_encode($uri);
}
return base64_encode($uri);
} }
private function quantumult ($user, $server) { private function quantumult($user, $server)
$uri = ''; {
header('subscription-userinfo: upload='.$user->u.'; download='.$user->d.';total='.$user->transfer_enable); $uri = '';
foreach($server as $item) { header('subscription-userinfo: upload=' . $user->u . '; download=' . $user->d . ';total=' . $user->transfer_enable);
$str = ''; foreach ($server as $item) {
$str .= $item->name.'= vmess, '.$item->host.', '.$item->port.', chacha20-ietf-poly1305, "'.$user->v2ray_uuid.'", over-tls='.($item->tls?"true":"false").', certificate=0, group='.config('v2board.app_name', 'V2Board'); $str = '';
if ($item->network === 'ws') { $str .= $item->name . '= vmess, ' . $item->host . ', ' . $item->port . ', chacha20-ietf-poly1305, "' . $user->v2ray_uuid . '", over-tls=' . ($item->tls ? "true" : "false") . ', certificate=0, group=' . config('v2board.app_name', 'V2Board');
$str .= ', obfs=ws'; if ($item->network === 'ws') {
if ($item->settings) { $str .= ', obfs=ws';
$wsSettings = json_decode($item->settings); if ($item->settings) {
if (isset($wsSettings->path)) $str .= ', obfs-path="'.$wsSettings->path.'"'; $wsSettings = json_decode($item->settings);
if (isset($wsSettings->headers->Host)) $str .= ', obfs-header="Host:'.$wsSettings->headers->Host.'"'; if (isset($wsSettings->path)) $str .= ', obfs-path="' . $wsSettings->path . '"';
} if (isset($wsSettings->headers->Host)) $str .= ', obfs-header="Host:' . $wsSettings->headers->Host . '"';
}
}
$uri .= "vmess://" . base64_encode($str) . "\r\n";
} }
$uri .= "vmess://".base64_encode($str)."\r\n"; return base64_encode($uri);
}
return base64_encode($uri);
} }
private function origin ($user, $server) { private function origin($user, $server)
$uri = ''; {
foreach($server as $item) { $uri = '';
$uri .= Helper::buildVmessLink($item, $user); foreach ($server as $item) {
} $uri .= Helper::buildVmessLink($item, $user);
return base64_encode($uri); }
return base64_encode($uri);
} }
private function clash ($user, $server) { private function clash($user, $server)
$proxy = []; {
$proxyGroup = []; $proxy = [];
$proxies = []; $proxyGroup = [];
foreach ($server as $item) { $proxies = [];
$array = []; foreach ($server as $item) {
$array['name'] = $item->name; $array = [];
$array['type'] = 'vmess'; $array['name'] = $item->name;
$array['server'] = $item->host; $array['type'] = 'vmess';
$array['port'] = $item->port; $array['server'] = $item->host;
$array['uuid'] = $user->v2ray_uuid; $array['port'] = $item->port;
$array['alterId'] = $user->v2ray_alter_id; $array['uuid'] = $user->v2ray_uuid;
$array['cipher'] = 'auto'; $array['alterId'] = $user->v2ray_alter_id;
if ($item->tls) { $array['cipher'] = 'auto';
$array['tls'] = true; if ($item->tls) {
$array['tls'] = true;
}
if ($item->network == 'ws') {
$array['network'] = $item->network;
if ($item->settings) {
$wsSettings = json_decode($item->settings);
if (isset($wsSettings->path)) $array['ws-path'] = $wsSettings->path;
if (isset($wsSettings->headers->Host)) $array['ws-headers'] = [
'Host' => $wsSettings->headers->Host
];
}
}
array_push($proxy, $array);
array_push($proxies, $item->name);
} }
if ($item->network == 'ws') { array_push($proxyGroup, [
$array['network'] = $item->network; 'name' => config('v2board.app_name', 'V2Board'),
if ($item->settings) { 'type' => 'select',
$wsSettings = json_decode($item->settings); 'proxies' => $proxies
if (isset($wsSettings->path)) $array['ws-path'] = $wsSettings->path; ]);
if (isset($wsSettings->headers->Host)) $array['ws-headers'] = [
'Host' => $wsSettings->headers->Host
];
}
}
array_push($proxy, $array);
array_push($proxies, $item->name);
}
array_push($proxyGroup, [
'name' => config('v2board.app_name', 'V2Board'),
'type' => 'select',
'proxies' => $proxies
]);
$config = [ $config = [
'port' => 7890, 'port' => 7890,
'socks-port' => 0, 'socks-port' => 0,
'allow-lan' => false, 'allow-lan' => false,
'mode' => 'Rule', 'mode' => 'Rule',
'log-level' => 'info', 'log-level' => 'info',
'external-controller' => '0.0.0.0:9090', 'external-controller' => '0.0.0.0:9090',
'secret' => '', 'secret' => '',
'Proxy' => $proxy, 'Proxy' => $proxy,
'Proxy Group' => $proxyGroup, 'Proxy Group' => $proxyGroup,
'Rule' => [ 'Rule' => [
'DOMAIN-SUFFIX,google.com,'.config('v2board.app_name', 'V2Board'), 'DOMAIN-SUFFIX,google.com,' . config('v2board.app_name', 'V2Board'),
'DOMAIN-KEYWORD,google,'.config('v2board.app_name', 'V2Board'), 'DOMAIN-KEYWORD,google,' . config('v2board.app_name', 'V2Board'),
'DOMAIN,google.com,'.config('v2board.app_name', 'V2Board'), 'DOMAIN,google.com,' . config('v2board.app_name', 'V2Board'),
'DOMAIN-SUFFIX,ad.com,REJECT', 'DOMAIN-SUFFIX,ad.com,REJECT',
'IP-CIDR,127.0.0.0/8,DIRECT', 'IP-CIDR,127.0.0.0/8,DIRECT',
'GEOIP,CN,DIRECT', 'GEOIP,CN,DIRECT',
'MATCH,'.config('v2board.app_name', 'V2Board') 'MATCH,' . config('v2board.app_name', 'V2Board')
] ]
]; ];
return Yaml::dump($config); return Yaml::dump($config);
} }
} }

View File

@ -7,7 +7,8 @@ use App\Models\Coupon;
class CouponController extends Controller class CouponController extends Controller
{ {
public function check (Request $request) { public function check(Request $request)
{
if (empty($request->input('code'))) { if (empty($request->input('code'))) {
abort(500, '优惠券码不能为空'); abort(500, '优惠券码不能为空');
} }

View File

@ -12,7 +12,8 @@ use Library\BitpayX;
class OrderController extends Controller class OrderController extends Controller
{ {
public function alipayNotify (Request $request) { public function alipayNotify(Request $request)
{
Log::info('alipayNotifyData: ' . json_encode($_POST)); Log::info('alipayNotifyData: ' . json_encode($_POST));
$gateway = Omnipay::create('Alipay_AopF2F'); $gateway = Omnipay::create('Alipay_AopF2F');
$gateway->setSignType('RSA2'); //RSA/RSA2 $gateway->setSignType('RSA2'); //RSA/RSA2
@ -25,7 +26,7 @@ class OrderController extends Controller
/** @var \Omnipay\Alipay\Responses\AopCompletePurchaseResponse $response */ /** @var \Omnipay\Alipay\Responses\AopCompletePurchaseResponse $response */
$response = $request->send(); $response = $request->send();
if($response->isPaid()){ if ($response->isPaid()) {
/** /**
* Payment is successful * Payment is successful
*/ */
@ -34,7 +35,7 @@ class OrderController extends Controller
} }
die('success'); //The response should be 'success' only die('success'); //The response should be 'success' only
}else{ } else {
/** /**
* Payment is not successful * Payment is not successful
*/ */
@ -48,7 +49,8 @@ class OrderController extends Controller
} }
} }
public function stripeNotify (Request $request) { public function stripeNotify(Request $request)
{
Log::info('stripeNotifyData: ' . json_encode($request->input())); Log::info('stripeNotifyData: ' . json_encode($request->input()));
\Stripe\Stripe::setApiKey(config('v2board.stripe_sk_live')); \Stripe\Stripe::setApiKey(config('v2board.stripe_sk_live'));
@ -86,7 +88,8 @@ class OrderController extends Controller
} }
} }
public function bitpayXNotify (Request $request) { public function bitpayXNotify(Request $request)
{
$inputString = file_get_contents('php://input', 'r'); $inputString = file_get_contents('php://input', 'r');
Log::info('bitpayXNotifyData: ' . $inputString); Log::info('bitpayXNotifyData: ' . $inputString);
$inputStripped = str_replace(array("\r", "\n", "\t", "\v"), '', $inputString); $inputStripped = str_replace(array("\r", "\n", "\t", "\v"), '', $inputString);
@ -94,14 +97,14 @@ class OrderController extends Controller
$bitpayX = new BitpayX(config('v2board.bitpayx_appsecret')); $bitpayX = new BitpayX(config('v2board.bitpayx_appsecret'));
$params = [ $params = [
'status' => $inputJSON['status'], 'status' => $inputJSON['status'],
'order_id' => $inputJSON['order_id'], 'order_id' => $inputJSON['order_id'],
'merchant_order_id' => $inputJSON['merchant_order_id'], 'merchant_order_id' => $inputJSON['merchant_order_id'],
'price_amount' => $inputJSON['price_amount'], 'price_amount' => $inputJSON['price_amount'],
'price_currency' => $inputJSON['price_currency'], 'price_currency' => $inputJSON['price_currency'],
'pay_amount' => $inputJSON['pay_amount'], 'pay_amount' => $inputJSON['pay_amount'],
'pay_currency' => $inputJSON['pay_currency'], 'pay_currency' => $inputJSON['pay_currency'],
'created_at_t' => $inputJSON['created_at_t'] 'created_at_t' => $inputJSON['created_at_t']
]; ];
$strToSign = $bitpayX->prepareSignId($inputJSON['merchant_order_id']); $strToSign = $bitpayX->prepareSignId($inputJSON['merchant_order_id']);
if (!$bitpayX->verify($strToSign, $inputJSON['token'])) { if (!$bitpayX->verify($strToSign, $inputJSON['token'])) {
@ -127,7 +130,8 @@ class OrderController extends Controller
]); ]);
} }
private function handle ($tradeNo, $callbackNo) { private function handle($tradeNo, $callbackNo)
{
$order = Order::where('trade_no', $tradeNo)->first(); $order = Order::where('trade_no', $tradeNo)->first();
if (!$order) { if (!$order) {
abort(500, 'order is not found'); abort(500, 'order is not found');

View File

@ -8,7 +8,8 @@ use App\Models\Plan;
class PlanController extends Controller class PlanController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
$plan = Plan::where('show', 1)->get(); $plan = Plan::where('show', 1)->get();
return response([ return response([
'data' => $plan 'data' => $plan

View File

@ -11,7 +11,8 @@ use App\Utils\Helper;
class InviteController extends Controller class InviteController extends Controller
{ {
public function save (Request $request) { public function save(Request $request)
{
if (InviteCode::where('user_id', $request->session()->get('id'))->where('status', 0)->count() >= config('v2board.invite_gen_limit', 5)) { if (InviteCode::where('user_id', $request->session()->get('id'))->where('status', 0)->count() >= config('v2board.invite_gen_limit', 5)) {
abort(500, '已达到创建数量上限'); abort(500, '已达到创建数量上限');
} }
@ -23,7 +24,8 @@ class InviteController extends Controller
]); ]);
} }
public function details (Request $request) { public function details(Request $request)
{
return response([ return response([
'data' => Order::where('invite_user_id', $request->session()->get('id')) 'data' => Order::where('invite_user_id', $request->session()->get('id'))
->where('status', 3) ->where('status', 3)
@ -38,7 +40,8 @@ class InviteController extends Controller
]); ]);
} }
public function fetch (Request $request) { public function fetch(Request $request)
{
$codes = InviteCode::where('user_id', $request->session()->get('id')) $codes = InviteCode::where('user_id', $request->session()->get('id'))
->where('status', 0) ->where('status', 0)
->get(); ->get();

View File

@ -9,7 +9,8 @@ use App\Utils\Helper;
class NoticeController extends Controller class NoticeController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
return response([ return response([
'data' => Notice::orderBy('created_at', 'DESC')->first() 'data' => Notice::orderBy('created_at', 'DESC')->first()
]); ]);

View File

@ -20,13 +20,14 @@ use Library\BitpayX;
class OrderController extends Controller class OrderController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
$order = Order::where('user_id', $request->session()->get('id')) $order = Order::where('user_id', $request->session()->get('id'))
->orderBy('created_at', 'DESC') ->orderBy('created_at', 'DESC')
->get(); ->get();
$plan = Plan::get(); $plan = Plan::get();
for($i = 0; $i < count($order); $i++) { for ($i = 0; $i < count($order); $i++) {
for($x = 0; $x < count($plan); $x++) { for ($x = 0; $x < count($plan); $x++) {
if ($order[$i]['plan_id'] === $plan[$x]['id']) { if ($order[$i]['plan_id'] === $plan[$x]['id']) {
$order[$i]['plan'] = $plan[$x]; $order[$i]['plan'] = $plan[$x];
} }
@ -37,7 +38,8 @@ class OrderController extends Controller
]); ]);
} }
public function details (Request $request) { public function details(Request $request)
{
$order = Order::where('user_id', $request->session()->get('id')) $order = Order::where('user_id', $request->session()->get('id'))
->where('trade_no', $request->input('trade_no')) ->where('trade_no', $request->input('trade_no'))
->first(); ->first();
@ -54,7 +56,8 @@ class OrderController extends Controller
]); ]);
} }
private function isExistNotPayOrderByUserId ($userId) { private function isExistNotPayOrderByUserId($userId)
{
$order = Order::where('status', 0) $order = Order::where('status', 0)
->where('user_id', $userId) ->where('user_id', $userId)
->first(); ->first();
@ -64,7 +67,8 @@ class OrderController extends Controller
return true; return true;
} }
public function save (OrderSave $request) { public function save(OrderSave $request)
{
if ($this->isExistNotPayOrderByUserId($request->session()->get('id'))) { if ($this->isExistNotPayOrderByUserId($request->session()->get('id'))) {
abort(500, '存在未付款订单,请取消后再试'); abort(500, '存在未付款订单,请取消后再试');
} }
@ -133,9 +137,11 @@ class OrderController extends Controller
// coupon process // coupon process
if (isset($coupon)) { if (isset($coupon)) {
switch ($coupon->type) { switch ($coupon->type) {
case 1: $order->discount_amount = $coupon->value; case 1:
$order->discount_amount = $coupon->value;
break; break;
case 2: $order->discount_amount = $order->total_amount * ($coupon->value / 100); case 2:
$order->discount_amount = $order->total_amount * ($coupon->value / 100);
break; break;
} }
$order->total_amount = $order->total_amount - $order->discount_amount; $order->total_amount = $order->total_amount - $order->discount_amount;
@ -165,7 +171,8 @@ class OrderController extends Controller
]); ]);
} }
public function checkout (Request $request) { public function checkout(Request $request)
{
$tradeNo = $request->input('trade_no'); $tradeNo = $request->input('trade_no');
$method = $request->input('method'); $method = $request->input('method');
$order = Order::where('trade_no', $tradeNo) $order = Order::where('trade_no', $tradeNo)
@ -218,7 +225,8 @@ class OrderController extends Controller
} }
} }
public function check (Request $request) { public function check(Request $request)
{
$tradeNo = $request->input('trade_no'); $tradeNo = $request->input('trade_no');
$order = Order::where('trade_no', $tradeNo) $order = Order::where('trade_no', $tradeNo)
->where('user_id', $request->session()->get('id')) ->where('user_id', $request->session()->get('id'))
@ -231,7 +239,8 @@ class OrderController extends Controller
]); ]);
} }
public function getPaymentMethod () { public function getPaymentMethod()
{
$data = []; $data = [];
if ((int)config('v2board.alipay_enable')) { if ((int)config('v2board.alipay_enable')) {
$alipayF2F = new \StdClass(); $alipayF2F = new \StdClass();
@ -270,7 +279,8 @@ class OrderController extends Controller
]); ]);
} }
public function cancel (Request $request) { public function cancel(Request $request)
{
if (empty($request->input('trade_no'))) { if (empty($request->input('trade_no'))) {
abort(500, '参数有误'); abort(500, '参数有误');
} }
@ -292,7 +302,8 @@ class OrderController extends Controller
]); ]);
} }
private function alipayF2F ($tradeNo, $totalAmount) { private function alipayF2F($tradeNo, $totalAmount)
{
$gateway = Omnipay::create('Alipay_AopF2F'); $gateway = Omnipay::create('Alipay_AopF2F');
$gateway->setSignType('RSA2'); //RSA/RSA2 $gateway->setSignType('RSA2'); //RSA/RSA2
$gateway->setAppId(config('v2board.alipay_appid')); $gateway->setAppId(config('v2board.alipay_appid'));
@ -301,7 +312,7 @@ class OrderController extends Controller
$gateway->setNotifyUrl(url('/api/v1/guest/order/alipayNotify')); $gateway->setNotifyUrl(url('/api/v1/guest/order/alipayNotify'));
$request = $gateway->purchase(); $request = $gateway->purchase();
$request->setBizContent([ $request->setBizContent([
'subject' => config('v2board.app_name', 'V2Board') . ' - 订阅', 'subject' => config('v2board.app_name', 'V2Board') . ' - 订阅',
'out_trade_no' => $tradeNo, 'out_trade_no' => $tradeNo,
'total_amount' => $totalAmount / 100 'total_amount' => $totalAmount / 100
]); ]);
@ -309,13 +320,14 @@ class OrderController extends Controller
$response = $request->send(); $response = $request->send();
$result = $response->getAlipayResponse(); $result = $response->getAlipayResponse();
if ($result['code'] !== '10000') { if ($result['code'] !== '10000') {
abort(500, $result['sub_msg']); abort(500, $result['sub_msg']);
} }
// 获取收款二维码内容 // 获取收款二维码内容
return $response->getQrCode(); return $response->getQrCode();
} }
private function stripeAlipay ($order) { private function stripeAlipay($order)
{
$exchange = Helper::exchange('CNY', 'HKD'); $exchange = Helper::exchange('CNY', 'HKD');
if (!$exchange) { if (!$exchange) {
abort(500, '货币转换超时,请稍后再试'); abort(500, '货币转换超时,请稍后再试');
@ -340,7 +352,8 @@ class OrderController extends Controller
return $source['redirect']['url']; return $source['redirect']['url'];
} }
private function stripeWepay ($order) { private function stripeWepay($order)
{
$exchange = Helper::exchange('CNY', 'HKD'); $exchange = Helper::exchange('CNY', 'HKD');
if (!$exchange) { if (!$exchange) {
abort(500, '货币转换超时,请稍后再试'); abort(500, '货币转换超时,请稍后再试');
@ -364,20 +377,21 @@ class OrderController extends Controller
return $source['wechat']['qr_code_url']; return $source['wechat']['qr_code_url'];
} }
private function bitpayX ($order) { private function bitpayX($order)
{
$bitpayX = new BitpayX(config('v2board.bitpayx_appsecret')); $bitpayX = new BitpayX(config('v2board.bitpayx_appsecret'));
$params = [ $params = [
'merchant_order_id' => 'V2Board_' . $order->trade_no, 'merchant_order_id' => 'V2Board_' . $order->trade_no,
'price_amount' => $order->total_amount / 100, 'price_amount' => $order->total_amount / 100,
'price_currency' => 'CNY', 'price_currency' => 'CNY',
'title' => '支付单号:' . $order->trade_no, 'title' => '支付单号:' . $order->trade_no,
'description' => '充值:' . $order->total_amount / 100 . ' 元', 'description' => '充值:' . $order->total_amount / 100 . ' 元',
'callback_url' => url('/api/v1/guest/order/bitpayXNotify'), 'callback_url' => url('/api/v1/guest/order/bitpayXNotify'),
'success_url' => config('v2board.app_url', env('APP_URL')) . '/#/order', 'success_url' => config('v2board.app_url', env('APP_URL')) . '/#/order',
'cancel_url' => config('v2board.app_url', env('APP_URL')) . '/#/order' 'cancel_url' => config('v2board.app_url', env('APP_URL')) . '/#/order'
]; ];
$strToSign = $bitpayX->prepareSignId($params['merchant_order_id']); $strToSign = $bitpayX->prepareSignId($params['merchant_order_id']);
$params['token'] = $bitpayX->sign($strToSign); $params['token'] = $bitpayX->sign($strToSign);
$result = $bitpayX->mprequest($params); $result = $bitpayX->mprequest($params);
Log::info('bitpayXSubmit: ' . json_encode($result)); Log::info('bitpayXSubmit: ' . json_encode($result));
return isset($result['payment_url']) ? $result['payment_url'] : false; return isset($result['payment_url']) ? $result['payment_url'] : false;

View File

@ -11,7 +11,8 @@ use Cache;
class CommController extends Controller class CommController extends Controller
{ {
public function config () { public function config()
{
return response([ return response([
'data' => [ 'data' => [
'isEmailVerify' => (int)config('v2board.email_verify', 0) ? 1 : 0, 'isEmailVerify' => (int)config('v2board.email_verify', 0) ? 1 : 0,
@ -20,13 +21,15 @@ class CommController extends Controller
]); ]);
} }
private function isEmailVerify () { private function isEmailVerify()
{
return response([ return response([
'data' => (int)config('v2board.email_verify', 0) ? 1 : 0 'data' => (int)config('v2board.email_verify', 0) ? 1 : 0
]); ]);
} }
public function sendEmailVerify (CommSendEmailVerify $request) { public function sendEmailVerify(CommSendEmailVerify $request)
{
$email = $request->input('email'); $email = $request->input('email');
$cacheKey = 'sendEmailVerify:' . $email; $cacheKey = 'sendEmailVerify:' . $email;
if (Cache::get($cacheKey)) { if (Cache::get($cacheKey)) {
@ -41,7 +44,7 @@ class CommController extends Controller
'name' => config('v2board.app_name', 'V2Board'), 'name' => config('v2board.app_name', 'V2Board'),
'url' => config('v2board.app_url') 'url' => config('v2board.app_url')
], ],
function ($message) use($email, $subject) { function ($message) use ($email, $subject) {
$message->to($email)->subject($subject); $message->to($email)->subject($subject);
} }
); );

View File

@ -11,7 +11,8 @@ use Cache;
class ForgetController extends Controller class ForgetController extends Controller
{ {
public function index (ForgetIndex $request) { public function index(ForgetIndex $request)
{
$redisKey = 'sendEmailVerify:' . $request->input('email'); $redisKey = 'sendEmailVerify:' . $request->input('email');
if (Cache::get($redisKey) !== $request->input('email_code')) { if (Cache::get($redisKey) !== $request->input('email_code')) {
abort(500, '邮箱验证码有误'); abort(500, '邮箱验证码有误');

View File

@ -11,7 +11,8 @@ use App\Utils\Helper;
class LoginController extends Controller class LoginController extends Controller
{ {
public function index (LoginIndex $request) { public function index(LoginIndex $request)
{
$email = $request->input('email'); $email = $request->input('email');
$password = $request->input('password'); $password = $request->input('password');
@ -36,7 +37,8 @@ class LoginController extends Controller
]); ]);
} }
public function token2Login (Request $request) { public function token2Login(Request $request)
{
if ($request->input('token')) { if ($request->input('token')) {
$user = User::where('token', $request->input('token'))->first(); $user = User::where('token', $request->input('token'))->first();
if (!$user) { if (!$user) {
@ -46,7 +48,7 @@ class LoginController extends Controller
$key = 'token2Login_' . $code; $key = 'token2Login_' . $code;
Cache::put($key, $user->id); Cache::put($key, $user->id);
Redis::expire($key, 600); Redis::expire($key, 600);
$redirect = '/#/login?verify='. $code .'&redirect=' . ($request->input('redirect') ? $request->input('redirect') : 'dashboard'); $redirect = '/#/login?verify=' . $code . '&redirect=' . ($request->input('redirect') ? $request->input('redirect') : 'dashboard');
if (config('v2board.app_url')) { if (config('v2board.app_url')) {
$location = config('v2board.app_url') . $redirect; $location = config('v2board.app_url') . $redirect;
} else { } else {
@ -77,7 +79,8 @@ class LoginController extends Controller
} }
} }
public function check (Request $request) { public function check(Request $request)
{
return response([ return response([
'data' => $request->session()->get('id') ? true : false 'data' => $request->session()->get('id') ? true : false
]); ]);

View File

@ -15,11 +15,13 @@ use App\Models\InviteCode;
class RegisterController extends Controller class RegisterController extends Controller
{ {
private function setTryOut () { 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)) {
abort(500, '本站已关闭注册'); abort(500, '本站已关闭注册');
} }

View File

@ -8,7 +8,8 @@ use App\Models\Plan;
class PlanController extends Controller class PlanController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
if ($request->input('id')) { if ($request->input('id')) {
$plan = Plan::where('id', $request->input('id')) $plan = Plan::where('id', $request->input('id'))
->first(); ->first();

View File

@ -1,12 +1,14 @@
<?php <?php
namespace App\Http\Controllers\Server; namespace App\Http\Controllers\Server;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller as BaseController; use App\Http\Controllers\Controller as BaseController;
class Controller extends BaseController class Controller extends BaseController
{ {
public function __construct(Request $request) { public function __construct(Request $request)
{
$token = $request->input('token'); $token = $request->input('token');
if (empty($token)) { if (empty($token)) {
abort(500, 'token is null'); abort(500, 'token is null');

View File

@ -14,8 +14,10 @@ use Cache;
class DeepbworkController extends Controller class DeepbworkController extends Controller
{ {
CONST SERVER_CONFIG = '{"api":{"services":["HandlerService","StatsService"],"tag":"api"},"stats":{},"inbound":{"port":443,"protocol":"vmess","settings":{"clients":[]},"streamSettings":{"network":"tcp"},"tag":"proxy"},"inboundDetour":[{"listen":"0.0.0.0","port":23333,"protocol":"dokodemo-door","settings":{"address":"0.0.0.0"},"tag":"api"}],"log":{"loglevel":"debug","access":"access.log","error":"error.log"},"outbound":{"protocol":"freedom","settings":{}},"routing":{"settings":{"rules":[{"inboundTag":["api"],"outboundTag":"api","type":"field"}]},"strategy":"rules"},"policy":{"levels":{"0":{"handshake":4,"connIdle":300,"uplinkOnly":5,"downlinkOnly":30,"statsUserUplink":true,"statsUserDownlink":true}}}}'; CONST SERVER_CONFIG = '{"api":{"services":["HandlerService","StatsService"],"tag":"api"},"stats":{},"inbound":{"port":443,"protocol":"vmess","settings":{"clients":[]},"streamSettings":{"network":"tcp"},"tag":"proxy"},"inboundDetour":[{"listen":"0.0.0.0","port":23333,"protocol":"dokodemo-door","settings":{"address":"0.0.0.0"},"tag":"api"}],"log":{"loglevel":"debug","access":"access.log","error":"error.log"},"outbound":{"protocol":"freedom","settings":{}},"routing":{"settings":{"rules":[{"inboundTag":["api"],"outboundTag":"api","type":"field"}]},"strategy":"rules"},"policy":{"levels":{"0":{"handshake":4,"connIdle":300,"uplinkOnly":5,"downlinkOnly":30,"statsUserUplink":true,"statsUserDownlink":true}}}}';
// 后端获取用户 // 后端获取用户
public function user (Request $request) { public function user(Request $request)
{
$nodeId = $request->input('node_id'); $nodeId = $request->input('node_id');
$server = Server::find($nodeId); $server = Server::find($nodeId);
if (!$server) { if (!$server) {
@ -56,24 +58,25 @@ class DeepbworkController extends Controller
} }
// 后端提交数据 // 后端提交数据
public function submit (Request $request) { public function submit(Request $request)
Log::info('serverSubmitData:' . $request->input('node_id') . ':' . file_get_contents('php://input')); {
Log::info('serverSubmitData:' . $request->input('node_id') . ':' . file_get_contents('php://input'));
$server = Server::find($request->input('node_id')); $server = Server::find($request->input('node_id'));
if (!$server) { if (!$server) {
return response([ return response([
'ret' => 1, 'ret' => 1,
'msg' => 'ok' 'msg' => 'ok'
]); ]);
} }
$data = file_get_contents('php://input'); $data = file_get_contents('php://input');
$data = json_decode($data, true); $data = json_decode($data, true);
foreach ($data as $item) { foreach ($data as $item) {
$u = $item['u'] * $server->rate; $u = $item['u'] * $server->rate;
$d = $item['d'] * $server->rate; $d = $item['d'] * $server->rate;
$user = User::find($item['user_id']); $user = User::find($item['user_id']);
$user->t = time(); $user->t = time();
$user->u = $user->u + $u; $user->u = $user->u + $u;
$user->d = $user->d + $d; $user->d = $user->d + $d;
$user->save(); $user->save();
$serverLog = new ServerLog(); $serverLog = new ServerLog();
@ -85,14 +88,15 @@ class DeepbworkController extends Controller
$serverLog->save(); $serverLog->save();
} }
return response([ return response([
'ret' => 1, 'ret' => 1,
'msg' => 'ok' 'msg' => 'ok'
]); ]);
} }
// 后端获取配置 // 后端获取配置
public function config (Request $request) { public function config(Request $request)
{
$nodeId = $request->input('node_id'); $nodeId = $request->input('node_id');
$localPort = $request->input('local_port'); $localPort = $request->input('local_port');
if (empty($nodeId) || empty($localPort)) { if (empty($nodeId) || empty($localPort)) {
@ -108,23 +112,29 @@ class DeepbworkController extends Controller
$json->inbound->streamSettings->network = $server->network; $json->inbound->streamSettings->network = $server->network;
if ($server->settings) { if ($server->settings) {
switch ($server->network) { switch ($server->network) {
case 'tcp': $json->inbound->streamSettings->tcpSettings = json_decode($server->settings); case 'tcp':
$json->inbound->streamSettings->tcpSettings = json_decode($server->settings);
break; break;
case 'kcp': $json->inbound->streamSettings->kcpSettings = json_decode($server->settings); case 'kcp':
$json->inbound->streamSettings->kcpSettings = json_decode($server->settings);
break; break;
case 'ws': $json->inbound->streamSettings->wsSettings = json_decode($server->settings); case 'ws':
$json->inbound->streamSettings->wsSettings = json_decode($server->settings);
break; break;
case 'http': $json->inbound->streamSettings->httpSettings = json_decode($server->settings); case 'http':
$json->inbound->streamSettings->httpSettings = json_decode($server->settings);
break; break;
case 'domainsocket': $json->inbound->streamSettings->dsSettings = json_decode($server->settings); case 'domainsocket':
$json->inbound->streamSettings->dsSettings = json_decode($server->settings);
break; break;
case 'quic': $json->inbound->streamSettings->quicSettings = json_decode($server->settings); case 'quic':
$json->inbound->streamSettings->quicSettings = json_decode($server->settings);
break; break;
} }
} }
if ((int)$server->tls) { if ((int)$server->tls) {
$json->inbound->streamSettings->security = "tls"; $json->inbound->streamSettings->security = "tls";
$tls = (object) array("certificateFile" => "/home/v2ray.crt", "keyFile" => "/home/v2ray.key"); $tls = (object)array("certificateFile" => "/home/v2ray.crt", "keyFile" => "/home/v2ray.key");
$json->inbound->streamSettings->tlsSettings->certificates[0] = $tls; $json->inbound->streamSettings->tlsSettings->certificates[0] = $tls;
} }

View File

@ -11,8 +11,10 @@ use App\Models\User;
use App\Utils\Helper; use App\Utils\Helper;
class ServerController extends Controller { class ServerController extends Controller
public function fetch (Request $request) { {
public function fetch(Request $request)
{
$user = User::find($request->session()->get('id')); $user = User::find($request->session()->get('id'));
$server = []; $server = [];
if ($user->expired_at > time()) { if ($user->expired_at > time()) {
@ -39,23 +41,27 @@ class ServerController extends Controller {
]); ]);
} }
public function logFetch (Request $request) { public function logFetch(Request $request)
$type = $request->input('type') ? $request->input('type') : 0; {
$type = $request->input('type') ? $request->input('type') : 0;
$current = $request->input('current') ? $request->input('current') : 1; $current = $request->input('current') ? $request->input('current') : 1;
$pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10; $pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10;
$serverLogModel = ServerLog::where('user_id', $request->session()->get('id')) $serverLogModel = ServerLog::where('user_id', $request->session()->get('id'))
->orderBy('created_at', 'DESC'); ->orderBy('created_at', 'DESC');
switch ($type) { switch ($type) {
case 0: $serverLogModel->where('created_at', '>=', strtotime(date('Y-m-d'))); case 0:
break; $serverLogModel->where('created_at', '>=', strtotime(date('Y-m-d')));
case 1: $serverLogModel->where('created_at', '>=', strtotime(date('Y-m-d')) - 604800); break;
break; case 1:
case 2: $serverLogModel->where('created_at', '>=', strtotime(date('Y-m-1'))); $serverLogModel->where('created_at', '>=', strtotime(date('Y-m-d')) - 604800);
} break;
$sum = [ case 2:
'u' => $serverLogModel->sum('u'), $serverLogModel->where('created_at', '>=', strtotime(date('Y-m-1')));
'd' => $serverLogModel->sum('d') }
]; $sum = [
'u' => $serverLogModel->sum('u'),
'd' => $serverLogModel->sum('d')
];
$total = $serverLogModel->count(); $total = $serverLogModel->count();
$res = $serverLogModel->forPage($current, $pageSize) $res = $serverLogModel->forPage($current, $pageSize)
->get(); ->get();

View File

@ -12,7 +12,8 @@ use Illuminate\Support\Facades\DB;
class TicketController extends Controller class TicketController extends Controller
{ {
public function fetch (Request $request) { public function fetch(Request $request)
{
if ($request->input('id')) { if ($request->input('id')) {
$ticket = Ticket::where('id', $request->input('id')) $ticket = Ticket::where('id', $request->input('id'))
->where('user_id', $request->session()->get('id')) ->where('user_id', $request->session()->get('id'))
@ -47,7 +48,8 @@ class TicketController extends Controller
]); ]);
} }
public function save (TicketSave $request) { public function save(TicketSave $request)
{
DB::beginTransaction(); DB::beginTransaction();
$ticket = Ticket::create(array_merge($request->only([ $ticket = Ticket::create(array_merge($request->only([
'subject', 'subject',
@ -75,7 +77,8 @@ class TicketController extends Controller
]); ]);
} }
public function reply (Request $request) { public function reply(Request $request)
{
if (empty($request->input('id'))) { if (empty($request->input('id'))) {
abort(500, '参数错误'); abort(500, '参数错误');
} }
@ -112,7 +115,8 @@ class TicketController extends Controller
} }
public function close (Request $request) { public function close(Request $request)
{
if (empty($request->input('id'))) { if (empty($request->input('id'))) {
abort(500, '参数错误'); abort(500, '参数错误');
} }
@ -131,7 +135,8 @@ class TicketController extends Controller
]); ]);
} }
private function getLastMessage ($ticketId) { private function getLastMessage($ticketId)
{
return TicketMessage::where('ticket_id', $ticketId) return TicketMessage::where('ticket_id', $ticketId)
->orderBy('id', 'DESC') ->orderBy('id', 'DESC')
->first(); ->first();

View File

@ -9,7 +9,8 @@ use App\Models\Tutorial;
class TutorialController extends Controller class TutorialController extends Controller
{ {
public function getSubscribeUrl (Request $request) { public function getSubscribeUrl(Request $request)
{
$user = User::find($request->session()->get('id')); $user = User::find($request->session()->get('id'));
return response([ return response([
'data' => [ 'data' => [
@ -18,7 +19,8 @@ class TutorialController extends Controller
]); ]);
} }
public function getAppleID (Request $request) { public function getAppleID(Request $request)
{
$user = User::find($request->session()->get('id')); $user = User::find($request->session()->get('id'));
if ($user->expired_at < time()) { if ($user->expired_at < time()) {
return response([ return response([
@ -34,7 +36,8 @@ class TutorialController extends Controller
]); ]);
} }
public function fetch (Request $request) { public function fetch(Request $request)
{
if ($request->input('id')) { if ($request->input('id')) {
$tutorial = Tutorial::where('show', 1) $tutorial = Tutorial::where('show', 1)
->where('id', $request->input('id')) ->where('id', $request->input('id'))
@ -57,14 +60,14 @@ class TutorialController extends Controller
'subscribe_url' => config('v2board.subscribe_url', config('v2board.app_url', env('APP_URL'))) . '/api/v1/client/subscribe?token=' . $user['token'], 'subscribe_url' => config('v2board.subscribe_url', config('v2board.app_url', env('APP_URL'))) . '/api/v1/client/subscribe?token=' . $user['token'],
'app_name' => config('v2board.app_name', 'V2board'), 'app_name' => config('v2board.app_name', 'V2board'),
'apple_id' => $user->expired_at > time() ? config('v2board.apple_id', '管理员暂无提供AppleID信息') : '账号过期或未订阅', 'apple_id' => $user->expired_at > time() ? config('v2board.apple_id', '管理员暂无提供AppleID信息') : '账号过期或未订阅',
'apple_id_password' => $user->expired_at > time() ? config('v2board.apple_id_password', '管理员暂无提供AppleID信息') : '账号过期或未订阅' 'apple_id_password' => $user->expired_at > time() ? config('v2board.apple_id_password', '管理员暂无提供AppleID信息') : '账号过期或未订阅'
] ]
] ]
]; ];
// fuck support shadowrocket urlsafeb64 subscribe // fuck support shadowrocket urlsafeb64 subscribe
$response['data']['safe_area_var']['b64_subscribe_url'] = str_replace( $response['data']['safe_area_var']['b64_subscribe_url'] = str_replace(
array('+','/','='), array('+', '/', '='),
array('-','_',''), array('-', '_', ''),
base64_encode($response['data']['safe_area_var']['subscribe_url']) base64_encode($response['data']['safe_area_var']['subscribe_url'])
); );
// end // end

View File

@ -15,13 +15,15 @@ use App\Models\ServerLog;
class UserController extends Controller class UserController extends Controller
{ {
public function logout (Request $request) { public function logout(Request $request)
{
return response([ return response([
'data' => $request->session()->flush() 'data' => $request->session()->flush()
]); ]);
} }
public function changePassword (Request $request) { public function changePassword(Request $request)
{
if (empty($request->input('old_password'))) { if (empty($request->input('old_password'))) {
abort(500, '旧密码不能为空'); abort(500, '旧密码不能为空');
} }
@ -42,7 +44,8 @@ class UserController extends Controller
]); ]);
} }
public function info (Request $request) { public function info(Request $request)
{
$user = User::where('id', $request->session()->get('id')) $user = User::where('id', $request->session()->get('id'))
->select([ ->select([
'email', 'email',
@ -65,7 +68,8 @@ class UserController extends Controller
]); ]);
} }
public function getStat (Request $request) { public function getStat(Request $request)
{
$stat = [ $stat = [
Order::where('status', 0) Order::where('status', 0)
->where('user_id', $request->session()->get('id')) ->where('user_id', $request->session()->get('id'))
@ -81,7 +85,8 @@ class UserController extends Controller
]); ]);
} }
public function getSubscribe (Request $request) { public function getSubscribe(Request $request)
{
$user = User::find($request->session()->get('id')); $user = User::find($request->session()->get('id'));
if ($user->plan_id) { if ($user->plan_id) {
$user['plan'] = Plan::find($user->plan_id); $user['plan'] = Plan::find($user->plan_id);
@ -95,7 +100,8 @@ class UserController extends Controller
]); ]);
} }
public function resetSecurity (Request $request) { public function resetSecurity(Request $request)
{
$user = User::find($request->session()->get('id')); $user = User::find($request->session()->get('id'));
$user->v2ray_uuid = Helper::guid(true); $user->v2ray_uuid = Helper::guid(true);
$user->token = Helper::guid(); $user->token = Helper::guid();
@ -107,7 +113,8 @@ class UserController extends Controller
]); ]);
} }
public function update (UserUpdate $request) { public function update(UserUpdate $request)
{
$updateData = $request->only([ $updateData = $request->only([
'remind_expire', 'remind_expire',
'remind_traffic' 'remind_traffic'

View File

@ -9,8 +9,8 @@ class Admin
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)

View File

@ -9,12 +9,12 @@ class Authenticate extends Middleware
/** /**
* Get the path the user should be redirected to when they are not authenticated. * Get the path the user should be redirected to when they are not authenticated.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return string * @return string
*/ */
protected function redirectTo($request) protected function redirectTo($request)
{ {
if (! $request->expectsJson()) { if (!$request->expectsJson()) {
return route('login'); return route('login');
} }
} }

View File

@ -9,9 +9,9 @@ class CORS
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
$origin = $request->header('origin'); $origin = $request->header('origin');
if(empty($origin)){ if (empty($origin)) {
$referer = $request->header('referer'); $referer = $request->header('referer');
if(!empty($referer)&&preg_match("/^((https|http):\/\/)?([^\/]+)/i", $referer, $matches)){ if (!empty($referer) && preg_match("/^((https|http):\/\/)?([^\/]+)/i", $referer, $matches)) {
$origin = $matches[0]; $origin = $matches[0];
} }
} }

View File

@ -10,8 +10,8 @@ class Client
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)

View File

@ -9,9 +9,9 @@ class ForceJson
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @param string|null $guard * @param string|null $guard
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next, $guard = null) public function handle($request, Closure $next, $guard = null)

View File

@ -10,9 +10,9 @@ class RedirectIfAuthenticated
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @param string|null $guard * @param string|null $guard
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next, $guard = null) public function handle($request, Closure $next, $guard = null)

View File

@ -10,8 +10,8 @@ class Server
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)

View File

@ -9,8 +9,8 @@ class User
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)

View File

@ -42,10 +42,12 @@ class ConfigSave extends FormRequest
'apple_id_password' => '' 'apple_id_password' => ''
]; ];
public static function filter() { public static function filter()
// abort(500, json_encode(array_keys(self::RULES))); {
// abort(500, json_encode(array_keys(self::RULES)));
return array_keys(self::RULES); return array_keys(self::RULES);
} }
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
* *

View File

@ -31,7 +31,7 @@ class ServerSave extends FormRequest
{ {
return [ return [
'name.required' => '节点名称不能为空', 'name.required' => '节点名称不能为空',
'group_id.required' => '权限组不能为空', 'group_id.required' => '权限组不能为空',
'group_id.array' => '权限组格式不正确', 'group_id.array' => '权限组格式不正确',
'parent_id.integer' => '父ID格式不正确', 'parent_id.integer' => '父ID格式不正确',
'host.required' => '节点地址不能为空', 'host.required' => '节点地址不能为空',

View File

@ -22,7 +22,7 @@ class CommSendEmailVerify extends FormRequest
{ {
return [ return [
'email.required' => '邮箱不能为空', 'email.required' => '邮箱不能为空',
'email.email' => '邮箱格式不正确' 'email.email' => '邮箱格式不正确'
]; ];
} }
} }

View File

@ -24,7 +24,7 @@ class ForgetIndex extends FormRequest
{ {
return [ return [
'email.required' => '邮箱不能为空', 'email.required' => '邮箱不能为空',
'email.email' => '邮箱格式不正确', 'email.email' => '邮箱格式不正确',
'password.required' => '密码不能为空', 'password.required' => '密码不能为空',
'password.min' => '密码必须大于8位数', 'password.min' => '密码必须大于8位数',
'email_code.required' => '邮箱验证码不能为空' 'email_code.required' => '邮箱验证码不能为空'

View File

@ -23,7 +23,7 @@ class LoginIndex extends FormRequest
{ {
return [ return [
'email.required' => '邮箱不能为空', 'email.required' => '邮箱不能为空',
'email.email' => '邮箱格式不正确', 'email.email' => '邮箱格式不正确',
'password.required' => '密码不能为空', 'password.required' => '密码不能为空',
'password.min' => '密码必须大于8位数' 'password.min' => '密码必须大于8位数'
]; ];

View File

@ -23,7 +23,7 @@ class RegisterIndex extends FormRequest
{ {
return [ return [
'email.required' => '邮箱不能为空', 'email.required' => '邮箱不能为空',
'email.email' => '邮箱格式不正确', 'email.email' => '邮箱格式不正确',
'password.required' => '密码不能为空', 'password.required' => '密码不能为空',
'password.min' => '密码必须大于8位数' 'password.min' => '密码必须大于8位数'
]; ];

View File

@ -14,6 +14,7 @@ class SendEmail implements ShouldQueue
{ {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $params; protected $params;
/** /**
* Create a new job instance. * Create a new job instance.
* *
@ -38,7 +39,7 @@ class SendEmail implements ShouldQueue
Mail::send( Mail::send(
$params['template_name'], $params['template_name'],
$params['template_value'], $params['template_value'],
function ($message) use($email, $subject) { function ($message) use ($email, $subject) {
$message->to($email)->subject($subject); $message->to($email)->subject($subject);
} }
); );

View File

@ -52,8 +52,8 @@ class RouteServiceProvider extends ServiceProvider
protected function mapWebRoutes() protected function mapWebRoutes()
{ {
Route::middleware('web') Route::middleware('web')
->namespace($this->namespace) ->namespace($this->namespace)
->group(base_path('routes/web.php')); ->group(base_path('routes/web.php'));
} }
/** /**
@ -66,8 +66,8 @@ class RouteServiceProvider extends ServiceProvider
protected function mapApiRoutes() protected function mapApiRoutes()
{ {
Route::prefix('api') Route::prefix('api')
->middleware('api') ->middleware('api')
->namespace($this->namespace) ->namespace($this->namespace)
->group(base_path('routes/api.php')); ->group(base_path('routes/api.php'));
} }
} }

8
app/Utils/CacheKey.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace App\Utils;
class CacheKey
{
}

View File

@ -4,7 +4,8 @@ namespace App\Utils;
class Helper class Helper
{ {
public static function guid ($format = false) { public static function guid($format = false)
{
if (function_exists('com_create_guid') === true) { if (function_exists('com_create_guid') === true) {
return md5(trim(com_create_guid(), '{}')); return md5(trim(com_create_guid(), '{}'));
} }
@ -14,16 +15,18 @@ class Helper
if ($format) { if ($format) {
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
} }
return md5(vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)).'-'.time()); return md5(vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . '-' . time());
} }
public static function exchange ($from, $to) { public static function exchange($from, $to)
{
$result = file_get_contents('https://api.exchangeratesapi.io/latest?symbols=' . $to . '&base=' . $from); $result = file_get_contents('https://api.exchangeratesapi.io/latest?symbols=' . $to . '&base=' . $from);
$result = json_decode($result, true); $result = json_decode($result, true);
return $result['rates'][$to]; return $result['rates'][$to];
} }
public static function randomChar($len, $special=false){ public static function randomChar($len, $special = false)
{
$chars = array( $chars = array(
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
@ -33,7 +36,7 @@ class Helper
"3", "4", "5", "6", "7", "8", "9" "3", "4", "5", "6", "7", "8", "9"
); );
if($special){ if ($special) {
$chars = array_merge($chars, array( $chars = array_merge($chars, array(
"!", "@", "#", "$", "?", "|", "{", "/", ":", ";", "!", "@", "#", "$", "?", "|", "{", "/", ":", ";",
"%", "^", "&", "*", "(", ")", "-", "_", "[", "]", "%", "^", "&", "*", "(", ")", "-", "_", "[", "]",
@ -44,31 +47,32 @@ class Helper
$charsLen = count($chars) - 1; $charsLen = count($chars) - 1;
shuffle($chars); shuffle($chars);
$str = ''; $str = '';
for($i=0; $i<$len; $i++){ for ($i = 0; $i < $len; $i++) {
$str .= $chars[mt_rand(0, $charsLen)]; $str .= $chars[mt_rand(0, $charsLen)];
} }
return $str; return $str;
} }
public static function buildVmessLink($item, $user) { public static function buildVmessLink($item, $user)
{
$config = [ $config = [
"v" => "2", "v" => "2",
"ps" => $item->name, "ps" => $item->name,
"add" => $item->host, "add" => $item->host,
"port" => $item->port, "port" => $item->port,
"id" => $user->v2ray_uuid, "id" => $user->v2ray_uuid,
"aid" => "2", "aid" => "2",
"net" => $item->network, "net" => $item->network,
"type" => "none", "type" => "none",
"host" => "", "host" => "",
"path" => "", "path" => "",
"tls" => $item->tls?"tls":"" "tls" => $item->tls ? "tls" : ""
]; ];
if ($item->network == 'ws') { if ($item->network == 'ws') {
$wsSettings = json_decode($item->settings); $wsSettings = json_decode($item->settings);
if (isset($wsSettings->path)) $config['path'] = $wsSettings->path; if (isset($wsSettings->path)) $config['path'] = $wsSettings->path;
if (isset($wsSettings->headers->Host)) $config['host'] = $wsSettings->headers->Host; if (isset($wsSettings->headers->Host)) $config['host'] = $wsSettings->headers->Host;
} }
return "vmess://".base64_encode(json_encode($config))."\r\n"; return "vmess://" . base64_encode(json_encode($config)) . "\r\n";
} }
} }

View File

@ -98,6 +98,6 @@ return [
| |
*/ */
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'),
]; ];

View File

@ -123,7 +123,7 @@ return [
'options' => [ 'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'), 'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
], ],
'default' => [ 'default' => [

View File

@ -51,7 +51,7 @@ return [
'public' => [ 'public' => [
'driver' => 'local', 'driver' => 'local',
'root' => storage_path('app/public'), 'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage', 'url' => env('APP_URL') . '/storage',
'visibility' => 'public', 'visibility' => 'public',
], ],

View File

@ -126,7 +126,7 @@ return [
'cookie' => env( 'cookie' => env(
'SESSION_COOKIE', 'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session' Str::slug(env('APP_NAME', 'laravel'), '_') . '_session'
), ),
/* /*

View File

@ -1,6 +1,7 @@
<?php <?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */ /** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\User; use App\User;
use Faker\Generator as Faker; use Faker\Generator as Faker;
use Illuminate\Support\Str; use Illuminate\Support\Str;

View File

@ -1,17 +1,21 @@
<?php <?php
namespace Library; namespace Library;
class BitpayX { class BitpayX
{
private $bitpayxAppSecret; private $bitpayxAppSecret;
private $bitpayxGatewayUri; private $bitpayxGatewayUri;
/** /**
* 签名初始化 * 签名初始化
* @param merKey 签名密钥 * @param merKey 签名密钥
*/ */
public function __construct($bitpayxAppSecret) { public function __construct($bitpayxAppSecret)
$this->bitpayxAppSecret = $bitpayxAppSecret; {
$this->bitpayxGatewayUri = 'https://api.mugglepay.com/v1/'; $this->bitpayxAppSecret = $bitpayxAppSecret;
} $this->bitpayxGatewayUri = 'https://api.mugglepay.com/v1/';
}
public function prepareSignId($tradeno) public function prepareSignId($tradeno)
{ {
@ -22,15 +26,18 @@ class BitpayX {
ksort($data_sign); ksort($data_sign);
return http_build_query($data_sign); return http_build_query($data_sign);
} }
public function sign($data) public function sign($data)
{ {
return strtolower(md5(md5($data) . $this->bitpayxAppSecret)); return strtolower(md5(md5($data) . $this->bitpayxAppSecret));
} }
public function verify($data, $signature) public function verify($data, $signature)
{ {
$mySign = $this->sign($data); $mySign = $this->sign($data);
return $mySign === $signature; return $mySign === $signature;
} }
public function mprequest($data) public function mprequest($data)
{ {
$headers = array('content-type: application/json', 'token: ' . $this->bitpayxAppSecret); $headers = array('content-type: application/json', 'token: ' . $this->bitpayxAppSecret);
@ -48,6 +55,7 @@ class BitpayX {
curl_close($curl); curl_close($curl);
return json_decode($data, true); return json_decode($data, true);
} }
public function mpcheckout($orderId, $data) public function mpcheckout($orderId, $data)
{ {
$headers = array('content-type: application/json', 'token: ' . $this->bitpayxAppSecret); $headers = array('content-type: application/json', 'token: ' . $this->bitpayxAppSecret);
@ -65,17 +73,21 @@ class BitpayX {
curl_close($curl); curl_close($curl);
return json_decode($data, true); return json_decode($data, true);
} }
public function refund($merchantTradeNo) {
public function refund($merchantTradeNo)
{
// TODO // TODO
return true; return true;
} }
public function buildHtml($params, $method = 'post', $target = '_self'){
public function buildHtml($params, $method = 'post', $target = '_self')
{
// var_dump($params);exit; // var_dump($params);exit;
$html = "<form id='submit' name='submit' action='".$this->gatewayUri."' method='$method' target='$target'>"; $html = "<form id='submit' name='submit' action='" . $this->gatewayUri . "' method='$method' target='$target'>";
foreach ($params as $key => $value) { foreach ($params as $key => $value) {
$html .= "<input type='hidden' name='$key' value='$value'/>"; $html .= "<input type='hidden' name='$key' value='$value'/>";
} }
$html .= "</form><script>document.forms['submit'].submit();</script>"; $html .= "</form><script>document.forms['submit'].submit();</script>";
return $html; return $html;
} }
} }

View File

@ -1,18 +1,22 @@
<?php <?php
namespace Library; namespace Library;
class TomatoPay { class TomatoPay
{
private $mchid; private $mchid;
private $account; private $account;
private $key; private $key;
public function __construct($mchid, $account, $key) { public function __construct($mchid, $account, $key)
{
$this->mchid = $mchid; $this->mchid = $mchid;
$this->account = $account; $this->account = $account;
$this->key = $key; $this->key = $key;
} }
public function alipay ($cny, $trade) { public function alipay($cny, $trade)
{
$params = [ $params = [
'mchid' => $this->mchid, 'mchid' => $this->mchid,
'account' => $this->account, 'account' => $this->account,
@ -24,7 +28,8 @@ class TomatoPay {
return $this->buildHtml('https://b.fanqieui.com/gateways/alipay.php', $params); return $this->buildHtml('https://b.fanqieui.com/gateways/alipay.php', $params);
} }
public function wxpay ($cny, $trade) { public function wxpay($cny, $trade)
{
$params = [ $params = [
'mchid' => $this->mchid, 'mchid' => $this->mchid,
'account' => $this->account, 'account' => $this->account,
@ -36,21 +41,23 @@ class TomatoPay {
return $this->buildHtml('https://b.fanqieui.com/gateways/wxpay.php', $params); return $this->buildHtml('https://b.fanqieui.com/gateways/wxpay.php', $params);
} }
public function sign ($params) { public function sign($params)
$o = ''; {
foreach ($params as $k=>$v){ $o = '';
$o.= "$k=".($v)."&"; foreach ($params as $k => $v) {
$o .= "$k=" . ($v) . "&";
} }
return md5(substr($o,0,-1).$this->key); return md5(substr($o, 0, -1) . $this->key);
} }
public function buildHtml($url, $params, $method = 'post', $target = '_self'){ public function buildHtml($url, $params, $method = 'post', $target = '_self')
// return var_dump($params); {
$html = "<form id='submit' name='submit' action='".$url."' method='$method' target='$target'>"; // return var_dump($params);
foreach ($params as $key => $value) { $html = "<form id='submit' name='submit' action='" . $url . "' method='$method' target='$target'>";
$html .= "<input type='hidden' name='$key' value='$value'/>"; foreach ($params as $key => $value) {
} $html .= "<input type='hidden' name='$key' value='$value'/>";
$html .= "</form><script>document.forms['submit'].submit();</script>"; }
return $html; $html .= "</form><script>document.forms['submit'].submit();</script>";
return $html;
} }
} }

View File

@ -21,7 +21,7 @@ define('LARAVEL_START', microtime(true));
| |
*/ */
require __DIR__.'/../vendor/autoload.php'; require __DIR__ . '/../vendor/autoload.php';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -35,7 +35,7 @@ require __DIR__.'/../vendor/autoload.php';
| |
*/ */
$app = require_once __DIR__.'/../bootstrap/app.php'; $app = require_once __DIR__ . '/../bootstrap/app.php';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -1,38 +1,42 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<link rel="stylesheet" href="./antd.chunk.css?v={{$verison}}"> <link rel="stylesheet" href="./antd.chunk.css?v={{$verison}}">
<link rel="stylesheet" href="./umi.css?v={{$verison}}"> <link rel="stylesheet" href="./umi.css?v={{$verison}}">
<link rel="stylesheet" href="./custom.css?v={{$verison}}"> <link rel="stylesheet" href="./custom.css?v={{$verison}}">
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
<title>{{$title}}</title> <title>{{$title}}</title>
<!-- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,400i,600,700"> --> <!-- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,400i,600,700"> -->
<script>window.routerBase = "/";</script> <script>window.routerBase = "/";</script>
<script> <script>
window.v2board = { window.v2board = {
title: '{{$title}}', title: '{{$title}}',
theme: '{{$theme}}', theme: '{{$theme}}',
verison: '{{$verison}}' verison: '{{$verison}}'
} }
</script> </script>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="./vendors.async.js?v={{$verison}}"></script> <script src="./vendors.async.js?v={{$verison}}"></script>
<script src="./antd.async.js?v={{$verison}}"></script> <script src="./antd.async.js?v={{$verison}}"></script>
<script src="./umi.js?v={{$verison}}"></script> <script src="./umi.js?v={{$verison}}"></script>
<!-- Global site tag (gtag.js) - Google Analytics --> <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-P1E9Z5LRRK"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=G-P1E9Z5LRRK"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-P1E9Z5LRRK'); function gtag() {
</script> dataLayer.push(arguments);
</body> }
gtag('js', new Date());
gtag('config', 'G-P1E9Z5LRRK');
</script>
</body>
</html> </html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -20,48 +20,48 @@ Route::prefix('v1')
->middleware('admin') ->middleware('admin')
->group(function () { ->group(function () {
// Config // Config
Route::get ('config/fetch', 'Admin\\ConfigController@fetch'); Route::get('config/fetch', 'Admin\\ConfigController@fetch');
Route::post('config/save', 'Admin\\ConfigController@save'); Route::post('config/save', 'Admin\\ConfigController@save');
// Plan // Plan
Route::get ('plan/fetch', 'Admin\\PlanController@fetch'); Route::get('plan/fetch', 'Admin\\PlanController@fetch');
Route::post('plan/save', 'Admin\\PlanController@save'); Route::post('plan/save', 'Admin\\PlanController@save');
Route::post('plan/drop', 'Admin\\PlanController@drop'); Route::post('plan/drop', 'Admin\\PlanController@drop');
Route::post('plan/update', 'Admin\\PlanController@update'); Route::post('plan/update', 'Admin\\PlanController@update');
// Server // Server
Route::get ('server/fetch', 'Admin\\ServerController@fetch'); Route::get('server/fetch', 'Admin\\ServerController@fetch');
Route::post('server/save', 'Admin\\ServerController@save'); Route::post('server/save', 'Admin\\ServerController@save');
Route::get ('server/group/fetch', 'Admin\\ServerController@groupFetch'); Route::get('server/group/fetch', 'Admin\\ServerController@groupFetch');
Route::post('server/group/save', 'Admin\\ServerController@groupSave'); Route::post('server/group/save', 'Admin\\ServerController@groupSave');
Route::post('server/group/drop', 'Admin\\ServerController@groupDrop'); Route::post('server/group/drop', 'Admin\\ServerController@groupDrop');
Route::post('server/drop', 'Admin\\ServerController@drop'); Route::post('server/drop', 'Admin\\ServerController@drop');
Route::post('server/update', 'Admin\\ServerController@update'); Route::post('server/update', 'Admin\\ServerController@update');
// Order // Order
Route::get ('order/fetch', 'Admin\\OrderController@fetch'); Route::get('order/fetch', 'Admin\\OrderController@fetch');
Route::post('order/repair', 'Admin\\OrderController@repair'); Route::post('order/repair', 'Admin\\OrderController@repair');
Route::post('order/update', 'Admin\\OrderController@update'); Route::post('order/update', 'Admin\\OrderController@update');
// User // User
Route::get ('user/fetch', 'Admin\\UserController@fetch'); Route::get('user/fetch', 'Admin\\UserController@fetch');
Route::post('user/update', 'Admin\\UserController@update'); Route::post('user/update', 'Admin\\UserController@update');
Route::get ('user/id2UserInfo/{id}', 'Admin\\UserController@id2UserInfo'); Route::get('user/id2UserInfo/{id}', 'Admin\\UserController@id2UserInfo');
// Stat // Stat
Route::get ('stat/getOverride', 'Admin\\StatController@getOverride'); Route::get('stat/getOverride', 'Admin\\StatController@getOverride');
// Notice // Notice
Route::get ('notice/fetch', 'Admin\\NoticeController@fetch'); Route::get('notice/fetch', 'Admin\\NoticeController@fetch');
Route::post('notice/save', 'Admin\\NoticeController@save'); Route::post('notice/save', 'Admin\\NoticeController@save');
Route::post('notice/update', 'Admin\\NoticeController@update'); Route::post('notice/update', 'Admin\\NoticeController@update');
Route::post('notice/drop', 'Admin\\NoticeController@drop'); Route::post('notice/drop', 'Admin\\NoticeController@drop');
// Ticket // Ticket
Route::get ('ticket/fetch', 'Admin\\TicketController@fetch'); Route::get('ticket/fetch', 'Admin\\TicketController@fetch');
Route::post('ticket/reply', 'Admin\\TicketController@reply'); Route::post('ticket/reply', 'Admin\\TicketController@reply');
Route::post('ticket/close', 'Admin\\TicketController@close'); Route::post('ticket/close', 'Admin\\TicketController@close');
// Mail // Mail
Route::post('mail/send', 'Admin\\MailController@send'); Route::post('mail/send', 'Admin\\MailController@send');
// Coupon // Coupon
Route::get ('coupon/fetch', 'Admin\\CouponController@fetch'); Route::get('coupon/fetch', 'Admin\\CouponController@fetch');
Route::post('coupon/save', 'Admin\\CouponController@save'); Route::post('coupon/save', 'Admin\\CouponController@save');
Route::post('coupon/drop', 'Admin\\CouponController@drop'); Route::post('coupon/drop', 'Admin\\CouponController@drop');
// Tutorial // Tutorial
Route::get ('tutorial/fetch', 'Admin\\TutorialController@fetch'); Route::get('tutorial/fetch', 'Admin\\TutorialController@fetch');
Route::post('tutorial/save', 'Admin\\TutorialController@save'); Route::post('tutorial/save', 'Admin\\TutorialController@save');
Route::post('tutorial/show', 'Admin\\TutorialController@show'); Route::post('tutorial/show', 'Admin\\TutorialController@show');
Route::post('tutorial/drop', 'Admin\\TutorialController@drop'); Route::post('tutorial/drop', 'Admin\\TutorialController@drop');
@ -71,41 +71,41 @@ Route::prefix('v1')
->middleware('user') ->middleware('user')
->group(function () { ->group(function () {
// User // User
Route::get ('resetSecurity', 'UserController@resetSecurity'); Route::get('resetSecurity', 'UserController@resetSecurity');
Route::get ('logout', 'UserController@logout'); Route::get('logout', 'UserController@logout');
Route::get ('info', 'UserController@info'); Route::get('info', 'UserController@info');
Route::post('changePassword', 'UserController@changePassword'); Route::post('changePassword', 'UserController@changePassword');
Route::post('update', 'UserController@update'); Route::post('update', 'UserController@update');
Route::get ('getSubscribe', 'UserController@getSubscribe'); Route::get('getSubscribe', 'UserController@getSubscribe');
Route::get ('getStat', 'UserController@getStat'); Route::get('getStat', 'UserController@getStat');
// Order // Order
Route::post('order/save', 'OrderController@save'); Route::post('order/save', 'OrderController@save');
Route::post('order/checkout', 'OrderController@checkout'); Route::post('order/checkout', 'OrderController@checkout');
Route::get ('order/check', 'OrderController@check'); Route::get('order/check', 'OrderController@check');
Route::get ('order/details', 'OrderController@details'); Route::get('order/details', 'OrderController@details');
Route::get ('order/fetch', 'OrderController@fetch'); Route::get('order/fetch', 'OrderController@fetch');
Route::get ('order/getPaymentMethod', 'OrderController@getPaymentMethod'); Route::get('order/getPaymentMethod', 'OrderController@getPaymentMethod');
Route::post('order/cancel', 'OrderController@cancel'); Route::post('order/cancel', 'OrderController@cancel');
// Plan // Plan
Route::get ('plan/fetch', 'PlanController@fetch'); Route::get('plan/fetch', 'PlanController@fetch');
// Invite // Invite
Route::get ('invite/save', 'InviteController@save'); Route::get('invite/save', 'InviteController@save');
Route::get ('invite/fetch', 'InviteController@fetch'); Route::get('invite/fetch', 'InviteController@fetch');
Route::get ('invite/details', 'InviteController@details'); Route::get('invite/details', 'InviteController@details');
// Tutorial // Tutorial
Route::get ('tutorial/getSubscribeUrl', 'TutorialController@getSubscribeUrl'); Route::get('tutorial/getSubscribeUrl', 'TutorialController@getSubscribeUrl');
Route::get ('tutorial/getAppleID', 'TutorialController@getAppleID'); Route::get('tutorial/getAppleID', 'TutorialController@getAppleID');
Route::get ('tutorial/fetch', 'TutorialController@fetch'); Route::get('tutorial/fetch', 'TutorialController@fetch');
// Notice // Notice
Route::get ('notice/fetch', 'NoticeController@fetch'); Route::get('notice/fetch', 'NoticeController@fetch');
// Ticket // Ticket
Route::post('ticket/reply', 'TicketController@reply'); Route::post('ticket/reply', 'TicketController@reply');
Route::post('ticket/close', 'TicketController@close'); Route::post('ticket/close', 'TicketController@close');
Route::post('ticket/save', 'TicketController@save'); Route::post('ticket/save', 'TicketController@save');
Route::get ('ticket/fetch', 'TicketController@fetch'); Route::get('ticket/fetch', 'TicketController@fetch');
// Server // Server
Route::get ('server/fetch', 'ServerController@fetch'); Route::get('server/fetch', 'ServerController@fetch');
Route::get ('server/log/fetch', 'ServerController@logFetch'); Route::get('server/log/fetch', 'ServerController@logFetch');
// Coupon // Coupon
Route::post('coupon/check', 'CouponController@check'); Route::post('coupon/check', 'CouponController@check');
}); });
@ -116,12 +116,12 @@ Route::prefix('v1')
// Register // Register
Route::post('register', 'Passport\\RegisterController@index'); Route::post('register', 'Passport\\RegisterController@index');
// Comm // Comm
Route::get ('config', 'Passport\\CommController@config'); Route::get('config', 'Passport\\CommController@config');
Route::post('sendEmailVerify', 'Passport\\CommController@sendEmailVerify'); Route::post('sendEmailVerify', 'Passport\\CommController@sendEmailVerify');
// Login // Login
Route::post('login', 'Passport\\LoginController@index'); Route::post('login', 'Passport\\LoginController@index');
Route::get ('token2Login', 'Passport\\LoginController@token2Login'); Route::get('token2Login', 'Passport\\LoginController@token2Login');
Route::get ('check', 'Passport\\LoginController@check'); Route::get('check', 'Passport\\LoginController@check');
// Forget // Forget
Route::post('forget', 'Passport\\ForgetController@index'); Route::post('forget', 'Passport\\ForgetController@index');
}); });
@ -129,7 +129,7 @@ Route::prefix('v1')
Route::prefix('guest') Route::prefix('guest')
->group(function () { ->group(function () {
// Plan // Plan
Route::get ('plan/fetch', 'Guest\\PlanController@fetch'); Route::get('plan/fetch', 'Guest\\PlanController@fetch');
// Order // Order
Route::post('order/alipayNotify', 'Guest\\OrderController@alipayNotify'); Route::post('order/alipayNotify', 'Guest\\OrderController@alipayNotify');
Route::post('order/stripeNotify', 'Guest\\OrderController@stripeNotify'); Route::post('order/stripeNotify', 'Guest\\OrderController@stripeNotify');
@ -140,17 +140,17 @@ Route::prefix('v1')
->middleware('client') ->middleware('client')
->group(function () { ->group(function () {
// Client // Client
Route::get ('subscribe', 'ClientController@subscribe'); Route::get('subscribe', 'ClientController@subscribe');
// App // App
Route::get ('app/data', 'AppController@data'); Route::get('app/data', 'AppController@data');
Route::get ('app/config', 'AppController@config'); Route::get('app/config', 'AppController@config');
}); });
// Server // Server
Route::prefix('server') Route::prefix('server')
->group(function () { ->group(function () {
// Deepbwork // Deepbwork
Route::get ('deepbwork/user', 'Server\\DeepbworkController@user'); Route::get('deepbwork/user', 'Server\\DeepbworkController@user');
Route::get ('deepbwork/config', 'Server\\DeepbworkController@config'); Route::get('deepbwork/config', 'Server\\DeepbworkController@config');
Route::post('deepbwork/submit', 'Server\\DeepbworkController@submit'); Route::post('deepbwork/submit', 'Server\\DeepbworkController@submit');
}); });
}); });

View File

@ -12,5 +12,5 @@
*/ */
Broadcast::channel('App.User.{id}', function ($user, $id) { Broadcast::channel('App.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id; return (int)$user->id === (int)$id;
}); });

View File

@ -1,5 +1,7 @@
<?php <?php
use Illuminate\Http\Request; use Illuminate\Http\Request;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Web Routes | Web Routes

View File

@ -14,8 +14,8 @@ $uri = urldecode(
// This file allows us to emulate Apache's "mod_rewrite" functionality from the // This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel // built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here. // application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { if ($uri !== '/' && file_exists(__DIR__ . '/public' . $uri)) {
return false; return false;
} }
require_once __DIR__.'/public/index.php'; require_once __DIR__ . '/public/index.php';

View File

@ -13,7 +13,7 @@ trait CreatesApplication
*/ */
public function createApplication() public function createApplication()
{ {
$app = require __DIR__.'/../bootstrap/app.php'; $app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap(); $app->make(Kernel::class)->bootstrap();