Commit 7ec8ca56 by lyh3024

fix

Change-Id: I8106ca0f193e1742300ea562a777c63b5e6e1c9e
parent ea5031cc
...@@ -11,6 +11,7 @@ def get_account(account, from_time, end_time): ...@@ -11,6 +11,7 @@ def get_account(account, from_time, end_time):
from_time = tools.from_str_to_time(from_time) from_time = tools.from_str_to_time(from_time)
end_time = tools.from_str_to_time(end_time) end_time = tools.from_str_to_time(end_time)
addresses = []
if account: if account:
if from_time: if from_time:
param = {"account": account, 'from_time': from_time.timestamp(), "end_time": end_time.timestamp()} param = {"account": account, 'from_time': from_time.timestamp(), "end_time": end_time.timestamp()}
...@@ -20,7 +21,8 @@ def get_account(account, from_time, end_time): ...@@ -20,7 +21,8 @@ def get_account(account, from_time, end_time):
addresses = [item[0] for item in items] addresses = [item[0] for item in items]
else: else:
node = Account.nodes.get_or_none(address=account) node = Account.nodes.get_or_none(address=account)
addresses = [node.address] if node:
addresses = [node.address]
else: else:
if from_time: if from_time:
param = {'from_time': from_time.timestamp(), "end_time": end_time.timestamp()} param = {'from_time': from_time.timestamp(), "end_time": end_time.timestamp()}
...@@ -132,10 +134,10 @@ def get_block_list(request): ...@@ -132,10 +134,10 @@ def get_block_list(request):
m_address, p, b_hash = item m_address, p, b_hash = item
m = Miner.nodes.get_or_none(address=m_address) m = Miner.nodes.get_or_none(address=m_address)
b = Block.nodes.get_or_none(hash=b_hash) b = Block.nodes.get_or_none(hash=b_hash)
if m.id not in node_ids: if m and m.id not in node_ids:
node_ids.append(m.id) node_ids.append(m.id)
resp_nodes.append(gen_node_json(m)) resp_nodes.append(gen_node_json(m))
if p.id not in rel_ids: if p and p.id not in rel_ids:
resp_relations.append({"id": p.id, "source": m.id, "target": b.id, "label": "打包"}) resp_relations.append({"id": p.id, "source": m.id, "target": b.id, "label": "打包"})
rel_ids.append(p.id) rel_ids.append(p.id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment