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
1a18e6db
Commit
1a18e6db
authored
Jul 14, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
68130897
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
12 deletions
+51
-12
backend/controller/apps_manager.py
backend/controller/apps_manager.py
+11
-2
backend/controller/download_manager.py
backend/controller/download_manager.py
+15
-10
backend/schema/apps.py
backend/schema/apps.py
+10
-0
backend/schema/download.py
backend/schema/download.py
+9
-0
frontend/src/views/system/apps.vue
frontend/src/views/system/apps.vue
+6
-0
No files found.
backend/controller/apps_manager.py
View file @
1a18e6db
...
@@ -61,7 +61,8 @@ class AppsManager(object):
...
@@ -61,7 +61,8 @@ class AppsManager(object):
# 在EPK目录下生成JSON文件
# 在EPK目录下生成JSON文件
with
open
(
os
.
sep
.
join
([
os
.
path
.
dirname
(
epk_path
),
"epk.json"
]),
"w"
)
as
f
:
with
open
(
os
.
sep
.
join
([
os
.
path
.
dirname
(
epk_path
),
"epk.json"
]),
"w"
)
as
f
:
json
.
dump
(
app
.
to_dict
(
exclude
=
[
"uuid"
,
"create_at"
,
"update_at"
,
"delete_at"
]),
f
)
data
.
update
({
'uuid'
:
str
(
app
.
uuid
)
})
json
.
dump
(
data
,
f
)
for
a
in
app_files
:
for
a
in
app_files
:
Annex
(
app
=
app
,
title
=
os
.
path
.
basename
(
a
),
path
=
a
,
size
=
os
.
path
.
getsize
(
a
),
create_by
=
editor
,
create_at
=
datetime
.
now
(),
update_by
=
editor
,
update_at
=
datetime
.
now
())
Annex
(
app
=
app
,
title
=
os
.
path
.
basename
(
a
),
path
=
a
,
size
=
os
.
path
.
getsize
(
a
),
create_by
=
editor
,
create_at
=
datetime
.
now
(),
update_by
=
editor
,
update_at
=
datetime
.
now
())
...
@@ -71,7 +72,11 @@ class AppsManager(object):
...
@@ -71,7 +72,11 @@ class AppsManager(object):
app_info
=
{}
app_info
=
{}
params
=
{
'appName'
:
app
.
app_name
,
'appDir'
:
epk_path
,
'appVersion'
:
app
.
app_version
,
'output'
:
os
.
path
.
dirname
(
epk_path
)
}
params
=
{
'appName'
:
app
.
app_name
,
'appDir'
:
epk_path
,
'appVersion'
:
app
.
app_version
,
'output'
:
os
.
path
.
dirname
(
epk_path
)
}
if
editor
.
role
==
"administrator"
or
editor
.
role
==
"community"
:
if
editor
.
role
==
"administrator"
or
editor
.
role
==
"community"
:
params
[
'algorithm'
]
=
"h"
params
[
'algorithm'
]
=
"h"
if
data
.
get
(
"algorithm"
):
params
[
'algorithm'
]
=
data
.
get
(
"algorithm"
)
epk
=
EpkApp
(
**
params
)
epk
=
EpkApp
(
**
params
)
app_info
=
epk
.
pack
()
app_info
=
epk
.
pack
()
...
@@ -149,6 +154,10 @@ class AppsManager(object):
...
@@ -149,6 +154,10 @@ class AppsManager(object):
params
=
{
'appName'
:
app
.
app_name
,
'appDir'
:
dest_dir
,
'appVersion'
:
app
.
app_version
,
'output'
:
target_dir
}
params
=
{
'appName'
:
app
.
app_name
,
'appDir'
:
dest_dir
,
'appVersion'
:
app
.
app_version
,
'output'
:
target_dir
}
if
editor
.
role
==
"administrator"
or
editor
.
role
==
"community"
:
if
editor
.
role
==
"administrator"
or
editor
.
role
==
"community"
:
params
[
'algorithm'
]
=
"h"
params
[
'algorithm'
]
=
"h"
if
data
.
get
(
"algorithm"
):
params
[
'algorithm'
]
=
data
.
get
(
"algorithm"
)
epk
=
EpkApp
(
**
params
)
epk
=
EpkApp
(
**
params
)
app_info
=
epk
.
pack
()
app_info
=
epk
.
pack
()
app_info
[
'md5'
]
=
str
(
app_info
[
'md5'
])
app_info
[
'md5'
]
=
str
(
app_info
[
'md5'
])
...
...
backend/controller/download_manager.py
View file @
1a18e6db
...
@@ -114,8 +114,8 @@ class DownloadManager(object):
...
@@ -114,8 +114,8 @@ class DownloadManager(object):
# 当前还没有校验前端传来的IMEI是否是合法的
# 当前还没有校验前端传来的IMEI是否是合法的
# 根据IMEI查找设备,根据设备查找用户,根据用户查找应用
# 根据IMEI查找设备,根据设备查找用户,根据用户查找应用
app
=
None
with
db_session
:
with
db_session
:
app
=
[]
# 根据IMEI查找设备
# 根据IMEI查找设备
# device = Device.select().where(imei=data.get("imei")).first()
# device = Device.select().where(imei=data.get("imei")).first()
# logger.info(data)
# logger.info(data)
...
@@ -124,22 +124,27 @@ class DownloadManager(object):
...
@@ -124,22 +124,27 @@ class DownloadManager(object):
# if not device.create_by:
# if not device.create_by:
# return False, "create user is null"
# return False, "create user is null"
app
=
Apps
.
select
(
app_name
=
data
.
get
(
"id"
))
.
order_by
(
desc
(
Apps
.
create_at
))
if
data
.
get
(
"byId"
):
# 通过id下载应用
if
len
(
app
)
>
1
:
app
=
Apps
.
get
(
uuid
=
data
.
get
(
"uuid"
))
app
=
Apps
.
select
(
lambda
p
:
p
.
app_name
==
data
.
get
(
"id"
)
and
p
.
create_by
.
account
==
'evm'
)
.
order_by
(
desc
(
Apps
.
create_at
))
if
not
app
:
if
not
app
:
return
False
,
"app not found"
return
False
,
"app not found"
else
:
app
=
Apps
.
select
(
app_name
=
data
.
get
(
"id"
))
.
order_by
(
desc
(
Apps
.
create_at
))
if
len
(
app
)
>
1
:
app
=
Apps
.
select
(
lambda
p
:
p
.
app_name
==
data
.
get
(
"id"
)
and
p
.
create_by
.
account
==
'evm'
)
.
order_by
(
desc
(
Apps
.
create_at
))
.
first
()
app
=
app
[:]
if
not
app
:
return
False
,
"app not found"
epk_path
=
""
epk_path
=
""
if
app
[
0
]
.
app_build_log
:
if
app
.
app_build_log
:
epk_path
=
os
.
path
.
normpath
(
os
.
sep
.
join
([
config
.
get
(
"UPLOAD_PATH"
),
app
[
0
]
.
app_build_log
.
app_path
]))
epk_path
=
os
.
path
.
normpath
(
os
.
sep
.
join
([
config
.
get
(
"UPLOAD_PATH"
),
app
.
app_build_log
.
app_path
]))
epk_path
=
Path
(
epk_path
)
epk_path
=
Path
(
epk_path
)
if
not
epk_path
.
exists
():
if
not
epk_path
.
exists
():
return
False
,
"epk file not found"
return
False
,
"epk file not found"
down
=
AppDownload
(
app
=
app
[
0
]
,
imei
=
data
.
get
(
"imei"
))
down
=
AppDownload
(
app
=
app
,
imei
=
data
.
get
(
"imei"
))
commit
()
commit
()
if
down
:
if
down
:
update_download_information
(
data
.
get
(
'real_ip'
,
'127.0.0.1'
),
down
.
id
)
update_download_information
(
data
.
get
(
'real_ip'
,
'127.0.0.1'
),
down
.
id
)
...
...
backend/schema/apps.py
View file @
1a18e6db
'''
Author: your name
Date: 2021-04-14 14:12:18
LastEditTime: 2021-07-13 15:13:56
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\b
ackend
\
schema
\a
pps.py
'''
from
datetime
import
datetime
from
datetime
import
datetime
from
.
import
BaseSchema
from
.
import
BaseSchema
from
marshmallow
import
fields
,
validate
,
RAISE
,
INCLUDE
,
EXCLUDE
from
marshmallow
import
fields
,
validate
,
RAISE
,
INCLUDE
,
EXCLUDE
...
@@ -8,6 +16,7 @@ class AddSchema(BaseSchema):
...
@@ -8,6 +16,7 @@ class AddSchema(BaseSchema):
app_desc
=
fields
.
String
(
required
=
False
)
app_desc
=
fields
.
String
(
required
=
False
)
category
=
fields
.
String
(
required
=
False
)
category
=
fields
.
String
(
required
=
False
)
logo
=
fields
.
Raw
(
required
=
False
)
logo
=
fields
.
Raw
(
required
=
False
)
algorithm
=
fields
.
String
(
required
=
False
)
fileList
=
fields
.
List
(
fields
.
Raw
,
required
=
False
)
fileList
=
fields
.
List
(
fields
.
Raw
,
required
=
False
)
sort
=
fields
.
Int
(
required
=
False
,
default
=
0
)
sort
=
fields
.
Int
(
required
=
False
,
default
=
0
)
...
@@ -33,6 +42,7 @@ class QuerySchema(BaseSchema):
...
@@ -33,6 +42,7 @@ class QuerySchema(BaseSchema):
app_name
=
fields
.
String
(
required
=
False
)
app_name
=
fields
.
String
(
required
=
False
)
category
=
fields
.
String
(
required
=
False
)
category
=
fields
.
String
(
required
=
False
)
scope_type
=
fields
.
String
(
required
=
False
)
scope_type
=
fields
.
String
(
required
=
False
)
algorithm
=
fields
.
String
(
required
=
False
)
pagenum
=
fields
.
Int
(
required
=
False
)
pagenum
=
fields
.
Int
(
required
=
False
)
pagesize
=
fields
.
Int
(
required
=
False
,
max
=
50
)
# 防止用户传特别大的数,导致数据库查询阻塞
pagesize
=
fields
.
Int
(
required
=
False
,
max
=
50
)
# 防止用户传特别大的数,导致数据库查询阻塞
...
...
backend/schema/download.py
View file @
1a18e6db
'''
Author: your name
Date: 2021-04-14 14:12:18
LastEditTime: 2021-07-13 15:13:19
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\b
ackend
\
schema
\
download.py
'''
from
datetime
import
datetime
from
datetime
import
datetime
from
.
import
BaseSchema
from
.
import
BaseSchema
from
marshmallow
import
fields
,
validate
,
RAISE
,
INCLUDE
,
EXCLUDE
from
marshmallow
import
fields
,
validate
,
RAISE
,
INCLUDE
,
EXCLUDE
...
@@ -23,6 +31,7 @@ class DeleteSchema(BaseSchema):
...
@@ -23,6 +31,7 @@ class DeleteSchema(BaseSchema):
class
DownloadSchema
(
BaseSchema
):
class
DownloadSchema
(
BaseSchema
):
id
=
fields
.
String
(
required
=
True
)
id
=
fields
.
String
(
required
=
True
)
imei
=
fields
.
String
(
required
=
True
)
imei
=
fields
.
String
(
required
=
True
)
byId
=
fields
.
Integer
(
required
=
False
)
class
Meta
:
class
Meta
:
unknown
=
EXCLUDE
unknown
=
EXCLUDE
...
...
frontend/src/views/system/apps.vue
View file @
1a18e6db
...
@@ -143,6 +143,12 @@
...
@@ -143,6 +143,12 @@
autocomplete=
"off"
autocomplete=
"off"
></el-input>
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"打包算法"
prop=
"algorithm"
>
<el-input
v-model=
"post.algorithm"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"应用名称"
prop=
"app_name"
>
<el-form-item
label=
"应用名称"
prop=
"app_name"
>
<el-input
<el-input
type=
"text"
type=
"text"
...
...
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