Skip to content

Commit

Permalink
修复get_visualization tm数据
Browse files Browse the repository at this point in the history
  • Loading branch information
60ke committed Feb 22, 2023
1 parent 47a26ef commit a11a291
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 28 deletions.
24 changes: 21 additions & 3 deletions app_views/views/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ def get_visualization(request):

try:
response = get_ranking()
# ["result"]["block"]["trust_nodes"]
if response:
rank_list = [
item['attestee'] for item in response['data']['dataScore']
item['ip'] for item in response["result"]["block"]["trust_nodes"]
]
ctx_list = response['data']['dataCtx']
# ctx_list = response['data']['dataCtx']
except Exception as e:
logger.error(e)

Expand Down Expand Up @@ -194,7 +195,24 @@ def get_visualization(request):
logger.error(e)
status = 'failure'
logger.error(traceback.format_exc())

# result['trias']['nodes'].append({
# "node_ip": "192.168.1.221",
# "status": 0,
# 'level': 1,
# 'trend': 0
# })
# result['trias']['nodes'].append({
# "node_ip": "192.168.1.222",
# "status": 1,
# 'level': 0,
# 'trend': 1
# })
# result['ethereum']['nodes'].append({
# "node_ip": "192.168.1.229",
# "status": 1,
# 'level': 1,
# 'trend': -1
# })
return JsonResponse({'status': status, 'result': result})


Expand Down
59 changes: 35 additions & 24 deletions conf/activity.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,74 @@
{
"name": "Hacker Attack 0",
"start": "12:16:50",
"ip": "106.3.133.178",
"ip": "192.169.1.225",
"type": 4
}, {
},
{
"name": "Power Outage 1",
"start": "12:20:00",
"ip": "106.3.133.178",
"ip": "192.169.1.225",
"type": 1
}, {
},
{
"name": "Power Outage 2",
"start": "13:20:00",
"ip": "106.3.133.178",
"ip": "192.169.1.225",
"type": 1
}, {
},
{
"name": "Power Outage 3",
"start": "14:30:00",
"ip": "106.3.133.178",
"ip": "192.169.1.225",
"type": 1
}, {
},
{
"name": "Power Outage 4",
"start": "14:40:00",
"ip": "106.3.133.178",
"ip": "192.169.1.225",
"type": 1
}, {
},
{
"name": "Power Outage 5",
"start": "15:09:00",
"ip": "106.3.133.178",
"ip": "192.169.1.225",
"type": 1
}, {
},
{
"name": "Hacker Attack 6",
"start": "15:15:00",
"ip": "106.3.133.178",
"ip": "192.169.1.225",
"type": 4
}, {
},
{
"name": "Power Outage 7",
"start": "15:20:00",
"ip": "106.3.133.178",
"ip": "192.169.1.225",
"type": 1
}, {
},
{
"name": "Power Outage 8",
"start": "15:25:00",
"ip": "106.3.133.178",
"ip": "192.169.1.225",
"type": 1
}, {
},
{
"name": "Power Outage 9",
"start": "17:55:00",
"ip": "106.3.133.178",
"ip": "192.169.1.225",
"type": 1
}, {
},
{
"name": "Power Outage 10",
"start": "18:49:00",
"ip": "106.3.133.178",
"ip": "192.169.1.225",
"type": 1
}, {
},
{
"name": "Power Outage 11",
"start": "19:13:00",
"ip": "106.3.133.178",
"ip": "192.169.1.225",
"type": 1
}
]
}
}
16 changes: 16 additions & 0 deletions conf/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
{
"ip": "192.169.1.225",
"port": "46657"
},
{
"ip": "192.169.1.216",
"port": "46657"
},
{
"ip": "192.169.1.219",
"port": "46657"
}
],
"server_port": "46657",
Expand Down Expand Up @@ -54,6 +62,14 @@
{
"ip": "192.169.1.225",
"port": "8545"
},
{
"ip": "192.169.1.216",
"port": "46657"
},
{
"ip": "192.169.1.219",
"port": "46657"
}
],
"server_port": "8545",
Expand Down
3 changes: 2 additions & 1 deletion conf/node_show.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"192.168.1.225": "192.168.1.223",
"192.168.1.223": "192.168.1.224",
"192.168.1.224": "192.168.1.225",
"192.168.1.226": "192.168.1.226"
"192.168.1.216": "192.168.1.216",
"192.168.1.219": "192.168.1.219"
}

0 comments on commit a11a291

Please sign in to comment.