Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
evm-store
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanli
evm-store
Commits
45d223b9
Commit
45d223b9
authored
Aug 03, 2021
by
wanli
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' of
ssh://47.105.117.50:2224/wanli/evm-store
into release
parents
8d6a85a3
b1082fdb
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
2642 additions
and
115 deletions
+2642
-115
tools/build_out/application/config.py
tools/build_out/application/config.py
+0
-89
tools/build_out/controllers/api.py
tools/build_out/controllers/api.py
+2
-0
tools/build_out/hao.360.cn.json
tools/build_out/hao.360.cn.json
+2526
-0
tools/build_out/manager.py
tools/build_out/manager.py
+17
-18
tools/build_out/result.json
tools/build_out/result.json
+1
-1
tools/build_out/views/__init__.py
tools/build_out/views/__init__.py
+4
-0
tools/build_out/views/business.py
tools/build_out/views/business.py
+76
-0
tools/build_out/views/monitor.py
tools/build_out/views/monitor.py
+1
-0
tools/build_out/views/openapi.py
tools/build_out/views/openapi.py
+14
-7
tools/build_out/webcreator/response.py
tools/build_out/webcreator/response.py
+1
-0
No files found.
tools/build_out/application/config.py
deleted
100644 → 0
View file @
8d6a85a3
# -*- coding: utf-8 -*-
import
os
import
multiprocessing
MODE
=
'develop'
# develop: 开发模式; production: 生产模式
class
ProductionConfig
(
object
):
EPK_DIR
=
"D:
\\
projects
\\
scriptiot
\\
evm_app_store_files
\\
epks"
UPLOAD_ROOT_DIR
=
"D:
\\
projects
\\
scriptiot
\\
evm_app_store_files"
UPLOAD_ALLOWED
=
set
([
'doc'
,
'docs'
,
'csv'
,
'xls'
,
'xlsx'
])
BIND
=
'127.0.0.1:3001'
WORKERS
=
multiprocessing
.
cpu_count
()
*
2
+
1
WORKER_CONNECTIONS
=
10000
BACKLOG
=
64
TIMEOUT
=
60
LOG_LEVEL
=
'INFO'
LOG_DIR_PATH
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'logs'
)
LOG_FILE_MAX_BYTES
=
1024
*
1024
*
100
LOG_FILE_BACKUP_COUNT
=
10
PID_FILE
=
'run.pid'
REDIS_HOST
=
'127.0.0.1'
REDIS_PORT
=
6379
REDIS_PASSWORD
=
''
REDIS_MAX_CONNECTIONS
=
100
JWT_HEADER_NAME
=
'Authorization'
JWT_HEADER_TYPE
=
'Bearer'
JWT_SECRET_KEY
=
'6UdxRgs2hvWpTLmj027d5vt7dXXQX'
JWT_ACCESS_TOKEN_EXPIRES
=
7200
JWT_REFRESH_TOKEN_EXPIRES
=
1800
MYSQL_DB
=
'qianjing_iot'
MYSQL_HOST
=
'127.0.0.1'
MYSQL_PORT
=
3306
MYSQL_USER
=
'debian-sys-maint'
MYSQL_PWD
=
'XMigC2B2uugnv18y'
SQLALCHEMY_BINDS
=
{
'app-store'
:
'sqlite:///../test.db'
}
SQLALCHEMY_DATABASE_URI
=
'sqlite:///../test.db'
def
__init__
(
self
):
super
()
.
__init__
()
self
.
SQLALCHEMY_DATABASE_URI
=
'sqlite:///../test.db'
class
DevelopConfig
(
object
):
EPK_DIR
=
"D:
\\
projects
\\
scriptiot
\\
evm_app_store_files
\\
epks"
UPLOAD_ROOT_DIR
=
"D:
\\
projects
\\
scriptiot
\\
evm_app_store_files"
UPLOAD_ALLOWED
=
set
([
'doc'
,
'docs'
,
'csv'
,
'xls'
,
'xlsx'
])
BIND
=
'127.0.0.1:3001'
WORKERS
=
2
WORKER_CONNECTIONS
=
1000
BACKLOG
=
64
TIMEOUT
=
30
LOG_LEVEL
=
'DEBUG'
LOG_DIR_PATH
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'logs'
)
LOG_FILE_MAX_BYTES
=
1024
*
1024
LOG_FILE_BACKUP_COUNT
=
1
PID_FILE
=
'run.pid'
REDIS_HOST
=
'127.0.0.1'
REDIS_PORT
=
6379
REDIS_PASSWORD
=
''
REDIS_MAX_CONNECTIONS
=
100
JWT_HEADER_NAME
=
'Authorization'
JWT_HEADER_TYPE
=
'Bearer'
JWT_SECRET_KEY
=
'6UdxRgs2hvWpTLmj027d5vt7dXXQX'
JWT_ACCESS_TOKEN_EXPIRES
=
7200
JWT_REFRESH_TOKEN_EXPIRES
=
1800
MYSQL_DB
=
'qianjing_iot'
MYSQL_HOST
=
'127.0.0.1'
MYSQL_PORT
=
3306
MYSQL_USER
=
'debian-sys-maint'
MYSQL_PWD
=
'XMigC2B2uugnv18y'
SQLALCHEMY_BINDS
=
{
'app-store'
:
'sqlite:///../evue-store.db'
}
SQLALCHEMY_DATABASE_URI
=
'sqlite:///../evue-store.db'
SQLALCHEMY_TRACK_MODIFICATIONS
=
True
SQLALCHEMY_ECHO
=
False
def
__init__
(
self
):
super
()
.
__init__
()
self
.
SQLALCHEMY_DATABASE_URI
=
'sqlite:///../evue-store.db'
if
MODE
==
'production'
:
config
=
ProductionConfig
()
else
:
config
=
DevelopConfig
()
tools/build_out/controllers/api.py
View file @
45d223b9
...
@@ -200,6 +200,8 @@ class AppReview(object):
...
@@ -200,6 +200,8 @@ class AppReview(object):
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
# 根据app找到EPK文件,读取出二进制数据,返回
# 根据app找到EPK文件,读取出二进制数据,返回
if
not
app
.
download_url
or
len
(
app
.
download_url
)
==
0
:
return
None
,
ResponseCode
.
APPLICATION_URL_IS_NULL
target_file
=
Path
(
config
.
UPLOAD_ROOT_DIR
)
.
joinpath
(
app
.
download_url
)
target_file
=
Path
(
config
.
UPLOAD_ROOT_DIR
)
.
joinpath
(
app
.
download_url
)
if
not
target_file
.
exists
():
if
not
target_file
.
exists
():
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
...
...
tools/build_out/hao.360.cn.json
0 → 100644
View file @
45d223b9
This diff is collapsed.
Click to expand it.
tools/build_out/manager.py
View file @
45d223b9
'''
Author: your name
Date: 2021-07-15 09:33:39
LastEditTime: 2021-07-28 19:56:22
LastEditors: your name
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\
manager.py
'''
'''
Author: your name
Date: 2021-06-15 17:40:09
LastEditTime: 2021-06-30 18:09:51
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\r
esources
\
manager.py
'''
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from
tornado.wsgi
import
WSGIContainer
from
tornado.wsgi
import
WSGIContainer
from
tornado.httpserver
import
HTTPServer
from
tornado.httpserver
import
HTTPServer
from
tornado.web
import
Application
,
RequestHandler
,
FallbackHandler
from
tornado.ioloop
import
IOLoop
from
tornado.ioloop
import
IOLoop
from
flask_script
import
Manager
from
flask_script
import
Manager
from
flask_migrate
import
Migrate
from
flask_migrate
import
Migrate
from
application.app
import
create_app
,
db
from
application.app
import
create_app
,
db
from
application.config
import
config
from
application.config
import
config
from
views.monitor
import
DeviceMessageHandler
,
WatchHandler
,
NotifyHandler
# 根据配置初始化app
# 根据配置初始化app
app
=
create_app
(
config
)
app
=
create_app
(
config
)
...
@@ -38,7 +24,6 @@ def run():
...
@@ -38,7 +24,6 @@ def run():
To use: python3 manager.py run
To use: python3 manager.py run
"""
"""
# app.logger.setLevel(app.config.get('LOG_LEVEL', logging.INFO))
# app.logger.setLevel(app.config.get('LOG_LEVEL', logging.INFO))
http_server
=
HTTPServer
(
WSGIContainer
(
app
))
http_server
=
HTTPServer
(
WSGIContainer
(
app
))
http_server
.
listen
(
int
(
port
),
address
=
host
)
http_server
.
listen
(
int
(
port
),
address
=
host
)
IOLoop
.
instance
()
.
start
()
IOLoop
.
instance
()
.
start
()
...
@@ -49,8 +34,22 @@ def debug():
...
@@ -49,8 +34,22 @@ def debug():
debug模式启动命令函数
debug模式启动命令函数
To use: python3 manager.py debug
To use: python3 manager.py debug
"""
"""
wsgi_app
=
WSGIContainer
(
app
)
application
=
Application
([
(
r"/api/v1/evm_store/monitor"
,
DeviceMessageHandler
),
(
r"/api/v1/evm_store/watch"
,
WatchHandler
),
(
r"/ws/v1/notify"
,
NotifyHandler
),
(
r'.*'
,
FallbackHandler
,
dict
(
fallback
=
wsgi_app
))
])
application
.
listen
(
int
(
port
),
address
=
host
)
IOLoop
.
current
()
.
start
()
print
(
"WebSocket Service Started......"
)
# app.logger.setLevel(logging.DEBUG)
# app.logger.setLevel(logging.DEBUG)
app
.
run
(
debug
=
True
,
port
=
int
(
port
),
host
=
host
)
#
app.run(debug=True, port=int(port), host=host)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
manager
.
run
()
manager
.
run
()
tools/build_out/result.json
View file @
45d223b9
This diff is collapsed.
Click to expand it.
tools/build_out/views/__init__.py
View file @
45d223b9
...
@@ -25,6 +25,7 @@ from . import monitorEvm
...
@@ -25,6 +25,7 @@ from . import monitorEvm
from
.
import
menu
from
.
import
menu
from
.
import
file
from
.
import
file
from
.
import
openapi
from
.
import
openapi
from
.
import
business
api_v1
=
Blueprint
(
'api_v1'
,
__name__
)
api_v1
=
Blueprint
(
'api_v1'
,
__name__
)
...
@@ -65,6 +66,9 @@ api.add_resource(monitorImage.MonitorImageResourceList, '/monitorImage')
...
@@ -65,6 +66,9 @@ api.add_resource(monitorImage.MonitorImageResourceList, '/monitorImage')
api
.
add_resource
(
monitorEvm
.
MonitorEvmResource
,
'/monitorEvm/<string:uuid>'
)
api
.
add_resource
(
monitorEvm
.
MonitorEvmResource
,
'/monitorEvm/<string:uuid>'
)
api
.
add_resource
(
monitorEvm
.
MonitorEvmResourceList
,
'/monitorEvm'
)
api
.
add_resource
(
monitorEvm
.
MonitorEvmResourceList
,
'/monitorEvm'
)
api
.
add_resource
(
business
.
NavigationList
,
'/business/navigation'
)
api
.
add_resource
(
business
.
StoreResource
,
'/business/application'
)
api
.
add_resource
(
menu
.
MenuList
,
'/menu'
)
api
.
add_resource
(
menu
.
MenuList
,
'/menu'
)
api
.
add_resource
(
menu
.
Batch
,
'/menu/delete/batch'
)
api
.
add_resource
(
menu
.
Batch
,
'/menu/delete/batch'
)
api
.
add_resource
(
menu
.
Create
,
'/menu/create'
)
api
.
add_resource
(
menu
.
Create
,
'/menu/create'
)
...
...
tools/build_out/views/business.py
0 → 100644
View file @
45d223b9
#!/usr/bin/env python
# -*- coding: utf_8 -*-
import
json
from
pathlib
import
Path
from
flask
import
current_app
,
jsonify
,
request
from
flask_restful
import
Resource
from
flask_restful.reqparse
import
RequestParser
from
flask_jwt_extended
import
(
jwt_required
,
get_jwt_identity
)
from
application.signal_manager
import
signalManager
from
models.monitorEvm
import
getListMonitorEvmSchema
,
getListMonitorEvmsSchema
,
getMonitorEvmSchema
from
webcreator.log
import
logger
from
webcreator.response
import
ResponseCode
,
response_result
class
NavigationList
(
Resource
):
def
__init__
(
self
):
self
.
parser
=
RequestParser
()
def
get
(
self
):
self
.
parser
.
add_argument
(
"page"
,
type
=
int
,
location
=
"args"
,
default
=
1
,
required
=
False
)
self
.
parser
.
add_argument
(
"pageSize"
,
type
=
int
,
location
=
"args"
,
default
=
15
,
required
=
False
)
args
=
self
.
parser
.
parse_args
()
try
:
target_file
=
Path
(
__file__
)
.
parent
.
parent
.
joinpath
(
"hao.360.cn.json"
)
data
=
target_file
.
read_text
()
data
=
json
.
loads
(
data
)
return
response_result
(
ResponseCode
.
HTTP_SUCCESS
,
data
=
data
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
)
class
ApplicationResource
(
Resource
):
def
__init__
(
self
):
self
.
parser
=
RequestParser
()
def
get
(
self
,
uuid
):
self
.
parser
.
add_argument
(
"page"
,
type
=
int
,
location
=
"args"
,
default
=
1
)
self
.
parser
.
add_argument
(
"pageSize"
,
type
=
int
,
location
=
"args"
,
default
=
15
)
args
=
self
.
parser
.
parse_args
()
try
:
json_payload
=
request
.
json
print
(
"========>"
,
uuid
,
json_payload
)
data
=
getMonitorEvmSchema
.
load
(
json_payload
)
result
,
message
=
signalManager
.
actionGetMonitorEvm
.
emit
(
uuid
,
data
)
if
result
:
json_dumps
=
getMonitorEvmSchema
.
dump
(
result
)
return
response_result
(
message
,
data
=
json_dumps
)
return
response_result
(
message
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
)
class
StoreResource
(
Resource
):
def
__init__
(
self
):
self
.
parser
=
RequestParser
()
def
get
(
self
,
uuid
):
self
.
parser
.
add_argument
(
"page"
,
type
=
int
,
location
=
"args"
,
default
=
1
)
self
.
parser
.
add_argument
(
"pageSize"
,
type
=
int
,
location
=
"args"
,
default
=
15
)
args
=
self
.
parser
.
parse_args
()
try
:
json_payload
=
request
.
json
print
(
"========>"
,
uuid
,
json_payload
)
data
=
getMonitorEvmSchema
.
load
(
json_payload
)
result
,
message
=
signalManager
.
actionGetMonitorEvm
.
emit
(
uuid
,
data
)
if
result
:
json_dumps
=
getMonitorEvmSchema
.
dump
(
result
)
return
response_result
(
message
,
data
=
json_dumps
)
return
response_result
(
message
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
)
tools/build_out/views/monitor.py
View file @
45d223b9
...
@@ -354,3 +354,4 @@ if __name__ == "__main__":
...
@@ -354,3 +354,4 @@ if __name__ == "__main__":
signal
.
signal
(
signal
.
SIGTERM
,
raise_graceful_exit
)
signal
.
signal
(
signal
.
SIGTERM
,
raise_graceful_exit
)
tornado
.
ioloop
.
IOLoop
.
current
()
.
start
()
tornado
.
ioloop
.
IOLoop
.
current
()
.
start
()
print
(
"WebSocket Service Started......"
)
tools/build_out/views/openapi.py
View file @
45d223b9
...
@@ -440,6 +440,7 @@ class LauncherResource(Resource):
...
@@ -440,6 +440,7 @@ class LauncherResource(Resource):
result
,
message
=
signalManager
.
actionGetLauncher
.
emit
(
data
)
result
,
message
=
signalManager
.
actionGetLauncher
.
emit
(
data
)
if
result
:
if
result
:
logger
.
info
(
result
.
resolve
())
ret
=
result
.
read_bytes
()
ret
=
result
.
read_bytes
()
# with open(result.resolve().as_posix(), "rb") as f:
# with open(result.resolve().as_posix(), "rb") as f:
# ret = f.read()
# ret = f.read()
...
@@ -448,6 +449,7 @@ class LauncherResource(Resource):
...
@@ -448,6 +449,7 @@ class LauncherResource(Resource):
except
ValidationError
as
e
:
except
ValidationError
as
e
:
return
response_result
(
ResponseCode
.
HTTP_INVAILD_REQUEST
,
data
=
e
.
messages
)
return
response_result
(
ResponseCode
.
HTTP_INVAILD_REQUEST
,
data
=
e
.
messages
)
except
Exception
as
e
:
except
Exception
as
e
:
traceback
.
print_exc
()
data
=
None
data
=
None
if
hasattr
(
e
,
'args'
):
if
hasattr
(
e
,
'args'
):
data
=
e
.
args
data
=
e
.
args
...
@@ -471,7 +473,7 @@ class AppListResource(Resource):
...
@@ -471,7 +473,7 @@ class AppListResource(Resource):
self
.
parser
.
add_argument
(
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"json"
,
required
=
False
)
"imei"
,
type
=
str
,
location
=
"json"
,
required
=
False
)
self
.
parser
.
add_argument
(
self
.
parser
.
add_argument
(
"review"
,
type
=
int
,
location
=
"json"
,
required
=
False
)
"review"
,
type
=
int
,
location
=
"json"
,
default
=
1
,
required
=
False
)
self
.
parser
.
add_argument
(
"category"
,
type
=
str
,
self
.
parser
.
add_argument
(
"category"
,
type
=
str
,
location
=
"json"
,
required
=
False
)
location
=
"json"
,
required
=
False
)
args
=
self
.
parser
.
parse_args
()
args
=
self
.
parser
.
parse_args
()
...
@@ -491,7 +493,7 @@ class AppListResource(Resource):
...
@@ -491,7 +493,7 @@ class AppListResource(Resource):
t
=
item
.
to_dict
()
t
=
item
.
to_dict
()
t
.
update
({
'download'
:
random
.
randint
(
1
,
1000
),
t
.
update
({
'download'
:
random
.
randint
(
1
,
1000
),
'like'
:
random
.
randint
(
0
,
100
),
'like'
:
random
.
randint
(
0
,
100
),
'meta_data'
:
json
.
loads
(
item
.
meta_data
)})
'meta_data'
:
json
.
loads
(
item
.
meta_data
)
if
item
.
meta_data
else
None
})
dataList
.
append
(
t
)
dataList
.
append
(
t
)
# result = getListAppsSchema.dumps(result)
# result = getListAppsSchema.dumps(result)
...
@@ -499,27 +501,32 @@ class AppListResource(Resource):
...
@@ -499,27 +501,32 @@ class AppListResource(Resource):
{
{
"uuid"
:
1
,
"uuid"
:
1
,
"img"
:
"music.png"
,
"img"
:
"music.png"
,
"title"
:
"音乐"
"title"
:
"音乐"
,
"url"
:
"http://store.evmiot.com/uploads/store/music.png"
},
},
{
{
"uuid"
:
2
,
"uuid"
:
2
,
"img"
:
"movie.png"
,
"img"
:
"movie.png"
,
"title"
:
"视频"
"title"
:
"视频"
,
"url"
:
"http://store.evmiot.com/uploads/store/movie.png"
},
},
{
{
"uuid"
:
3
,
"uuid"
:
3
,
"img"
:
"camera.png"
,
"img"
:
"camera.png"
,
"title"
:
"相机"
"title"
:
"相机"
,
"url"
:
"http://store.evmiot.com/uploads/store/camera.png"
},
},
{
{
"uuid"
:
4
,
"uuid"
:
4
,
"img"
:
"voice.png"
,
"img"
:
"voice.png"
,
"title"
:
"语音"
"title"
:
"语音"
,
"url"
:
"http://store.evmiot.com/uploads/store/voice.png"
},
},
{
{
"uuid"
:
5
,
"uuid"
:
5
,
"img"
:
"tool.png"
,
"img"
:
"tool.png"
,
"title"
:
"工具"
"title"
:
"工具"
,
"url"
:
"http://store.evmiot.com/uploads/store/tool.png"
}
}
]
]
...
...
tools/build_out/webcreator/response.py
View file @
45d223b9
...
@@ -90,6 +90,7 @@ class ResponseCode(object):
...
@@ -90,6 +90,7 @@ class ResponseCode(object):
# 应用模块
# 应用模块
APPLICATION_NOT_EXISTS
=
(
3010001
,
'application not exists'
)
APPLICATION_NOT_EXISTS
=
(
3010001
,
'application not exists'
)
APPLICATION_EXISTS
=
(
3010002
,
'application already exists'
)
APPLICATION_EXISTS
=
(
3010002
,
'application already exists'
)
APPLICATION_URL_IS_NULL
=
(
3010003
,
'application url null'
)
# 文件管理模块
# 文件管理模块
FILE_NOT_EXISTS
=
(
3010001
,
'file not exists'
)
FILE_NOT_EXISTS
=
(
3010001
,
'file not exists'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment