升级框架及稳定依赖,修复路由、鉴权、种子、动态属性和 PHP 8.5 弃用问题。 固化 ThinkCaptcha 和 ORM 的 PHP 8.5 兼容补丁;Composer 安装会自动应用并由 patches.lock.json 锁定。 验证:45 条迁移、依赖校验与安全审计、验证码 PNG 响应及关键页面/API 回归通过。
35 lines
764 B
PHP
Executable File
35 lines
764 B
PHP
Executable File
<?php
|
|
declare (strict_types = 1);
|
|
|
|
namespace app\middleware;
|
|
|
|
class Online
|
|
{
|
|
/**
|
|
* 处理请求
|
|
*
|
|
* @param \think\Request $request
|
|
* @param \Closure $next
|
|
* @return Response
|
|
*/
|
|
public function handle($request, \Closure $next)
|
|
{
|
|
$weihu = config('shangma.weihu');
|
|
// 判断是否在线,如果不在线则跳转
|
|
$online = session('?onlineCategory');
|
|
if($online !=true or strlen(session('onlineCategory')) < 1)
|
|
{
|
|
return redirect('/login');
|
|
}
|
|
|
|
$user_id = session('user_id');
|
|
if($weihu == true && $user_id > 2)
|
|
{
|
|
session(null);
|
|
return redirect('/login/weihu');
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|