-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
55 lines (41 loc) · 1.05 KB
/
app.py
File metadata and controls
55 lines (41 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# @Time : 2021-08-30 16:40
# @Author : 老赵
# @File : app.py
from flask import Flask, render_template, current_app
from lib.file import JsonFile
app = Flask(__name__)
@app.route('/')
def lottery():
jf = JsonFile({})
data = parse_data(jf.lucky_guys)
return render_template('index.html', data=data)
def parse_data(reward_dict):
index = 1
index2 = len(reward_dict)
res = []
for key, value in reward_dict.items():
res2 = []
tmp = {
'title': f'{key}',
'id': index,
'field': 'name1',
'checked': True,
'spread': True,
}
for i in value:
index2 += 1
tmp2 = {
'title': i,
'id': index2,
'field': '',
}
res2.append(tmp2)
tmp['children'] = res2
index += 1
res.append(tmp)
return res
@app.route('/favicon.ico')
def web_logo():
return current_app.send_static_file("favicon.ico")
if __name__ == '__main__':
app.run()