<?php

namespace App\Http\Middleware;

use Closure;

class CheckToken
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {

        $wechat_id = $request->header("openid");
        if(!$wechat_id) {
            return Response()->json([
                "status" => -1,
                "error" => 403,
                "message" => "openid不能为空，请先登陆"
            ]);
        }
        return $next($request);
    }
}
