all()); if($this->oldSignPass($request, $key) || $this->newSignPass($request, $key)) { return $next($request); } else { return response()->error('QAPP_SIGN_ERROR'); } } private function oldSignPass($request, $key) { $params = $request->except(['_url']); $timestamp = $request->post('timestamp', 0); $sign = $request->post('sign', ''); $backendSign = _sign($params, $key); // \Log::info('[CheckSign]旧版校验sign:', [ // 'front_sign' => $sign, // 'backend_sign' => $backendSign, // 'device_no' => $request->input('device_no', ''), // 'X-Version' => $request->header('X-Version', ''), // 'package' => $request->input('package', ''), // ]); if ($timestamp && time() - $timestamp <= (SysConsts::ONE_HOUR_SECONDS * 10) && $sign == $backendSign) { // \Log::info('[CheckSign]旧版校验通过'); return true; } else { // \Log::info('[CheckSign]旧版校验没有通过'); return false; } } private function newSignPass($request, $key) { $params = $request->except(['_url', 'device_info']); $timestamp = $request->post('timestamp', 0); $sign = $request->post('sign', ''); $backendSign = _sign($params, $key); // \Log::info('[CheckSign]新版校验sign:', [ // 'front_sign' => $sign, // 'backend_sign' => $backendSign, // 'device_no' => $request->input('device_no', ''), // 'X-Version' => $request->header('X-Version', ''), // 'package' => $request->input('package', ''), // ]); if ($timestamp && time() - $timestamp <= (SysConsts::ONE_HOUR_SECONDS * 10) && $sign == $backendSign) { // \Log::info('[CheckSign]新版校验通过'); return true; } else { // \Log::info('[CheckSign]新版校验没有通过'); return false; } } }