// +---------------------------------------------------------------------- namespace app\http\middleware\store; use app\Request; use app\services\store\LoginServices; use crmeb\exceptions\AuthException; use crmeb\interfaces\MiddlewareInterface; use crmeb\utils\ApiErrorCode; /** * 权限规则验证 * Class AdminCkeckRoleMiddleware * @package app\http\middleware */ class StoreCkeckRoleMiddleware implements MiddlewareInterface { public function handle(Request $request, \Closure $next) { if (!$request->storeId() || !$request->storeStaffInfo()) throw new AuthException(ApiErrorCode::ERR_ADMINID_VOID); if ($request->storeStaffInfo()['level']) { /** @var LoginServices $services */ $services = app()->make(LoginServices::class); $services->verifiAuth($request); } return $next($request); } }