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
a1e2f038
Commit
a1e2f038
authored
Jul 20, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat(后端接口): 后端增加相关数据接口
获取列表;打包EPK;下载EPK;获取单个应用详情信息。
parent
f92508d1
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
395 additions
and
19 deletions
+395
-19
tools/build_out/application/signal_manager.py
tools/build_out/application/signal_manager.py
+5
-1
tools/build_out/controllers/__init__.py
tools/build_out/controllers/__init__.py
+7
-1
tools/build_out/controllers/api.py
tools/build_out/controllers/api.py
+140
-1
tools/build_out/models/app.py
tools/build_out/models/app.py
+7
-7
tools/build_out/views/openapi.py
tools/build_out/views/openapi.py
+211
-2
tools/config.json
tools/config.json
+5
-5
tools/frontend/src/api/openapi.js
tools/frontend/src/api/openapi.js
+9
-1
tools/frontend/src/views/Application/Index.vue
tools/frontend/src/views/Application/Index.vue
+11
-1
No files found.
tools/build_out/application/signal_manager.py
View file @
a1e2f038
'''
'''
Author: your name
Author: your name
Date: 2021-06-30 18:03:41
Date: 2021-06-30 18:03:41
LastEditTime: 2021-07-
19 18:47:22
LastEditTime: 2021-07-
20 03:14:41
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
...
@@ -65,6 +65,10 @@ class SignalManager(object):
...
@@ -65,6 +65,10 @@ class SignalManager(object):
actionPostFilePaste
=
PySignal
()
actionPostFilePaste
=
PySignal
()
# api
# api
actionPostAppReview
=
PySignal
()
actionPostAppReview
=
PySignal
()
actionGetLauncher
=
PySignal
()
actionSetLauncher
=
PySignal
()
actionGetAppList
=
PySignal
()
actionGetEpk
=
PySignal
()
actionApplicationBuild
=
PySignal
()
actionApplicationBuild
=
PySignal
()
def
__init__
(
self
):
def
__init__
(
self
):
...
...
tools/build_out/controllers/__init__.py
View file @
a1e2f038
'''
'''
Author: your name
Author: your name
Date: 2021-06-30 17:43:46
Date: 2021-06-30 17:43:46
LastEditTime: 2021-07-
19 18:47:5
0
LastEditTime: 2021-07-
20 03:15:1
0
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
...
@@ -9,6 +9,7 @@ FilePath: \evm-store\tools\build_out\controllers\__init__.py
...
@@ -9,6 +9,7 @@ FilePath: \evm-store\tools\build_out\controllers\__init__.py
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf_8 -*-
# -*- coding: utf_8 -*-
from
signal
import
SIGABRT
from
application.signal_manager
import
signalManager
from
application.signal_manager
import
signalManager
from
.area
import
areaManager
from
.area
import
areaManager
from
.api
import
appReview
,
buildAppResource
from
.api
import
appReview
,
buildAppResource
...
@@ -79,4 +80,9 @@ def initConnect():
...
@@ -79,4 +80,9 @@ def initConnect():
signalManager
.
actionPostFilePaste
.
connect
(
fileManager
.
paste
)
signalManager
.
actionPostFilePaste
.
connect
(
fileManager
.
paste
)
# api
# api
signalManager
.
actionPostAppReview
.
connect
(
appReview
.
post
)
signalManager
.
actionPostAppReview
.
connect
(
appReview
.
post
)
signalManager
.
actionSetLauncher
.
connect
(
appReview
.
get
)
signalManager
.
actionGetLauncher
.
connect
(
appReview
.
getLauncher
)
signalManager
.
actionApplicationBuild
.
connect
(
buildAppResource
.
post
)
signalManager
.
actionApplicationBuild
.
connect
(
buildAppResource
.
post
)
signalManager
.
actionGetAppList
.
connect
(
appReview
.
getAppList
)
signalManager
.
actionGetApp
.
connect
(
appReview
.
getApp
)
signalManager
.
actionGetEpk
.
connect
(
appReview
.
getDownloadFile
)
tools/build_out/controllers/api.py
View file @
a1e2f038
'''
'''
Author: your name
Author: your name
Date: 2021-07-12 11:14:48
Date: 2021-07-12 11:14:48
LastEditTime: 2021-07-
19 19:25:09
LastEditTime: 2021-07-
20 03:14:03
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
...
@@ -12,16 +12,49 @@ import json
...
@@ -12,16 +12,49 @@ import json
import
shutil
import
shutil
from
pprint
import
pprint
from
pprint
import
pprint
from
pathlib
import
Path
from
pathlib
import
Path
import
urllib
from
datetime
import
datetime
from
datetime
import
datetime
from
urllib
import
parse
,
request
from
urllib.parse
import
urlparse
from
application.app
import
db
,
config
from
application.app
import
db
,
config
from
models.device
import
DeviceModel
from
models.annex
import
AnnexModel
from
models.annex
import
AnnexModel
from
models.app
import
AppModel
from
models.app
import
AppModel
from
models.user
import
UserModel
from
models.user
import
UserModel
from
models.package
import
PackageModel
from
models.package
import
PackageModel
from
webcreator.log
import
logger
from
webcreator.log
import
logger
from
webcreator.utils
import
ThreadMaker
from
webcreator.utils.epk
import
EpkApp
from
webcreator.utils.epk
import
EpkApp
from
webcreator.response
import
ResponseCode
from
webcreator.response
import
ResponseCode
@
ThreadMaker
def
update_download_information
(
ip
,
id
):
params
=
{
'ak'
:
'aZEAgYG8wKuLd6DS9BmCloGtfnGGkRMn'
,
'coor'
:
'bd09ll'
}
parameters
=
urllib
.
parse
.
urlencode
(
params
)
headers
=
{
'User-Agent'
:
'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko'
}
if
ip
!=
'127.0.0.1'
:
params
.
update
({
'ip'
:
ip
})
parameters
=
urllib
.
parse
.
urlencode
(
params
)
url
=
'http://api.map.baidu.com/location/ip'
req
=
request
.
Request
(
url
=
'
%
s
%
s
%
s'
%
(
url
,
'?'
,
parameters
),
headers
=
headers
)
ret
=
request
.
urlopen
(
req
)
.
read
()
jsonData
=
json
.
loads
(
ret
)
logger
.
info
(
jsonData
)
if
(
0
!=
jsonData
[
'status'
]):
return
None
pack
=
PackageModel
.
query
.
filter
(
PackageModel
.
id
==
id
)
.
one_or_none
()
if
pack
:
pack
.
address
=
jsonData
[
'address'
]
pack
.
ip
=
ip
pack
.
remarks
=
json
.
dumps
(
jsonData
[
'content'
],
ensure_ascii
=
False
)
db
.
session
.
commit
()
class
BuildAppResource
(
object
):
class
BuildAppResource
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
super
()
.
__init__
()
super
()
.
__init__
()
...
@@ -109,6 +142,60 @@ class AppReview(object):
...
@@ -109,6 +142,60 @@ class AppReview(object):
def
__init__
(
self
):
def
__init__
(
self
):
super
()
.
__init__
()
super
()
.
__init__
()
def
get
(
self
,
params
,
jwt
=
{}):
logger
.
info
(
params
)
user
=
UserModel
.
query
.
filter
(
UserModel
.
uuid
==
jwt
.
get
(
"uuid"
))
.
one_or_none
()
if
not
user
:
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
()
if
app
:
app
.
launcher
=
"no"
db
.
session
.
commit
()
app
=
AppModel
.
query
.
filter
(
AppModel
.
uuid
==
params
.
get
(
"app"
),
AppModel
.
create_at
==
user
.
id
,
AppModel
.
is_delete
==
False
)
.
one_or_none
()
if
not
app
:
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
app
.
launcher
=
"yes"
app
.
update_at
=
datetime
.
now
()
app
.
update_by
=
user
.
id
db
.
session
.
commit
()
return
True
,
ResponseCode
.
HTTP_SUCCESS
def
getApp
(
self
,
params
,
jwt
=
{}):
app
=
AppModel
.
query
.
filter
(
AppModel
.
uuid
==
params
.
get
(
"uuid"
),
AppModel
.
is_delete
==
False
)
.
one_or_none
()
if
not
app
:
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
return
app
,
ResponseCode
.
HTTP_SUCCESS
def
getLauncher
(
self
,
params
,
jwt
=
{}):
device
=
DeviceModel
.
query
.
filter
(
DeviceModel
.
imei
==
params
.
get
(
"imei"
),
AppModel
.
is_delete
==
False
)
.
one_or_none
()
if
not
device
:
return
None
,
ResponseCode
.
DEVICE_NOT_EXISTS
app
=
AppModel
.
query
.
filter
(
AppModel
.
launcher
==
"yes"
,
AppModel
.
create_by
==
device
.
create_by
,
AppModel
.
is_delete
==
False
)
.
one_or_none
()
if
not
app
:
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
# 根据app找到EPK文件,读取出二进制数据,返回
target_file
=
Path
(
config
.
UPLOAD_ROOT_DIR
)
.
joinpath
(
app
.
download_url
)
if
not
target_file
.
exists
():
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
return
target_file
,
ResponseCode
.
HTTP_SUCCESS
def
getAppList
(
self
,
params
,
jwt
=
{}):
filters
=
[
AppModel
.
is_delete
==
False
]
if
params
.
get
(
"review"
):
filters
.
append
(
AppModel
.
app_review
==
params
.
get
(
"review"
))
if
params
.
get
(
"category"
):
filters
.
append
(
AppModel
.
category
==
params
.
get
(
"category"
))
apps
=
AppModel
.
query
.
filter
(
*
filters
)
.
all
()
if
not
apps
:
return
None
,
ResponseCode
.
APPLICATION_NOT_EXISTS
return
apps
,
ResponseCode
.
HTTP_SUCCESS
def
post
(
self
,
app
,
review
,
jwt
=
{}):
def
post
(
self
,
app
,
review
,
jwt
=
{}):
user
=
UserModel
.
query
.
filter
(
UserModel
.
uuid
==
jwt
.
get
(
"uuid"
))
.
one_or_none
()
user
=
UserModel
.
query
.
filter
(
UserModel
.
uuid
==
jwt
.
get
(
"uuid"
))
.
one_or_none
()
if
not
user
:
if
not
user
:
...
@@ -124,4 +211,56 @@ class AppReview(object):
...
@@ -124,4 +211,56 @@ class AppReview(object):
db
.
session
.
commit
()
db
.
session
.
commit
()
return
True
,
ResponseCode
.
HTTP_SUCCESS
return
True
,
ResponseCode
.
HTTP_SUCCESS
def
getDownloadFile
(
self
,
params
,
jwt
=
{}):
# 流程如下:
# 获取前端传来的应用UUID和IMEI
# 根据应用UUID查找应用信息,找不到返回失败信息
# 如果应用ID是evue_launcher,则进行如下处理
# 遍历系统所有应用,将相关应用根据4个一组拼接到一个数组里面去
# 最后将这些信息导出为一个JSON文件
# 将evue_launcher.evue和evue_dock.evue以及相关资源文件进行打包
# 以上文件全部是复制处理,最后根据格式生成文件夹,将epk文件写入到这里
# 读取这个epk文件,以encoding='utf8'格式返回字节流
# 否则就是普通应用
# 查找出这个应用路径以及依赖文件
# 将这些文件进行打包
# 读取这个epk文件,以encoding='utf8'格式返回字节流
# 此次下载将生成一次下载记录
# 当前还没有校验前端传来的IMEI是否是合法的
# 根据IMEI查找设备,根据设备查找用户,根据用户查找应用
app
=
[]
# 根据IMEI查找设备
# device = Device.select().where(imei=data.get("imei")).first()
# logger.info(data)
# if not device:
# return False, "device not found"
# if not device.create_by:
# return False, "create user is null"
if
params
.
get
(
"byId"
):
# 通过id下载应用
app
=
AppModel
.
query
.
filter
(
AppModel
.
uuid
==
params
.
get
(
"uuid"
))
.
one_or_none
()
if
not
app
:
return
False
,
ResponseCode
.
APPLICATION_NOT_EXISTS
else
:
app
=
AppModel
.
query
.
filter
(
AppModel
.
app_name
==
params
.
get
(
"name"
))
.
order_by
(
AppModel
.
create_at
.
desc
())
if
len
(
app
)
>
1
:
app
=
AppModel
.
query
.
filter
(
AppModel
.
app_name
==
params
.
get
(
"name"
))
.
order_by
(
AppModel
.
create_at
.
desc
())
.
one_or_none
()
if
not
app
:
return
False
,
"app not found"
epk_path
=
Path
(
config
.
UPLOAD_ROOT_DIR
)
.
joinpath
(
app
.
download_url
)
if
not
epk_path
.
exists
():
return
False
,
"epk file not found"
pack
=
PackageModel
(
app
=
app
.
id
,
imei
=
params
.
get
(
"imei"
))
db
.
session
.
addd
(
pack
)
db
.
session
.
commit
()
if
pack
:
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"
)
appReview
=
AppReview
()
appReview
=
AppReview
()
\ No newline at end of file
tools/build_out/models/app.py
View file @
a1e2f038
...
@@ -11,7 +11,7 @@ class AppModel(PrimaryModel):
...
@@ -11,7 +11,7 @@ class AppModel(PrimaryModel):
app_icon
=
db
.
Column
(
db
.
String
(
200
),
nullable
=
False
)
app_icon
=
db
.
Column
(
db
.
String
(
200
),
nullable
=
False
)
app_version
=
db
.
Column
(
db
.
String
(
20
),
nullable
=
False
)
app_version
=
db
.
Column
(
db
.
String
(
20
),
nullable
=
False
)
category
=
db
.
Column
(
db
.
String
(
50
),
nullable
=
False
)
category
=
db
.
Column
(
db
.
String
(
50
),
nullable
=
False
)
category_2th
=
db
.
Column
(
db
.
String
(
50
),
nullable
=
False
)
launcher
=
db
.
Column
(
db
.
String
(
50
),
nullable
=
False
)
developer
=
db
.
Column
(
db
.
String
(
50
),
nullable
=
False
)
developer
=
db
.
Column
(
db
.
String
(
50
),
nullable
=
False
)
download_url
=
db
.
Column
(
db
.
String
(
200
),
nullable
=
False
,
default
=
''
)
download_url
=
db
.
Column
(
db
.
String
(
200
),
nullable
=
False
,
default
=
''
)
app_file_size
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
)
app_file_size
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
)
...
@@ -23,12 +23,12 @@ class AppModel(PrimaryModel):
...
@@ -23,12 +23,12 @@ class AppModel(PrimaryModel):
# 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
=
''
,
category_2th
=
''
,
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
=
''
,
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
self
.
category
=
category
self
.
category
=
category
self
.
category_2th
=
category_2th
self
.
launcher
=
launcher
self
.
developer
=
developer
self
.
developer
=
developer
self
.
download_url
=
download_url
self
.
download_url
=
download_url
self
.
app_file_size
=
app_file_size
self
.
app_file_size
=
app_file_size
...
@@ -50,7 +50,7 @@ class AppModel(PrimaryModel):
...
@@ -50,7 +50,7 @@ class AppModel(PrimaryModel):
'app_icon'
:
self
.
app_icon
,
'app_icon'
:
self
.
app_icon
,
'app_version'
:
self
.
app_version
,
'app_version'
:
self
.
app_version
,
'category'
:
self
.
category
,
'category'
:
self
.
category
,
'
category_2th'
:
self
.
category_2th
,
'
launcher'
:
self
.
launcher
,
'developer'
:
self
.
developer
,
'developer'
:
self
.
developer
,
'download_url'
:
self
.
download_url
,
'download_url'
:
self
.
download_url
,
'app_file_size'
:
self
.
app_file_size
,
'app_file_size'
:
self
.
app_file_size
,
...
@@ -74,7 +74,7 @@ class PostAppSchema(ma.SQLAlchemySchema):
...
@@ -74,7 +74,7 @@ class PostAppSchema(ma.SQLAlchemySchema):
app_icon
=
fields
.
String
(
required
=
False
)
app_icon
=
fields
.
String
(
required
=
False
)
app_version
=
ma
.
auto_field
()
app_version
=
ma
.
auto_field
()
category
=
ma
.
auto_field
()
category
=
ma
.
auto_field
()
category_2th
=
fields
.
String
(
required
=
False
)
launcher
=
fields
.
String
(
required
=
False
)
developer
=
fields
.
String
(
required
=
False
)
developer
=
fields
.
String
(
required
=
False
)
app_screen_size
=
ma
.
auto_field
()
app_screen_size
=
ma
.
auto_field
()
app_arch
=
ma
.
auto_field
()
app_arch
=
ma
.
auto_field
()
...
@@ -130,7 +130,7 @@ class GetAppSchema(ma.SQLAlchemySchema):
...
@@ -130,7 +130,7 @@ class GetAppSchema(ma.SQLAlchemySchema):
app_name
=
ma
.
auto_field
()
app_name
=
ma
.
auto_field
()
app_version
=
ma
.
auto_field
()
app_version
=
ma
.
auto_field
()
category
=
ma
.
auto_field
()
category
=
ma
.
auto_field
()
category_2th
=
ma
.
auto_field
()
launcher
=
ma
.
auto_field
()
app_arch
=
ma
.
auto_field
()
app_arch
=
ma
.
auto_field
()
getAppSchema
=
GetAppSchema
()
getAppSchema
=
GetAppSchema
()
...
@@ -148,6 +148,6 @@ class PutAppSchema(ma.SQLAlchemySchema):
...
@@ -148,6 +148,6 @@ class PutAppSchema(ma.SQLAlchemySchema):
app_arch
=
ma
.
auto_field
()
app_arch
=
ma
.
auto_field
()
app_review
=
ma
.
auto_field
()
app_review
=
ma
.
auto_field
()
category
=
ma
.
auto_field
()
category
=
ma
.
auto_field
()
category_2th
=
ma
.
auto_field
()
launcher
=
ma
.
auto_field
()
putAppSchema
=
PutAppSchema
()
putAppSchema
=
PutAppSchema
()
tools/build_out/views/openapi.py
View file @
a1e2f038
'''
'''
Author: your name
Author: your name
Date: 2021-07-19 14:29:33
Date: 2021-07-19 14:29:33
LastEditTime: 2021-07-
19 19:27:21
LastEditTime: 2021-07-
20 03:02:05
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
...
@@ -22,15 +22,42 @@ from werkzeug.datastructures import FileStorage
...
@@ -22,15 +22,42 @@ from werkzeug.datastructures import FileStorage
from
marshmallow.exceptions
import
ValidationError
from
marshmallow.exceptions
import
ValidationError
from
application.config
import
config
from
application.config
import
config
from
application.signal_manager
import
signalManager
from
application.signal_manager
import
signalManager
from
models.app
import
postAppSchema
,
deleteAppSchema
,
getListAppSchema
,
getListAppsSchema
,
getAppSchema
from
webcreator.log
import
logger
from
webcreator.log
import
logger
from
webcreator.utils.ccode
import
convert_string
from
webcreator.utils.ccode
import
convert_string
from
webcreator.response
import
ResponseCode
,
response_result
from
webcreator.response
import
ResponseCode
,
response_result
class
AppReviewResource
(
Resource
):
class
AppReviewResource
(
Resource
):
def
__init__
(
self
):
def
__init__
(
self
):
# 特殊参数,即不是从json获取参数的接口,可以将这个注释打开
self
.
parser
=
RequestParser
()
self
.
parser
=
RequestParser
()
# 设置启动器接口
@
jwt_required
(
locations
=
[
"headers"
])
def
get
(
self
):
self
.
parser
.
add_argument
(
"app"
,
type
=
str
,
location
=
"args"
,
required
=
False
)
args
=
self
.
parser
.
parse_args
()
try
:
data
=
dict
()
for
key
,
value
in
args
.
items
():
if
value
!=
None
:
data
[
key
]
=
value
jwt
=
get_jwt_identity
()
result
,
message
=
signalManager
.
actionSetLauncher
.
emit
(
data
,
jwt
)
if
result
:
return
response_result
(
message
,
data
=
result
)
return
response_result
(
message
)
except
ValidationError
as
e
:
return
response_result
(
ResponseCode
.
HTTP_INVAILD_REQUEST
,
data
=
e
.
messages
)
except
Exception
as
e
:
data
=
None
if
hasattr
(
e
,
'args'
):
data
=
e
.
args
traceback
.
print_exc
()
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
@
jwt_required
(
locations
=
[
"headers"
])
@
jwt_required
(
locations
=
[
"headers"
])
def
post
(
self
):
def
post
(
self
):
self
.
parser
.
add_argument
(
"review"
,
type
=
int
,
location
=
"json"
,
default
=
0
,
required
=
True
)
self
.
parser
.
add_argument
(
"review"
,
type
=
int
,
location
=
"json"
,
default
=
0
,
required
=
True
)
...
@@ -163,3 +190,185 @@ class ObfuscatedCode(Resource):
...
@@ -163,3 +190,185 @@ class ObfuscatedCode(Resource):
data
=
e
.
args
data
=
e
.
args
current_app
.
logger
.
error
(
e
)
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
# 获取启动器接口
class
LauncherResource
(
Resource
):
def
__init__
(
self
)
->
None
:
super
()
.
__init__
()
self
.
parser
=
RequestParser
()
def
get
(
self
):
# self.parser.add_argument("page", type=int, location="args", default=1)
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
try
:
print
(
args
)
jwt
=
get_jwt_identity
()
data
=
dict
()
for
key
,
value
in
args
.
items
():
if
value
!=
None
:
data
[
key
]
=
value
result
,
message
=
signalManager
.
actionGetLauncher
.
emit
(
data
,
jwt
)
if
result
:
ret
=
result
.
read_bytes
()
# with open(result.as_posix(), "rb") as f:
# ret = f.read()
# logger.info(type(ret))
return
ret
return
response_result
(
message
,
data
=
result
)
except
ValidationError
as
e
:
return
response_result
(
ResponseCode
.
HTTP_INVAILD_REQUEST
,
data
=
e
.
messages
)
except
Exception
as
e
:
data
=
None
if
hasattr
(
e
,
'args'
):
data
=
e
.
args
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
# 获取App列表接口
class
AppListResource
(
Resource
):
def
__init__
(
self
)
->
None
:
super
()
.
__init__
()
self
.
parser
=
RequestParser
()
def
get
(
self
):
# self.parser.add_argument("page", type=int, location="args", default=1)
self
.
parser
.
add_argument
(
"category"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
try
:
print
(
args
)
data
=
dict
()
for
key
,
value
in
args
.
items
():
if
value
!=
None
:
data
[
key
]
=
value
result
,
message
=
signalManager
.
actionGetApp
.
emit
(
data
,
{})
if
result
:
result
=
getListAppsSchema
.
dumps
(
result
.
items
)
return
response_result
(
message
,
data
=
result
)
except
ValidationError
as
e
:
return
response_result
(
ResponseCode
.
HTTP_INVAILD_REQUEST
,
data
=
e
.
messages
)
except
Exception
as
e
:
data
=
None
if
hasattr
(
e
,
'args'
):
data
=
e
.
args
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
# 获取应用接口
class
App
(
Resource
):
def
__init__
(
self
)
->
None
:
super
()
.
__init__
()
self
.
parser
=
RequestParser
()
def
get
(
self
):
# self.parser.add_argument("page", type=int, location="args", default=1)
self
.
parser
.
add_argument
(
"uuid"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
try
:
print
(
args
)
data
=
dict
()
for
key
,
value
in
args
.
items
():
if
value
!=
None
:
data
[
key
]
=
value
result
,
message
=
signalManager
.
actionGetApp
.
emit
(
data
)
if
result
:
result
=
getAppSchema
.
dump
(
result
)
return
response_result
(
message
,
data
=
result
)
except
ValidationError
as
e
:
return
response_result
(
ResponseCode
.
HTTP_INVAILD_REQUEST
,
data
=
e
.
messages
)
except
Exception
as
e
:
data
=
None
if
hasattr
(
e
,
'args'
):
data
=
e
.
args
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
# 获取应用信息接口
class
AppInfo
(
Resource
):
def
__init__
(
self
)
->
None
:
super
()
.
__init__
()
self
.
parser
=
RequestParser
()
def
get
(
self
):
# self.parser.add_argument("page", type=int, location="args", default=1)
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
try
:
print
(
args
)
return
response_result
(
ResponseCode
.
HTTP_SUCCESS
)
except
ValidationError
as
e
:
return
response_result
(
ResponseCode
.
HTTP_INVAILD_REQUEST
,
data
=
e
.
messages
)
except
Exception
as
e
:
data
=
None
if
hasattr
(
e
,
'args'
):
data
=
e
.
args
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
# 下载EPK文件接口
class
DownloadEpk
(
Resource
):
def
__init__
(
self
)
->
None
:
super
()
.
__init__
()
self
.
parser
=
RequestParser
()
def
get
(
self
):
self
.
parser
.
add_argument
(
"uuid"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
try
:
print
(
args
)
data
=
dict
()
for
key
,
value
in
args
.
items
():
if
value
!=
None
:
data
[
key
]
=
value
data
.
update
({
'real_ip'
:
request
.
headers
.
get
(
'X-Forwarded-For'
,
'127.0.0.1'
)
})
result
,
message
=
signalManager
.
actionGetDownload
.
emit
(
data
)
# 读取epk文件,按照格式返回相应结构体数据
logger
.
info
(
data
)
if
result
:
ret
=
result
.
read_bytes
()
# with open(result.as_posix(), "rb") as f:
# ret = f.read()
# logger.info(type(ret))
return
ret
return
response_result
(
message
,
data
=
result
)
except
ValidationError
as
e
:
return
response_result
(
ResponseCode
.
HTTP_INVAILD_REQUEST
,
data
=
e
.
messages
)
except
Exception
as
e
:
data
=
None
if
hasattr
(
e
,
'args'
):
data
=
e
.
args
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
class
DownloadApp
(
Resource
):
def
__init__
(
self
)
->
None
:
super
()
.
__init__
()
self
.
parser
=
RequestParser
()
def
get
(
self
):
# self.parser.add_argument("page", type=int, location="args", default=1)
self
.
parser
.
add_argument
(
"imei"
,
type
=
str
,
location
=
"json"
,
required
=
True
)
args
=
self
.
parser
.
parse_args
()
try
:
print
(
args
)
return
response_result
(
ResponseCode
.
HTTP_SUCCESS
)
except
ValidationError
as
e
:
return
response_result
(
ResponseCode
.
HTTP_INVAILD_REQUEST
,
data
=
e
.
messages
)
except
Exception
as
e
:
data
=
None
if
hasattr
(
e
,
'args'
):
data
=
e
.
args
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
tools/config.json
View file @
a1e2f038
...
@@ -370,7 +370,7 @@
...
@@ -370,7 +370,7 @@
"toJson"
:
true
"toJson"
:
true
},
},
{
{
"name"
:
"
category_2th
"
,
"name"
:
"
launcher
"
,
"dataType"
:
"String"
,
"dataType"
:
"String"
,
"default"
:
"''"
,
"default"
:
"''"
,
"length"
:
20
,
"length"
:
20
,
...
@@ -443,7 +443,7 @@
...
@@ -443,7 +443,7 @@
"name"
:
"category"
"name"
:
"category"
},
},
{
{
"name"
:
"
category_2th
"
"name"
:
"
launcher
"
},
},
{
{
"name"
:
"developer"
"name"
:
"developer"
...
@@ -494,7 +494,7 @@
...
@@ -494,7 +494,7 @@
"name"
:
"category"
"name"
:
"category"
},
},
{
{
"name"
:
"
category_2th
"
"name"
:
"
launcher
"
},
},
{
{
"name"
:
"app_arch"
"name"
:
"app_arch"
...
@@ -516,7 +516,7 @@
...
@@ -516,7 +516,7 @@
"name"
:
"category"
"name"
:
"category"
},
},
{
{
"name"
:
"
category_2th
"
"name"
:
"
launcher
"
},
},
{
{
"name"
:
"app_arch"
"name"
:
"app_arch"
...
@@ -550,7 +550,7 @@
...
@@ -550,7 +550,7 @@
"name"
:
"category"
"name"
:
"category"
},
},
{
{
"name"
:
"
category_2th
"
"name"
:
"
launcher
"
}
}
]
]
}
}
...
...
tools/frontend/src/api/openapi.js
View file @
a1e2f038
/*
/*
* @Author: your name
* @Author: your name
* @Date: 2021-07-15 09:33:39
* @Date: 2021-07-15 09:33:39
* @LastEditTime: 2021-07-
19 21:02:00
* @LastEditTime: 2021-07-
20 01:59:15
* @LastEditors: Please set LastEditors
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @Description: In User Settings Edit
* @FilePath: \evm-store\tools\frontend\src\api\openapi.js
* @FilePath: \evm-store\tools\frontend\src\api\openapi.js
...
@@ -85,6 +85,14 @@ export function updateReview(params) {
...
@@ -85,6 +85,14 @@ export function updateReview(params) {
});
});
}
}
export
function
updateLauncher
(
params
)
{
return
request
({
url
:
"
/api/v1/api/app-review
"
,
method
:
"
get
"
,
params
,
});
}
export
function
getDeviceList
(
params
)
{
export
function
getDeviceList
(
params
)
{
return
request
({
return
request
({
url
:
"
/api/v1/device
"
,
url
:
"
/api/v1/device
"
,
...
...
tools/frontend/src/views/Application/Index.vue
View file @
a1e2f038
...
@@ -307,6 +307,8 @@
...
@@ -307,6 +307,8 @@
<a-divider
type=
"vertical"
/>
<a-divider
type=
"vertical"
/>
<a
href=
"javascript:;"
@
click=
"updateReview(record, 0)"
>
下架
</a>
<a
href=
"javascript:;"
@
click=
"updateReview(record, 0)"
>
下架
</a>
<a-divider
type=
"vertical"
/>
<a-divider
type=
"vertical"
/>
<a
href=
"javascript:;"
@
click=
"updateLauncher(record)"
>
设为启动器
</a>
<a-divider
type=
"vertical"
/>
<a
href=
"javascript:;"
@
click=
"deleteApplication(record)"
>
删除
</a>
<a
href=
"javascript:;"
@
click=
"deleteApplication(record)"
>
删除
</a>
</
template
>
</
template
>
</a-table>
</a-table>
...
@@ -378,7 +380,8 @@ import {
...
@@ -378,7 +380,8 @@ import {
getApplicationList
,
getApplicationList
,
rebuildApplication
,
rebuildApplication
,
deleteApplication
,
deleteApplication
,
updateReview
updateReview
,
updateLauncher
}
from
"
@/api/openapi
"
;
}
from
"
@/api/openapi
"
;
import
{
mapTrim
}
from
"
@/utils/index
"
;
import
{
mapTrim
}
from
"
@/utils/index
"
;
...
@@ -479,6 +482,13 @@ export default {
...
@@ -479,6 +482,13 @@ export default {
message
.
error
(
err
.
msg
)
message
.
error
(
err
.
msg
)
})
})
},
},
updateLauncher
(
record
)
{
updateLauncher
({
app
:
record
.
uuid
}).
then
(
res
=>
{
message
.
success
(
res
.
msg
)
}).
catch
(
err
=>
{
message
.
error
(
err
.
msg
)
})
},
resetForm
()
{
resetForm
()
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
form
.
resetFields
();
this
.
form
.
resetFields
();
...
...
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