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
682ddfd7
Commit
682ddfd7
authored
Jul 08, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
baa16069
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
314 additions
and
13 deletions
+314
-13
backend/apiData.json
backend/apiData.json
+227
-0
backend/controller/download_manager.py
backend/controller/download_manager.py
+5
-5
backend/view/api.py
backend/view/api.py
+72
-0
backend/view/download.py
backend/view/download.py
+10
-7
frontend/public/index.html
frontend/public/index.html
+0
-1
No files found.
backend/apiData.json
0 → 100644
View file @
682ddfd7
{
"appList"
:
[
{
"uuid"
:
"001"
,
"img"
:
"alipay.png"
,
"title"
:
"支付宝"
,
"arrow"
:
"setup.png"
,
"download"
:
120
,
"like"
:
76
,
"category"
:
"1016"
,
"details"
:
{
"version"
:
"1.0.1"
,
"update"
:
"2021-04-01"
,
"size"
:
20
,
"log"
:
"优化性能,提高稳定性和安全性"
,
"desc"
:
"生活好,支付宝"
}
},
{
"uuid"
:
"123"
,
"img"
:
"qq.png"
,
"title"
:
"腾讯QQ"
,
"arrow"
:
"setup.png"
,
"download"
:
111
,
"like"
:
70
,
"category"
:
"1016"
,
"details"
:
{
"version"
:
"0.0.2"
,
"update"
:
"2021-04-02"
,
"size"
:
22
,
"log"
:
"修复若干已知问题"
,
"desc"
:
"QQ,乐在沟通"
}
},
{
"uuid"
:
"456"
,
"img"
:
"qq_music.png"
,
"title"
:
"QQ音乐"
,
"arrow"
:
"setup.png"
,
"download"
:
100
,
"like"
:
71
,
"category"
:
"1012"
,
"details"
:
{
"version"
:
"0.0.3"
,
"update"
:
"2021-04-03"
,
"size"
:
32
,
"log"
:
"优化性能,提高稳定性和安全性"
,
"desc"
:
"十五年的陪伴,国民音乐平台"
}
},
{
"uuid"
:
"789"
,
"img"
:
"360kids.png"
,
"title"
:
"360儿童卫士"
,
"arrow"
:
"setup.png"
,
"download"
:
100
,
"like"
:
56
,
"category"
:
"1016"
,
"details"
:
{
"version"
:
"0.0.5"
,
"update"
:
"2021-04-05"
,
"size"
:
36
,
"log"
:
"优化性能,提高稳定性和安全性"
,
"desc"
:
"千万家长信任的育学助手"
}
},
{
"uuid"
:
"1011"
,
"img"
:
"baidutieba.png"
,
"title"
:
"百度贴吧"
,
"arrow"
:
"setup.png"
,
"download"
:
100
,
"like"
:
78
,
"category"
:
"1016"
,
"details"
:
{
"version"
:
"0.0.4"
,
"update"
:
"2021-04-04"
,
"size"
:
25
,
"log"
:
"优化性能,提高稳定性和安全性"
,
"desc"
:
"聊兴趣,上贴吧"
}
},
{
"uuid"
:
"1012"
,
"img"
:
"aiqiyi.png"
,
"title"
:
"爱奇艺"
,
"arrow"
:
"setup.png"
,
"download"
:
79
,
"like"
:
76
,
"category"
:
"1013"
,
"details"
:
{
"version"
:
"0.0.3"
,
"update"
:
"2021-04-03"
,
"size"
:
41
,
"log"
:
"优化性能,提高稳定性和安全性"
,
"desc"
:
"欧洲杯免费直播"
}
},
{
"uuid"
:
"1013"
,
"img"
:
"yy.png"
,
"title"
:
"YY语音"
,
"arrow"
:
"setup.png"
,
"download"
:
120
,
"like"
:
45
,
"category"
:
"1015"
,
"details"
:
{
"version"
:
"0.0.3"
,
"update"
:
"2021-04-03"
,
"size"
:
32
,
"log"
:
"优化性能,提高稳定性和安全性"
,
"desc"
:
"和附近的聊天看直播"
}
},
{
"uuid"
:
"1014"
,
"img"
:
"didi.png"
,
"title"
:
"滴滴打车"
,
"arrow"
:
"setup.png"
,
"download"
:
34
,
"like"
:
55
,
"category"
:
"1016"
,
"details"
:
{
"version"
:
"0.0.3"
,
"update"
:
"2021-04-03"
,
"size"
:
32
,
"log"
:
"优化性能,提高稳定性和安全性"
,
"desc"
:
"滴滴一下,美好出行"
}
},
{
"uuid"
:
"1015"
,
"img"
:
"gaode.png"
,
"title"
:
"高德地图"
,
"arrow"
:
"setup.png"
,
"download"
:
29
,
"like"
:
59
,
"category"
:
"1016"
,
"details"
:
{
"version"
:
"0.0.3"
,
"update"
:
"2021-04-03"
,
"size"
:
32
,
"log"
:
"优化性能,提高稳定性和安全性"
,
"desc"
:
"专享88元打车礼包"
}
}
],
"categoryList"
:
[
{
"uuid"
:
"1012"
,
"img"
:
"music.png"
,
"title"
:
"音乐"
},
{
"uuid"
:
"1013"
,
"img"
:
"movie.png"
,
"title"
:
"视频"
},
{
"uuid"
:
"1014"
,
"img"
:
"camera.png"
,
"title"
:
"相机"
},
{
"uuid"
:
"1015"
,
"img"
:
"voice.png"
,
"title"
:
"语音"
},
{
"uuid"
:
"1016"
,
"img"
:
"tool.png"
,
"title"
:
"工具"
}
],
"downloadList"
:
[
{
"icon"
:
"360kids.png"
,
"time"
:
1625648308210
,
"iconUrl"
:
"http://store.evmiot.com/application/360kids.png"
,
"apkId"
:
"789"
,
"version"
:
"v1.0"
,
"homePage"
:
"evue_calculator"
,
"apkDownloadUrl"
:
"http://store.evmiot.com/evueapps/evm/evue_launcher-1.0-20210420144208/evue_launcher.epk"
,
"fileList"
:
"360kids"
},
{
"icon"
:
"qq_music.png"
,
"time"
:
1625648308210
,
"iconUrl"
:
"http://store.evmiot.com/application/qq_music.png"
,
"apkId"
:
"456"
,
"version"
:
"v1.0"
,
"homePage"
:
"evue_calculator"
,
"apkDownloadUrl"
:
"calculator"
,
"fileList"
:
"qq_music"
},
{
"icon"
:
"gaode.png"
,
"time"
:
1625648308210
,
"iconUrl"
:
"http://store.evmiot.com/application/gaode.png"
,
"apkId"
:
"1015"
,
"version"
:
"v1.0"
,
"homePage"
:
"evue_calculator"
,
"apkDownloadUrl"
:
"calculator"
,
"fileList"
:
"gaode"
},
{
"icon"
:
"didi.png"
,
"time"
:
1625648308210
,
"iconUrl"
:
"http://store.evmiot.com/application/didi.png"
,
"apkId"
:
"1014"
,
"version"
:
"v1.0"
,
"homePage"
:
"evue_calculator"
,
"apkDownloadUrl"
:
"calculator"
,
"fileList"
:
"didi"
},
{
"icon"
:
"alipay.png"
,
"time"
:
1625648308210
,
"iconUrl"
:
"http://store.evmiot.com/application/zhifubao.png"
,
"apkId"
:
"001"
,
"version"
:
"v1.0"
,
"homePage"
:
"evue_calculator"
,
"apkDownloadUrl"
:
"calculator"
,
"fileList"
:
"calculator"
}
]
}
\ No newline at end of file
backend/controller/download_manager.py
View file @
682ddfd7
...
...
@@ -6,11 +6,11 @@ import copy
import
json
import
logging
import
urllib
from
pathlib
import
Path
from
urllib
import
parse
,
request
from
urllib.parse
import
urlparse
from
datetime
import
datetime
from
pony.orm
import
*
from
flask
import
request
as
flask_request
from
app.setting
import
config
from
model.download
import
AppDownload
from
model.device
import
Device
...
...
@@ -134,15 +134,15 @@ class DownloadManager(object):
app
=
app
[:]
epk_path
=
""
if
app
[
0
]
.
app_build_log
:
epk_path
=
os
.
sep
.
join
([
os
.
getcwd
(),
app
[
0
]
.
app_build_log
.
app_path
])
if
not
os
.
path
.
exists
(
epk_path
):
epk_path
=
os
.
path
.
normpath
(
os
.
sep
.
join
([
config
.
get
(
"UPLOAD_PATH"
),
app
[
0
]
.
app_build_log
.
app_path
]))
epk_path
=
Path
(
epk_path
)
if
not
epk_path
.
exists
():
return
False
,
"epk file not found"
down
=
AppDownload
(
app
=
app
[
0
],
imei
=
data
.
get
(
"imei"
))
commit
()
if
down
:
real_ip
=
flask_request
.
headers
[
'X-Forwarded-For'
]
update_download_information
(
real_ip
,
down
.
id
)
update_download_information
(
data
.
get
(
'real_ip'
,
'127.0.0.1'
),
down
.
id
)
return
epk_path
,
"get dictionary {}."
.
format
(
"success"
if
epk_path
else
"no data"
)
...
...
backend/view/api.py
View file @
682ddfd7
...
...
@@ -5,6 +5,7 @@ import json
import
logging
import
traceback
import
uuid
import
time
import
sqlite3
from
datetime
import
datetime
...
...
@@ -55,6 +56,77 @@ def hello_evm():
return
json
.
dumps
(
result
)
@
api
.
route
(
"/store"
,
methods
=
[
'GET'
,
'POST'
])
def
get_store
():
result
=
{}
with
open
(
"./apiData.json"
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
result
=
json
.
loads
(
f
.
read
())
logger
.
info
(
request
.
args
)
# logger.info(request.query_string)
if
request
.
args
and
request
.
args
.
get
(
"category"
):
res
=
[]
for
item
in
result
.
get
(
"appList"
,
[]):
if
item
.
get
(
"category"
)
==
request
.
args
.
get
(
"category"
):
res
.
append
(
item
)
result
[
"appList"
]
=
res
result
=
{
'appList'
:
result
[
"appList"
],
'categoryList'
:
result
[
"categoryList"
]
}
return
response_result
(
ResponseCode
.
OK
,
data
=
result
)
@
api
.
route
(
"/store/app/<uuid>"
,
methods
=
[
'GET'
,
'POST'
])
def
get_store_app
(
uuid
):
logger
.
info
(
uuid
)
result
=
{}
with
open
(
"./apiData.json"
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
result
=
json
.
loads
(
f
.
read
())
res
=
{}
for
item
in
result
.
get
(
"appList"
,
[]):
if
item
.
get
(
"uuid"
)
==
uuid
:
res
=
item
break
return
response_result
(
ResponseCode
.
OK
,
data
=
res
)
@
api
.
route
(
"/store/appInfo/<uuid>"
,
methods
=
[
'GET'
,
'POST'
])
def
get_app_info
(
uuid
):
result
=
{}
with
open
(
"./apiData.json"
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
result
=
json
.
loads
(
f
.
read
())
res
=
None
for
item
in
result
.
get
(
"downloadList"
,
[]):
if
item
.
get
(
"apkId"
)
==
uuid
:
res
=
item
break
print
(
res
)
return
response_result
(
ResponseCode
.
OK
,
data
=
res
)
@
api
.
route
(
"/store/downloadEpk/<uuid>"
,
methods
=
[
'GET'
,
'POST'
])
def
download_epk
(
uuid
):
# 这里要做一些业务处理,根据应用ID和版本号,判断是否有新的应用更新
result
=
{}
with
open
(
"./apiData.json"
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
result
=
json
.
loads
(
f
.
read
())
res
=
{}
for
item
in
result
.
get
(
"downloadList"
,
[]):
if
item
.
get
(
"apkId"
)
==
uuid
:
res
.
update
(
item
)
break
res
.
update
({
'status'
:
0
,
'time'
:
int
(
time
.
time
())
})
print
(
res
)
return
response_result
(
ResponseCode
.
OK
,
data
=
res
)
@
api
.
route
(
"/opqcp"
,
methods
=
[
'POST'
])
def
action_opqcp
():
params
=
request
.
json
...
...
backend/view/download.py
View file @
682ddfd7
...
...
@@ -52,15 +52,18 @@ def delete(id):
@
validate_schema
(
DownloadSchema
)
def
get
():
try
:
result
,
message
=
signalManager
.
actionGetDownload
.
emit
(
request
.
schema_data
)
print
(
message
)
data
=
request
.
schema_data
data
.
update
({
'real_ip'
:
request
.
headers
.
get
(
'X-Forwarded-For'
,
'127.0.0.1'
)
})
result
,
message
=
signalManager
.
actionGetDownload
.
emit
(
data
)
# 读取epk文件,按照格式返回相应结构体数据
ret
=
""
if
isinstance
(
result
,
str
)
and
os
.
path
.
exists
(
result
):
with
open
(
result
,
"rb"
)
as
f
:
ret
=
f
.
read
()
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
(
ResponseCode
.
SERVER_ERROR
,
msg
=
"file not found"
)
return
response_result
(
ResponseCode
.
SERVER_ERROR
,
msg
=
message
)
except
Exception
as
e
:
traceback
.
print_exc
()
logger
.
error
(
str
(
e
))
...
...
frontend/public/index.html
View file @
682ddfd7
...
...
@@ -15,7 +15,6 @@
<strong>
We're sorry but
<
%=
htmlWebpackPlugin
.
options
.
title
%
>
doesn't work properly without JavaScript enabled. Please enable it to continue.
</strong>
</noscript>
<div
id=
"app"
></div>
<script
src=
"https://cdn.jsdelivr.net/npm/gsap@3.1.1/dist/gsap.min.js"
></script>
</body>
</html>
\ No newline at end of file
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