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
4e0be554
Commit
4e0be554
authored
Jul 31, 2021
by
wanliofficial
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat(): 后端接口添加业务接口
parent
0cf50880
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1872 additions
and
7 deletions
+1872
-7
tools/build_out/hao.360.cn.json
tools/build_out/hao.360.cn.json
+1780
-0
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/openapi.py
tools/build_out/views/openapi.py
+12
-7
No files found.
tools/build_out/hao.360.cn.json
0 → 100644
View file @
4e0be554
This diff is collapsed.
Click to expand it.
tools/build_out/views/__init__.py
View file @
4e0be554
...
...
@@ -25,6 +25,7 @@ from . import monitorEvm
from
.
import
menu
from
.
import
file
from
.
import
openapi
from
.
import
business
api_v1
=
Blueprint
(
'api_v1'
,
__name__
)
...
...
@@ -65,6 +66,9 @@ api.add_resource(monitorImage.MonitorImageResourceList, '/monitorImage')
api
.
add_resource
(
monitorEvm
.
MonitorEvmResource
,
'/monitorEvm/<string:uuid>'
)
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
.
Batch
,
'/menu/delete/batch'
)
api
.
add_resource
(
menu
.
Create
,
'/menu/create'
)
...
...
tools/build_out/views/business.py
0 → 100644
View file @
4e0be554
#!/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/openapi.py
View file @
4e0be554
...
...
@@ -473,7 +473,7 @@ class AppListResource(Resource):
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"json"
,
required
=
False
)
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
,
location
=
"json"
,
required
=
False
)
args
=
self
.
parser
.
parse_args
()
...
...
@@ -493,7 +493,7 @@ class AppListResource(Resource):
t
=
item
.
to_dict
()
t
.
update
({
'download'
:
random
.
randint
(
1
,
1000
),
'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
)
# result = getListAppsSchema.dumps(result)
...
...
@@ -501,27 +501,32 @@ class AppListResource(Resource):
{
"uuid"
:
1
,
"img"
:
"music.png"
,
"title"
:
"音乐"
"title"
:
"音乐"
,
"url"
:
"http://store.evmiot.com/uploads/store/music.png"
},
{
"uuid"
:
2
,
"img"
:
"movie.png"
,
"title"
:
"视频"
"title"
:
"视频"
,
"url"
:
"http://store.evmiot.com/uploads/store/movie.png"
},
{
"uuid"
:
3
,
"img"
:
"camera.png"
,
"title"
:
"相机"
"title"
:
"相机"
,
"url"
:
"http://store.evmiot.com/uploads/store/camera.png"
},
{
"uuid"
:
4
,
"img"
:
"voice.png"
,
"title"
:
"语音"
"title"
:
"语音"
,
"url"
:
"http://store.evmiot.com/uploads/store/voice.png"
},
{
"uuid"
:
5
,
"img"
:
"tool.png"
,
"title"
:
"工具"
"title"
:
"工具"
,
"url"
:
"http://store.evmiot.com/uploads/store/tool.png"
}
]
...
...
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