def check(self, username, email, password): # not null check if not username : result = {"errno" : -1, "err" : "用户名为空"} return result if not email : result = {"errno" : -1, "err" : "邮箱为空"} return result if not password : result = {"errno" : -1, "err" : "密码为空"} return result bl = AutoUser.checkUsername(username) if bl : result = {"errno" : -1, "err" : "用户名已被注册"} return result bl = self.validateEmail(email) if not bl: result = {"errno" : -1, "err" : "邮箱格式不正确"} return result bl = AutoUser.checkEmail(email) if bl : result = {"errno" : -1, "err" : "邮箱已被注册"} return result result = {"errno" : 1, "err" : "注册成功"} return result
def post(self): email = self.get_argument("email") bl = AutoUser.checkEmail(email) if bl : result = {"errno" : -1, "err" : "邮箱已被注册"} else : result = {"errno" : 1, "err" : ""} # return result self.write(result)