def login(input_name, input_pwd): user_dict = db_handler.check_usernam(input_name) pwd = comment.get_md(input_pwd) if pwd == user_dict["pwd"]: return True
def login(input_name,input_pwd): user_dict = db_handler.check_usernam(input_name) md = md5() md.update(b"shop") md.update(input_pwd.encode("utf-8")) input_pwd = md.hexdigest() if input_pwd == user_dict["pwd"]: return True
def save_shop_car(username,shop_car): user_dict = db_handler.check_usernam(username) old_shop_car = user_dict["shop_car"] for i,j in shop_car.items(): if old_shop_car.get(i): old_shop_car[i] += j else: old_shop_car[i] = j user_dict["shop_car"].update(old_shop_car) db_handler.save(user_dict)
def lock_inter(username): user_dict = db_handler.check_usernam(username) user_dict["lock"] = True db_handler.save(user_dict)
def chang_inter(username, balance): user_dict = db_handler.check_usernam(username) user_dict["balance"] = float(balance) db_handler.save(user_dict)
def unlock_inter(username): user_dict = db_handler.check_usernam(username) user_dict["lock"] = False db_handler.save(user_dict)
def check_lock(username): user_dict = db_handler.check_usernam(username) if user_dict["lock"]: return True
def check_flow_inter(username): user_dict = db_handler.check_usernam(username) flow = user_dict["flow"] return flow
def check_username(input_name): user_dict = db_handler.check_usernam(input_name) if user_dict: return True
def check_bal_inter(input_name): bal = db_handler.check_usernam(input_name)["balance"] return bal
def get_shop_car(username): user_dict = db_handler.check_usernam(username) shop_car = user_dict["shop_car"] return shop_car
def shop_pay(username,cost): pay_inter(username,cost) user_dict = db_handler.check_usernam(username) user_dict["shop_car"] = {} db_handler.save(user_dict)