这段代码是一个装饰器函数,它的作用是验证用户是否已经登录。如果用户没有登录,它会重定向到登录页面;如果用户已经登录,它会继续执行原来的函数。具体实现是通过获取请求中的cookie信息来判断用户是否已经登录。如果cookie中没有用户id信息,就认为用户没有登录。如果有用户id信息,就认为用户已经登录。

def check_loginfunc def wrapperrequest # print装饰器验证登录 cookie = requestCOOKIESgetuid if not cookie return redirectlogin else return funcrequest r