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
b8e0d843
Commit
b8e0d843
authored
Jul 20, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat(后端接口): 应用商店手表端后端接口
parent
a1e2f038
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
87 additions
and
61 deletions
+87
-61
tools/build_out/application/signal_manager.py
tools/build_out/application/signal_manager.py
+3
-1
tools/build_out/controllers/__init__.py
tools/build_out/controllers/__init__.py
+2
-2
tools/build_out/controllers/api.py
tools/build_out/controllers/api.py
+18
-13
tools/build_out/models/app.py
tools/build_out/models/app.py
+12
-2
tools/build_out/result.json
tools/build_out/result.json
+1
-1
tools/build_out/views/__init__.py
tools/build_out/views/__init__.py
+6
-1
tools/build_out/views/app.py
tools/build_out/views/app.py
+1
-0
tools/build_out/views/openapi.py
tools/build_out/views/openapi.py
+32
-25
tools/frontend/src/views/Application/Form.vue
tools/frontend/src/views/Application/Form.vue
+9
-1
tools/frontend/src/views/Application/Index.vue
tools/frontend/src/views/Application/Index.vue
+3
-15
No files found.
tools/build_out/application/signal_manager.py
View file @
b8e0d843
'''
'''
Author: your name
Author: your name
Date: 2021-06-30 18:03:41
Date: 2021-06-30 18:03:41
LastEditTime: 2021-07-20
03:14:41
LastEditTime: 2021-07-20
10:23:06
LastEditors: Please set LastEditors
LastEditors: Please set LastEditors
Description: In User Settings Edit
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\a
pplication
\
signal_manager.py
FilePath:
\
evm-store
\t
ools
\b
uild_out
\a
pplication
\
signal_manager.py
...
@@ -67,6 +67,8 @@ class SignalManager(object):
...
@@ -67,6 +67,8 @@ class SignalManager(object):
actionPostAppReview
=
PySignal
()
actionPostAppReview
=
PySignal
()
actionGetLauncher
=
PySignal
()
actionGetLauncher
=
PySignal
()
actionSetLauncher
=
PySignal
()
actionSetLauncher
=
PySignal
()
actionGetApplication
=
PySignal
()
actionGetAppInfo
=
PySignal
()
actionGetAppList
=
PySignal
()
actionGetAppList
=
PySignal
()
actionGetEpk
=
PySignal
()
actionGetEpk
=
PySignal
()
actionApplicationBuild
=
PySignal
()
actionApplicationBuild
=
PySignal
()
...
...
tools/build_out/controllers/__init__.py
View file @
b8e0d843
'''
'''
Author: your name
Author: your name
Date: 2021-06-30 17:43:46
Date: 2021-06-30 17:43:46
LastEditTime: 2021-07-20
03:15:10
LastEditTime: 2021-07-20
10:23:19
LastEditors: Please set LastEditors
LastEditors: Please set LastEditors
Description: In User Settings Edit
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\
controllers
\
__init__.py
FilePath:
\
evm-store
\t
ools
\b
uild_out
\
controllers
\
__init__.py
...
@@ -84,5 +84,5 @@ def initConnect():
...
@@ -84,5 +84,5 @@ def initConnect():
signalManager
.
actionGetLauncher
.
connect
(
appReview
.
getLauncher
)
signalManager
.
actionGetLauncher
.
connect
(
appReview
.
getLauncher
)
signalManager
.
actionApplicationBuild
.
connect
(
buildAppResource
.
post
)
signalManager
.
actionApplicationBuild
.
connect
(
buildAppResource
.
post
)
signalManager
.
actionGetAppList
.
connect
(
appReview
.
getAppList
)
signalManager
.
actionGetAppList
.
connect
(
appReview
.
getAppList
)
signalManager
.
actionGetApp
.
connect
(
appReview
.
getApp
)
signalManager
.
actionGetApp
lication
.
connect
(
appReview
.
getApp
)
signalManager
.
actionGetEpk
.
connect
(
appReview
.
getDownloadFile
)
signalManager
.
actionGetEpk
.
connect
(
appReview
.
getDownloadFile
)
tools/build_out/controllers/api.py
View file @
b8e0d843
'''
'''
Author: your name
Author: your name
Date: 2021-07-12 11:14:48
Date: 2021-07-12 11:14:48
LastEditTime: 2021-07-20
03:14:03
LastEditTime: 2021-07-20
11:15:28
LastEditors: Please set LastEditors
LastEditors: Please set LastEditors
Description: In User Settings Edit
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\
controllers
\a
ppi.py
FilePath:
\
evm-store
\t
ools
\b
uild_out
\
controllers
\a
ppi.py
...
@@ -148,11 +148,12 @@ class AppReview(object):
...
@@ -148,11 +148,12 @@ class AppReview(object):
if
not
user
:
if
not
user
:
return
None
,
ResponseCode
.
USER_NOT_EXISTS
return
None
,
ResponseCode
.
USER_NOT_EXISTS
app
=
AppModel
.
query
.
filter
(
AppModel
.
launcher
==
"yes"
,
AppModel
.
create_
at
==
user
.
id
,
AppModel
.
is_delete
==
False
)
.
one_or_none
()
app
=
AppModel
.
query
.
filter
(
AppModel
.
launcher
==
"yes"
,
AppModel
.
create_
by
==
user
.
id
,
AppModel
.
is_delete
==
False
)
.
one_or_none
()
if
app
:
if
app
:
app
.
launcher
=
"no"
app
.
launcher
=
"no"
db
.
session
.
commit
()
db
.
session
.
commit
()
app
=
AppModel
.
query
.
filter
(
AppModel
.
uuid
==
params
.
get
(
"app"
),
AppModel
.
create_at
==
user
.
id
,
AppModel
.
is_delete
==
False
)
.
one_or_none
()
app
=
AppModel
.
query
.
filter
(
AppModel
.
uuid
==
params
.
get
(
"app"
),
AppModel
.
create_by
==
user
.
id
,
AppModel
.
is_delete
==
False
)
.
one_or_none
()
if
not
app
:
if
not
app
:
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
...
@@ -163,6 +164,7 @@ class AppReview(object):
...
@@ -163,6 +164,7 @@ class AppReview(object):
return
True
,
ResponseCode
.
HTTP_SUCCESS
return
True
,
ResponseCode
.
HTTP_SUCCESS
def
getApp
(
self
,
params
,
jwt
=
{}):
def
getApp
(
self
,
params
,
jwt
=
{}):
logger
.
info
(
166177188
)
app
=
AppModel
.
query
.
filter
(
AppModel
.
uuid
==
params
.
get
(
"uuid"
),
AppModel
.
is_delete
==
False
)
.
one_or_none
()
app
=
AppModel
.
query
.
filter
(
AppModel
.
uuid
==
params
.
get
(
"uuid"
),
AppModel
.
is_delete
==
False
)
.
one_or_none
()
if
not
app
:
if
not
app
:
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
...
@@ -186,10 +188,13 @@ class AppReview(object):
...
@@ -186,10 +188,13 @@ class AppReview(object):
def
getAppList
(
self
,
params
,
jwt
=
{}):
def
getAppList
(
self
,
params
,
jwt
=
{}):
filters
=
[
AppModel
.
is_delete
==
False
]
filters
=
[
AppModel
.
is_delete
==
False
]
logger
.
info
(
params
)
if
params
.
get
(
"review"
):
if
params
.
get
(
"review"
):
filters
.
append
(
AppModel
.
app_review
==
params
.
get
(
"review"
))
filters
.
append
(
AppModel
.
app_review
==
params
.
get
(
"review"
))
if
params
.
get
(
"category"
):
if
params
.
get
(
"category"
):
filters
.
append
(
AppModel
.
category
==
params
.
get
(
"category"
))
filters
.
append
(
AppModel
.
category
==
params
.
get
(
"category"
))
apps
=
AppModel
.
query
.
filter
(
*
filters
)
.
all
()
apps
=
AppModel
.
query
.
filter
(
*
filters
)
.
all
()
if
not
apps
:
if
not
apps
:
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
...
@@ -244,23 +249,23 @@ class AppReview(object):
...
@@ -244,23 +249,23 @@ class AppReview(object):
if
not
app
:
if
not
app
:
return
False
,
ResponseCode
.
APPLICATION_NOT_EXISTS
return
False
,
ResponseCode
.
APPLICATION_NOT_EXISTS
else
:
else
:
app
=
AppModel
.
query
.
filter
(
AppModel
.
app_name
==
params
.
get
(
"name"
))
.
order_by
(
AppModel
.
create_at
.
desc
()
)
app
s
=
AppModel
.
query
.
filter
(
AppModel
.
app_name
==
params
.
get
(
"name"
))
.
order_by
(
AppModel
.
create_at
.
desc
())
.
all
(
)
if
len
(
app
)
>
1
:
if
len
(
app
s
)
>
1
:
app
=
AppModel
.
query
.
filter
(
AppModel
.
app_name
==
params
.
get
(
"name"
))
.
order_by
(
AppModel
.
create_at
.
desc
())
.
one_or_none
()
app
=
AppModel
.
query
.
filter
(
AppModel
.
app_name
==
params
.
get
(
"name"
))
.
order_by
(
AppModel
.
create_at
.
desc
())
.
one_or_none
()
if
not
app
:
if
not
app
:
return
False
,
"app not found"
return
False
,
ResponseCode
.
APPLICATION_NOT_EXISTS
epk_path
=
Path
(
config
.
UPLOAD_ROOT_DIR
)
.
joinpath
(
app
.
download_url
)
epk_path
=
Path
(
config
.
UPLOAD_ROOT_DIR
)
.
joinpath
(
app
.
download_url
)
if
not
epk_path
.
exists
():
if
not
epk_path
.
exists
():
return
False
,
"epk file not found"
return
False
,
ResponseCode
.
HTTP_NOT_FOUND
pack
=
PackageModel
(
app
=
app
.
id
,
imei
=
params
.
get
(
"imei"
))
# pack = PackageModel(app=app.id, app_version=app.app_version
, imei=params.get("imei"))
db
.
session
.
ad
dd
(
pack
)
# db.session.a
dd(pack)
db
.
session
.
commit
()
#
db.session.commit()
if
pack
:
#
if pack:
update_download_information
(
params
.
get
(
'real_ip'
,
'127.0.0.1'
),
pack
.
id
)
#
update_download_information(params.get('real_ip', '127.0.0.1'), pack.id)
return
epk_path
,
"get dictionary {}."
.
format
(
"success"
if
epk_path
else
"no data"
)
return
epk_path
,
ResponseCode
.
HTTP_NOT_FOUND
appReview
=
AppReview
()
appReview
=
AppReview
()
\ No newline at end of file
tools/build_out/models/app.py
View file @
b8e0d843
...
@@ -18,12 +18,13 @@ class AppModel(PrimaryModel):
...
@@ -18,12 +18,13 @@ class AppModel(PrimaryModel):
app_screen_size
=
db
.
Column
(
db
.
String
(
20
),
nullable
=
False
)
app_screen_size
=
db
.
Column
(
db
.
String
(
20
),
nullable
=
False
)
app_arch
=
db
.
Column
(
db
.
String
(
20
),
nullable
=
False
,
default
=
''
)
app_arch
=
db
.
Column
(
db
.
String
(
20
),
nullable
=
False
,
default
=
''
)
app_review
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
,
default
=
0
)
app_review
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
,
default
=
0
)
meta_data
=
db
.
Column
(
db
.
String
(
256
),
nullable
=
True
)
# __table_args__ = (
# __table_args__ = (
# db.Index('idx_xxx', 'xxx', mysql_using='btree'),
# db.Index('idx_xxx', 'xxx', mysql_using='btree'),
# )
# )
def
__init__
(
self
,
app_name
,
app_icon
,
app_version
,
category
=
''
,
launcher
=
''
,
developer
=
0
,
download_url
=
''
,
app_file_size
=
0
,
app_screen_size
=
''
,
app_arch
=
''
,
app_review
=
0
,
create_by
=
None
,
create_at
=
None
,
update_by
=
None
,
update_at
=
None
,
remarks
=
""
):
def
__init__
(
self
,
app_name
,
app_icon
,
app_version
,
category
=
''
,
launcher
=
''
,
developer
=
0
,
download_url
=
''
,
meta_data
=
''
,
app_file_size
=
0
,
app_screen_size
=
''
,
app_arch
=
''
,
app_review
=
0
,
create_by
=
None
,
create_at
=
None
,
update_by
=
None
,
update_at
=
None
,
remarks
=
""
):
self
.
app_name
=
app_name
self
.
app_name
=
app_name
self
.
app_icon
=
app_icon
self
.
app_icon
=
app_icon
self
.
app_version
=
app_version
self
.
app_version
=
app_version
...
@@ -35,6 +36,7 @@ class AppModel(PrimaryModel):
...
@@ -35,6 +36,7 @@ class AppModel(PrimaryModel):
self
.
app_screen_size
=
app_screen_size
self
.
app_screen_size
=
app_screen_size
self
.
app_arch
=
app_arch
self
.
app_arch
=
app_arch
self
.
app_review
=
app_review
self
.
app_review
=
app_review
self
.
meta_data
=
meta_data
self
.
create_by
=
create_by
self
.
create_by
=
create_by
self
.
create_at
=
create_at
self
.
create_at
=
create_at
self
.
update_by
=
update_by
self
.
update_by
=
update_by
...
@@ -56,6 +58,7 @@ class AppModel(PrimaryModel):
...
@@ -56,6 +58,7 @@ class AppModel(PrimaryModel):
'app_file_size'
:
self
.
app_file_size
,
'app_file_size'
:
self
.
app_file_size
,
'app_screen_size'
:
self
.
app_screen_size
,
'app_screen_size'
:
self
.
app_screen_size
,
'app_arch'
:
self
.
app_arch
,
'app_arch'
:
self
.
app_arch
,
'meta_data'
:
self
.
meta_data
,
'app_review'
:
self
.
app_review
,
'app_review'
:
self
.
app_review
,
"create_by"
:
self
.
create_by
,
"create_by"
:
self
.
create_by
,
"update_by"
:
self
.
update_by
,
"update_by"
:
self
.
update_by
,
...
@@ -70,6 +73,7 @@ class PostAppSchema(ma.SQLAlchemySchema):
...
@@ -70,6 +73,7 @@ class PostAppSchema(ma.SQLAlchemySchema):
unknown
=
EXCLUDE
# 未知字段默认排除
unknown
=
EXCLUDE
# 未知字段默认排除
model
=
AppModel
model
=
AppModel
meta_data
=
fields
.
String
(
required
=
False
)
app_name
=
ma
.
auto_field
()
app_name
=
ma
.
auto_field
()
app_icon
=
fields
.
String
(
required
=
False
)
app_icon
=
fields
.
String
(
required
=
False
)
app_version
=
ma
.
auto_field
()
app_version
=
ma
.
auto_field
()
...
@@ -108,8 +112,9 @@ class GetListAppSchema(ma.SQLAlchemySchema):
...
@@ -108,8 +112,9 @@ class GetListAppSchema(ma.SQLAlchemySchema):
app_icon
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_icon
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_version
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_version
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
category
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
category
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
category_2t
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
launcher
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_arch
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_arch
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
meta_data
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
download_url
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
download_url
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_file_size
=
fields
.
Integer
(
required
=
False
,
nullable
=
True
)
app_file_size
=
fields
.
Integer
(
required
=
False
,
nullable
=
True
)
app_screen_size
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_screen_size
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
...
@@ -128,10 +133,15 @@ class GetAppSchema(ma.SQLAlchemySchema):
...
@@ -128,10 +133,15 @@ class GetAppSchema(ma.SQLAlchemySchema):
model
=
AppModel
model
=
AppModel
app_name
=
ma
.
auto_field
()
app_name
=
ma
.
auto_field
()
app_icon
=
ma
.
auto_field
()
app_version
=
ma
.
auto_field
()
app_version
=
ma
.
auto_field
()
category
=
ma
.
auto_field
()
category
=
ma
.
auto_field
()
launcher
=
ma
.
auto_field
()
launcher
=
ma
.
auto_field
()
app_arch
=
ma
.
auto_field
()
app_arch
=
ma
.
auto_field
()
download_url
=
ma
.
auto_field
()
app_file_size
=
ma
.
auto_field
()
app_screen_size
=
ma
.
auto_field
()
remarks
=
ma
.
auto_field
()
getAppSchema
=
GetAppSchema
()
getAppSchema
=
GetAppSchema
()
...
...
tools/build_out/result.json
View file @
b8e0d843
{
"directories"
:
[{
"basename"
:
"src"
,
"dirname"
:
"
\u
6d4b
\u
8bd58-1.0.8-6-20210717140706"
,
"path"
:
"
\u
6d4b
\u
8bd58-1.0.8-6-20210717140706/src"
,
"timestamp"
:
1626502026
,
"type"
:
"dir"
}],
"files"
:
[{
"basename"
:
"epk.json"
,
"dirname"
:
"
\u
6d4b
\u
8bd58-1.0.8-6-20210717140706"
,
"extension"
:
"json"
,
"filename"
:
"epk"
,
"path"
:
"
\u
6d4b
\u
8bd58-1.0.8-6-20210717140706/epk.json"
,
"size"
:
437
,
"timestamp"
:
1626502026
,
"type"
:
"file"
},
{
"basename"
:
"
\u
6d4b
\u
8bd58.epk"
,
"dirname"
:
"
\u
6d4b
\u
8bd58-1.0.8-6-20210717140706"
,
"extension"
:
"epk"
,
"filename"
:
"
\u
6d4b
\u
8bd58"
,
"path"
:
"
\u
6d4b
\u
8bd58-1.0.8-6-20210717140706/
\u
6d4b
\u
8bd58.epk"
,
"size"
:
2848
,
"timestamp"
:
1626502026
,
"type"
:
"file"
}]}
{
"directories"
:
[{
"basename"
:
"
\u
76f8
\u
518c-1.0.0-2-20210720111035"
,
"dirname"
:
"."
,
"path"
:
"
\u
76f8
\u
518c-1.0.0-2-20210720111035"
,
"timestamp"
:
1626750635
,
"type"
:
"dir"
}],
"files"
:
[]}
\ No newline at end of file
\ No newline at end of file
tools/build_out/views/__init__.py
View file @
b8e0d843
'''
'''
Author: your name
Author: your name
Date: 2021-07-15 03:22:19
Date: 2021-07-15 03:22:19
LastEditTime: 2021-07-
19 19:27:31
LastEditTime: 2021-07-
20 10:07:12
LastEditors: Please set LastEditors
LastEditors: Please set LastEditors
Description: In User Settings Edit
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\v
iews
\
__init__.py
FilePath:
\
evm-store
\t
ools
\b
uild_out
\v
iews
\
__init__.py
...
@@ -40,6 +40,11 @@ api.add_resource(app.AppResourceList, '/app')
...
@@ -40,6 +40,11 @@ api.add_resource(app.AppResourceList, '/app')
api
.
add_resource
(
openapi
.
AppReviewResource
,
'/api/app-review'
)
api
.
add_resource
(
openapi
.
AppReviewResource
,
'/api/app-review'
)
api
.
add_resource
(
openapi
.
CStringToolResource
,
'/api/convert-to-c-string'
)
api
.
add_resource
(
openapi
.
CStringToolResource
,
'/api/convert-to-c-string'
)
api
.
add_resource
(
openapi
.
BuildAppResource
,
'/evm_store/application/build'
)
api
.
add_resource
(
openapi
.
BuildAppResource
,
'/evm_store/application/build'
)
api
.
add_resource
(
openapi
.
App
,
'/api/app'
)
api
.
add_resource
(
openapi
.
AppInfo
,
'/api/app-info'
)
api
.
add_resource
(
openapi
.
LauncherResource
,
'/api/app-launcher'
)
api
.
add_resource
(
openapi
.
AppListResource
,
'/api/app-list'
)
api
.
add_resource
(
openapi
.
DownloadEpk
,
'/api/download-epk'
)
api
.
add_resource
(
package
.
PackageResource
,
'/package/<string:uuid>'
)
api
.
add_resource
(
package
.
PackageResource
,
'/package/<string:uuid>'
)
api
.
add_resource
(
package
.
PackageResourceList
,
'/package'
)
api
.
add_resource
(
package
.
PackageResourceList
,
'/package'
)
...
...
tools/build_out/views/app.py
View file @
b8e0d843
...
@@ -61,6 +61,7 @@ class AppResourceList(Resource):
...
@@ -61,6 +61,7 @@ class AppResourceList(Resource):
@
jwt_required
(
locations
=
[
"headers"
])
@
jwt_required
(
locations
=
[
"headers"
])
def
post
(
self
):
def
post
(
self
):
self
.
parser
.
add_argument
(
'User-Agent'
,
location
=
'headers'
)
self
.
parser
.
add_argument
(
'User-Agent'
,
location
=
'headers'
)
self
.
parser
.
add_argument
(
"meta_data"
,
type
=
str
,
location
=
"form"
,
required
=
True
)
self
.
parser
.
add_argument
(
"app_name"
,
type
=
str
,
location
=
"form"
,
required
=
True
)
self
.
parser
.
add_argument
(
"app_name"
,
type
=
str
,
location
=
"form"
,
required
=
True
)
self
.
parser
.
add_argument
(
"app_version"
,
type
=
str
,
location
=
"form"
,
required
=
True
)
self
.
parser
.
add_argument
(
"app_version"
,
type
=
str
,
location
=
"form"
,
required
=
True
)
self
.
parser
.
add_argument
(
"category"
,
type
=
str
,
location
=
"form"
,
required
=
True
)
self
.
parser
.
add_argument
(
"category"
,
type
=
str
,
location
=
"form"
,
required
=
True
)
...
...
tools/build_out/views/openapi.py
View file @
b8e0d843
'''
'''
Author: your name
Author: your name
Date: 2021-07-19 14:29:33
Date: 2021-07-19 14:29:33
LastEditTime: 2021-07-20
03:02:0
5
LastEditTime: 2021-07-20
11:35:4
5
LastEditors: Please set LastEditors
LastEditors: Please set LastEditors
Description: In User Settings Edit
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\v
iews
\a
pi.py
FilePath:
\
evm-store
\t
ools
\b
uild_out
\v
iews
\a
pi.py
...
@@ -10,10 +10,11 @@ FilePath: \evm-store\tools\build_out\views\api.py
...
@@ -10,10 +10,11 @@ FilePath: \evm-store\tools\build_out\views\api.py
# -*- coding: utf_8 -*-
# -*- coding: utf_8 -*-
import
os
import
os
import
random
import
traceback
import
traceback
from
pathlib
import
Path
from
pathlib
import
Path
from
datetime
import
datetime
from
datetime
import
datetime
from
flask
import
current_app
,
jsonify
,
request
from
flask
import
current_app
,
jsonify
,
request
,
Response
from
flask_restful
import
Resource
from
flask_restful
import
Resource
from
flask_restful.reqparse
import
RequestParser
from
flask_restful.reqparse
import
RequestParser
from
flask_jwt_extended
import
(
jwt_required
,
get_jwt_identity
)
from
flask_jwt_extended
import
(
jwt_required
,
get_jwt_identity
)
...
@@ -197,26 +198,23 @@ class LauncherResource(Resource):
...
@@ -197,26 +198,23 @@ class LauncherResource(Resource):
super
()
.
__init__
()
super
()
.
__init__
()
self
.
parser
=
RequestParser
()
self
.
parser
=
RequestParser
()
def
ge
t
(
self
):
def
pos
t
(
self
):
# self.parser.add_argument("page", type=int, location="args", default=1)
# self.parser.add_argument("page", type=int, location="args", default=1)
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
args
=
self
.
parser
.
parse_args
()
try
:
try
:
print
(
args
)
jwt
=
get_jwt_identity
()
data
=
dict
()
data
=
dict
()
for
key
,
value
in
args
.
items
():
for
key
,
value
in
args
.
items
():
if
value
!=
None
:
if
value
!=
None
:
data
[
key
]
=
value
data
[
key
]
=
value
result
,
message
=
signalManager
.
actionGetLauncher
.
emit
(
data
,
jwt
)
result
,
message
=
signalManager
.
actionGetLauncher
.
emit
(
data
)
if
result
:
if
result
:
ret
=
result
.
read_bytes
()
ret
=
result
.
read_bytes
()
# with open(result.as_posix(), "rb") as f:
# with open(result.
resolve().
as_posix(), "rb") as f:
# ret = f.read()
# ret = f.read()
# logger.info(type(ret))
return
Response
(
ret
,
mimetype
=
"text/html"
,
content_type
=
"text/html; charset=utf-8"
)
return
ret
return
response_result
(
message
,
data
=
result
)
return
response_result
(
message
,
data
=
result
)
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
)
...
@@ -233,24 +231,33 @@ class AppListResource(Resource):
...
@@ -233,24 +231,33 @@ class AppListResource(Resource):
super
()
.
__init__
()
super
()
.
__init__
()
self
.
parser
=
RequestParser
()
self
.
parser
=
RequestParser
()
def
get
(
self
):
def
post
(
self
):
# self.parser.add_argument("page", type=int, location="args", default=1)
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"json"
,
required
=
False
)
self
.
parser
.
add_argument
(
"category"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
self
.
parser
.
add_argument
(
"review"
,
type
=
int
,
location
=
"json"
,
required
=
False
)
self
.
parser
.
add_argument
(
"category"
,
type
=
str
,
location
=
"json"
,
required
=
False
)
args
=
self
.
parser
.
parse_args
()
args
=
self
.
parser
.
parse_args
()
try
:
try
:
print
(
args
)
data
=
dict
()
data
=
dict
()
for
key
,
value
in
args
.
items
():
for
key
,
value
in
args
.
items
():
if
value
!=
None
:
if
value
!=
None
:
data
[
key
]
=
value
data
[
key
]
=
value
result
,
message
=
signalManager
.
actionGetApp
.
emit
(
data
,
{})
dataList
=
None
result
,
message
=
signalManager
.
actionGetAppList
.
emit
(
data
)
if
result
:
if
result
:
result
=
getListAppsSchema
.
dumps
(
result
.
items
)
dataList
=
[]
return
response_result
(
message
,
data
=
result
)
# 遍历列表,添加一些额外信息
for
item
in
result
:
t
=
item
.
to_dict
()
t
.
update
({
'download'
:
random
.
randint
(
1
,
1000
),
'like'
:
random
.
randint
(
0
,
100
)
})
dataList
.
append
(
t
)
# result = getListAppsSchema.dumps(result)
return
response_result
(
message
,
data
=
dataList
)
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
...
@@ -265,23 +272,23 @@ class App(Resource):
...
@@ -265,23 +272,23 @@ class App(Resource):
def
get
(
self
):
def
get
(
self
):
# self.parser.add_argument("page", type=int, location="args", default=1)
# self.parser.add_argument("page", type=int, location="args", default=1)
self
.
parser
.
add_argument
(
"uuid"
,
type
=
str
,
location
=
"
json
"
,
required
=
True
)
self
.
parser
.
add_argument
(
"uuid"
,
type
=
str
,
location
=
"
args
"
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
args
=
self
.
parser
.
parse_args
()
try
:
try
:
print
(
args
)
data
=
dict
()
data
=
dict
()
for
key
,
value
in
args
.
items
():
for
key
,
value
in
args
.
items
():
if
value
!=
None
:
if
value
!=
None
:
data
[
key
]
=
value
data
[
key
]
=
value
result
,
message
=
signalManager
.
actionGetApp
.
emit
(
data
)
result
,
message
=
signalManager
.
actionGetApp
lication
.
emit
(
data
)
if
result
:
if
result
:
result
=
getAppSchema
.
dump
(
result
)
result
=
getAppSchema
.
dump
(
result
)
return
response_result
(
message
,
data
=
result
)
return
response_result
(
message
,
data
=
result
)
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
...
@@ -296,12 +303,11 @@ class AppInfo(Resource):
...
@@ -296,12 +303,11 @@ class AppInfo(Resource):
def
get
(
self
):
def
get
(
self
):
# self.parser.add_argument("page", type=int, location="args", default=1)
# self.parser.add_argument("page", type=int, location="args", default=1)
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"
json
"
,
required
=
True
)
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"
args
"
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
args
=
self
.
parser
.
parse_args
()
try
:
try
:
print
(
args
)
logger
.
info
(
args
)
return
response_result
(
ResponseCode
.
HTTP_SUCCESS
)
return
response_result
(
ResponseCode
.
HTTP_SUCCESS
)
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
)
...
@@ -318,7 +324,8 @@ class DownloadEpk(Resource):
...
@@ -318,7 +324,8 @@ class DownloadEpk(Resource):
super
()
.
__init__
()
super
()
.
__init__
()
self
.
parser
=
RequestParser
()
self
.
parser
=
RequestParser
()
def
get
(
self
):
def
post
(
self
):
self
.
parser
.
add_argument
(
"byId"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
self
.
parser
.
add_argument
(
"uuid"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
self
.
parser
.
add_argument
(
"uuid"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
args
=
self
.
parser
.
parse_args
()
...
@@ -331,7 +338,7 @@ class DownloadEpk(Resource):
...
@@ -331,7 +338,7 @@ class DownloadEpk(Resource):
data
[
key
]
=
value
data
[
key
]
=
value
data
.
update
({
'real_ip'
:
request
.
headers
.
get
(
'X-Forwarded-For'
,
'127.0.0.1'
)
})
data
.
update
({
'real_ip'
:
request
.
headers
.
get
(
'X-Forwarded-For'
,
'127.0.0.1'
)
})
result
,
message
=
signalManager
.
actionGet
Download
.
emit
(
data
)
result
,
message
=
signalManager
.
actionGet
Epk
.
emit
(
data
)
# 读取epk文件,按照格式返回相应结构体数据
# 读取epk文件,按照格式返回相应结构体数据
logger
.
info
(
data
)
logger
.
info
(
data
)
if
result
:
if
result
:
...
@@ -339,7 +346,7 @@ class DownloadEpk(Resource):
...
@@ -339,7 +346,7 @@ class DownloadEpk(Resource):
# with open(result.as_posix(), "rb") as f:
# with open(result.as_posix(), "rb") as f:
# ret = f.read()
# ret = f.read()
# logger.info(type(ret))
# logger.info(type(ret))
return
ret
return
Response
(
ret
,
content_type
=
"text/html; charset=utf-8"
)
return
response_result
(
message
,
data
=
result
)
return
response_result
(
message
,
data
=
result
)
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
)
...
...
tools/frontend/src/views/Application/Form.vue
View file @
b8e0d843
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
>
>
<a-radio-group
v-model=
"post.algorithm"
>
<a-radio-group
v-model=
"post.algorithm"
>
<a-radio-button
value=
"zlib"
>
zlib
</a-radio-button>
<a-radio-button
value=
"zlib"
>
zlib
</a-radio-button>
<a-radio-button
value=
"
eheatshrink"
>
e
heatshrink
</a-radio-button>
<a-radio-button
value=
"
heatshrink"
>
heatshrink
</a-radio-button>
</a-radio-group>
</a-radio-group>
</a-form-item>
</a-form-item>
<a-form-item
<a-form-item
...
@@ -98,6 +98,13 @@
...
@@ -98,6 +98,13 @@
>
>
<a-textarea
v-model=
"post.remarks"
rows=
"4"
placeholder=
"请输入应用介绍"
/>
<a-textarea
v-model=
"post.remarks"
rows=
"4"
placeholder=
"请输入应用介绍"
/>
</a-form-item>
</a-form-item>
<a-form-item
label=
"元信息"
:labelCol=
"
{ span: 7 }"
:wrapperCol="{ span: 10 }"
>
<a-textarea
v-model=
"post.meta_data"
rows=
"4"
placeholder=
"可以存储一些JSON格式应用元信息,接口获取"
/>
</a-form-item>
<a-form-item
<a-form-item
label=
"应用源文件"
label=
"应用源文件"
:labelCol=
"
{ span: 7 }"
:labelCol=
"
{ span: 7 }"
...
@@ -176,6 +183,7 @@ export default {
...
@@ -176,6 +183,7 @@ export default {
app_screen_size
:
null
,
app_screen_size
:
null
,
app_arch
:
null
,
app_arch
:
null
,
remarks
:
null
,
remarks
:
null
,
meta_data
:
null
,
logo
:
null
,
logo
:
null
,
fileList
:
[]
fileList
:
[]
},
},
...
...
tools/frontend/src/views/Application/Index.vue
View file @
b8e0d843
...
@@ -267,22 +267,10 @@
...
@@ -267,22 +267,10 @@
<a-col
:span=
"12"
>
</a-col>
<a-col
:span=
"12"
>
</a-col>
</a-row>
</a-row>
<a-divider
/>
<a-divider
/>
<p
:style=
"[sya]"
>
Contacts
</p>
<p
:style=
"[sya]"
>
应用元信息
</p>
<a-row>
<a-row>
<a-col
:span=
"6"
>
<a-col
:span=
"24"
>
<a-description-item
title=
"Email"
:content=
"record.email"
/>
<a-description-item
title=
"JSON"
:content=
"record.meta_data"
/>
</a-col>
<a-col
:span=
"6"
>
<a-description-item
title=
"Cell"
:content=
"record.cell"
/>
</a-col>
<a-col
:span=
"6"
>
<a-description-item
title=
"Phone"
:content=
"record.phone"
/>
</a-col>
<a-col
:span=
"6"
>
<a-description-item
title=
"Coordinates"
:content=
"record.latitude + ' ' + record.longitude"
/>
</a-col>
</a-col>
</a-row>
</a-row>
<a-row>
<a-row>
...
...
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