first commit

This commit is contained in:
2026-04-15 20:16:52 +08:00
commit 8f45044411
1172 changed files with 329978 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
class CheckForMaintenanceMode extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}
+58
View File
@@ -0,0 +1,58 @@
<?php
namespace App\Http\Middleware;
use App\Models\BaseModel;
use Closure;
use Germey\Geetest\GeetestServiceProvider;
class DujiaoBoot
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// 安装检查
$installLock = base_path() . DIRECTORY_SEPARATOR . 'install.lock';
if (!file_exists($installLock)) {
return redirect(url('install'));
}
// 浏览器检测
$userAgent = $request->header('user-agent');
$nowUri = site_url() . $request->path();
$tplPath = 'common/notencent';
if (
(strpos($userAgent, 'QQ/')
||
strpos($userAgent, 'MicroMessenger') !== false)
&&
dujiaoka_config_get('is_open_anti_red', BaseModel::STATUS_OPEN) == BaseModel::STATUS_OPEN
) {
return response()->view($tplPath, ['nowUri' => $nowUri]);
}
// 语言检测
$lang = dujiaoka_config_get('language', 'zh_CN');
app()->setLocale($lang);
// 极验
$geetest = dujiaoka_config_get('is_open_geetest', BaseModel::STATUS_CLOSE);
if ($geetest == BaseModel::STATUS_OPEN) {
$geetestConfig = [
'key' => dujiaoka_config_get('geetest_key'),
'id' => dujiaoka_config_get('geetest_id'),
'lang' => $lang
];
// 覆盖 配置
config([
'geetest' => array_merge(config('mail'), $geetestConfig)
]);
// 重新注册服务
(new GeetestServiceProvider(app()))->register();
}
return $next($request);
}
}
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Http\Middleware;
use App\Providers\AppServiceProvider;
use Closure;
class DujiaoSystem
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// 检测https
if ($request->getScheme() == 'https') {
$httpsConfig = [
'https' => true
];
config([
'admin' => array_merge(config('admin'), $httpsConfig)
]);
(new AppServiceProvider(app()))->register();
}
return $next($request);
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Middleware;
use Closure;
class InstallCheck
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// 安装检查
$installLock = base_path() . DIRECTORY_SEPARATOR . 'install.lock';
if (file_exists($installLock)) {
return redirect(url('/'));
}
return $next($request);
}
}
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Middleware;
use Closure;
class PayGateWay
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
return $next($request);
}
}
@@ -0,0 +1,27 @@
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
return $next($request);
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',
];
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Http\Middleware;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
*
* @var bool
*/
protected $addHttpCookie = true;
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'pay/*',
];
}