request = Request::instance(); $header = config('apiBusiness.CROSS_DOMAIN'); $ApiAuth = $this->request->header('userId'); if ($ApiAuth) { $userInfo = cache('userinfo'.$ApiAuth); if (!$userInfo || !isset($userInfo['user_id'])) { $data = ['code' => ReturnCode::AUTH_ERROR, 'msg' => 'ApiAuth不匹配', 'data' => []]; return json($data, 200, $header); } } else { $data = ['code' => ReturnCode::AUTH_ERROR, 'msg' => '缺少ApiAuth', 'data' => []]; return json($data, 200, $header); } } }