def insertUser(username, password): """ 注册验证 :param username: 用户输入的用户名 :param password: 用户输入的密码 :return: 返回注册结果 """ n_list = [] try: if username and password: uname = session.query(model.User.username).all() for i in uname: n_list += [i.username] if username in n_list: return 'fail' else: session.add(model.User(username=username, password=password)) session.commit() session.close() return 'success' else: return 'empty' except: return 'fail'
def addUser(username, password, xm, gender, qq, email, address, phone, tid): try: session.add( model.User(username=username, password=password, xm=xm, gender=gender, qq=qq, email=email, address=address, phone=phone, tid=tid)) session.commit() except Exception as e: print(e) finally: session.close()
def insertUser(username, password): result = session.add(model.User(username=username, password=password)) session.commit() session.close() print(result)
def insertUser(username, password): Session.add(model.User(name=username, password=password)) Session.commit() Session.close()
def insertUser(name, pwd): session.add(model.User(username=name, password=pwd)) session.commit() session.close()
def insertUser (username,password,email): result=session.add(mo.User(username=username,password=password,email=email)) session.commit() session.close()