1234567891011121314151617181920212223242526 |
- <?php
- namespace app\http\middleware;
- use app\hander\HelpHander;
- use think\Db;
- class AuthDinner
- {
- public function handle($request, \Closure $next)
- {
- $token = $request->param('token');
- $userId = $request->param('userId');
- if(empty($token) || empty($userId)){
- HelpHander::error('登录信息已失效',100200);
- }
- // 检查用户是否被禁用
- $user = Db::name('dinner_user')->where('id',$userId)->where('token',$token)->find();
- if(!$user || $user['enable'] == 0 || $user['del'] == 1){
- HelpHander::error('登录信息已失效',100200);
- }
- return $next($request);
- }
- }
|