def query_restaurant(username): user = User() user = user.find_by_username(username) records, count = tasks.following_restaurant(user.id) restaurants = [record.to_dict() for record in records] return restaurants, count
def check_double_register(**kwargs): status = {} user = User() if 'username' in kwargs and user.find_by_username(kwargs['username']): return '該用戶名已被註冊過' if 'email' in kwargs and user.find_by_email(kwargs['email']): return '該信箱已註冊過' if 'cellphone' in kwargs and user.find_by_cellphone(kwargs['cellphone']): return '該手機號已註冊過'