Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
platform
/
tx1_box_serv
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0b839908
authored
Dec 12, 2018
by
熊付
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
【新增登陆注册接口】
1 parent
cc1c2b35
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
code/tx1_box_serv/apps/api/http_serv.py
code/tx1_box_serv/apps/api/http_serv.pyc
code/tx1_box_serv/apps/main.py
code/tx1_box_serv/apps/api/http_serv.py
View file @
0b83990
...
@@ -24,7 +24,9 @@ def dataRecv():
...
@@ -24,7 +24,9 @@ def dataRecv():
return
data
return
data
@tx1_box.route
(
'/test'
,
methods
=
[
"GET"
])
@tx1_box.route
(
'/test'
,
methods
=
[
"GET"
])
def
test
():
def
test
():
return
"test"
print
'test'
print
database
.
get_value
()
return
"111"
# 给所有用户发送信息
# 给所有用户发送信息
def
send_all_data
(
sv
,
data
):
def
send_all_data
(
sv
,
data
):
if
sv
.
users
is
not
None
and
len
(
sv
.
users
)
>
0
:
if
sv
.
users
is
not
None
and
len
(
sv
.
users
)
>
0
:
...
...
code/tx1_box_serv/apps/api/http_serv.pyc
View file @
0b83990
No preview for this file type
code/tx1_box_serv/apps/main.py
View file @
0b83990
...
@@ -6,9 +6,10 @@ import threading
...
@@ -6,9 +6,10 @@ import threading
from
api.http_serv
import
tx1_box
from
api.http_serv
import
tx1_box
from
api.task
import
task
from
api.task
import
task
from
api.ws_serv
import
Server
from
api.ws_serv
import
Server
import
gbvar.ws_serv_global
as
sv_global
from
apps.api.login
import
login
import
gbvar.database_global
as
database
import
apps.gbvar.ws_serv_global
as
sv_global
import
gbvar.dict_properties
as
dict_p
import
apps.gbvar.database_global
as
database
import
apps.gbvar.dict_properties
as
dict_p
import
fdb
import
fdb
import
sys
import
sys
import
os
import
os
...
@@ -26,6 +27,9 @@ app.register_blueprint(tx1_box, url_prefix='/api/v1/tx1_box')
...
@@ -26,6 +27,9 @@ app.register_blueprint(tx1_box, url_prefix='/api/v1/tx1_box')
#注册task路由
#注册task路由
app
.
register_blueprint
(
task
,
url_prefix
=
'/api/v1/tx1_box/task'
)
app
.
register_blueprint
(
task
,
url_prefix
=
'/api/v1/tx1_box/task'
)
#注册login路由
app
.
register_blueprint
(
login
,
url_prefix
=
'/api/v1/tx1_box'
)
@app.route
(
'/'
,
methods
=
[
"GET"
])
@app.route
(
'/'
,
methods
=
[
"GET"
])
def
index
():
def
index
():
return
flask
.
send_file
(
"dist/index.html"
)
return
flask
.
send_file
(
"dist/index.html"
)
...
@@ -55,12 +59,12 @@ def init():
...
@@ -55,12 +59,12 @@ def init():
database
.
set_value
(
cur
)
database
.
set_value
(
cur
)
'''newLanguages = [
'''newLanguages = [
(
1, 'Dylan
')
(
2, 'Dylan3
')
]
]
cur.executemany ( "insert into tb_traffic(id,name) VALUES(?,?)",
cur.executemany ( "insert into tb_traffic(id,name) VALUES(?,?)",
newLanguages
newLanguages
)
)
con.commit ()
con.commit ()
'''
sql_select
=
'select * from tb_traffic'
sql_select
=
'select * from tb_traffic'
# 显示全部内容
# 显示全部内容
...
@@ -68,7 +72,7 @@ def init():
...
@@ -68,7 +72,7 @@ def init():
print
(
cur
.
fetchall
())
print
(
cur
.
fetchall
())
cur
.
close
()
cur
.
close
()
con.close ()
'''
con
.
close
()
####====================database===================
####====================database===================
#启动服务
#启动服务
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment