def get_transactions(request):
transactions = []
if "type" in request:
transactions.append(list(r.table('transactions').filter(
r.row['type'] == request['type']).run(conn)))
if "amount" in request:
transactions.append(list(r.table('transactions').filter(
r.row['amount'] == request['amount']).run(conn)))
if "bot" in request:
transactions.append(list(r.table('transactions').filter(
r.row['bot'] == request['bot']).run(conn)))
if "user" in request:
transactions.append(list(r.table('transactions').filter(
r.row['user'] == request['user']).run(conn)))
if "reason" in request:
transactions.append(list(r.table('transactions').filter(
r.row['reason'] == request['reason']).run(conn)))
if not "reason" or "user" or "bot" or "amount" or "type" in request:
transactions.append(list(r.table('transactions').run(conn)))
temp = []
for i in transactions:
if i not in temp:
temp.append(i)
transactions = temp
return transactions[:request['limit']]
评论列表
文章目录