bearerToken(); $result = decrypt($token); if (!$result) return $this->fail('验证失败,请重新登录', 2); $key = explode('-', $result); if (time() - $key[2] > 60480000) return $this->fail('请重新登录', 2); if ($key[0]) { $request->merchant_user_id = $key[0]; return $next($request); } } catch (\Exception $e) { return $this->fail('信息有误,请重新登录', 2); } return $next($request); } //接口返回失败 public function fail($msg, $code = 5, $path = '', $operate = '', $notice = '') { $result = [ 'code' => $code, 'path' => $path, 'message' => $msg, 'operate' => $operate, 'notice' => $notice, ]; return Response()->json($result); } }