Commit b91944bf authored by wanliofficial's avatar wanliofficial

Merge branch 'release' of ssh://47.105.117.50:2224/wanli/evm-store into release

parents fe190450 adea777a
{
"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_album",
"apkDownloadUrl": "evue_album",
"fileList": "360kids"
},
{
"icon": "qq_music.png",
"time": 1625648308210,
"iconUrl": "http://store.evmiot.com/application/qq_music.png",
"apkId": "456",
"version": "v1.0",
"homePage": "evue_music",
"apkDownloadUrl": "evue_music",
"fileList": "qq_music"
},
{
"icon": "gaode.png",
"time": 1625648308210,
"iconUrl": "http://store.evmiot.com/application/gaode.png",
"apkId": "1015",
"version": "v1.0",
"homePage": "evue_dial",
"apkDownloadUrl": "evue_dial",
"fileList": "gaode"
},
{
"icon": "didi.png",
"time": 1625648308210,
"iconUrl": "http://store.evmiot.com/application/didi.png",
"apkId": "1014",
"version": "v1.0",
"homePage": "evue_setting",
"apkDownloadUrl": "evue_setting",
"fileList": "didi"
},
{
"icon": "alipay.png",
"time": 1625648308210,
"iconUrl": "http://store.evmiot.com/application/zhifubao.png",
"apkId": "001",
"version": "v1.0",
"homePage": "evue_calculator",
"apkDownloadUrl": "evue_calculator",
"fileList": "alipay"
}
]
}
\ No newline at end of file
...@@ -6,11 +6,11 @@ import copy ...@@ -6,11 +6,11 @@ import copy
import json import json
import logging import logging
import urllib import urllib
from pathlib import Path
from urllib import parse, request from urllib import parse, request
from urllib.parse import urlparse from urllib.parse import urlparse
from datetime import datetime from datetime import datetime
from pony.orm import * from pony.orm import *
from flask import request as flask_request
from app.setting import config from app.setting import config
from model.download import AppDownload from model.download import AppDownload
from model.device import Device from model.device import Device
...@@ -134,15 +134,15 @@ class DownloadManager(object): ...@@ -134,15 +134,15 @@ class DownloadManager(object):
app = app[:] app = app[:]
epk_path = "" epk_path = ""
if app[0].app_build_log: if app[0].app_build_log:
epk_path = os.sep.join([os.getcwd(), app[0].app_build_log.app_path]) epk_path = os.path.normpath(os.sep.join([config.get("UPLOAD_PATH"), app[0].app_build_log.app_path]))
if not os.path.exists(epk_path): epk_path = Path(epk_path)
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[0], imei=data.get("imei"))
commit() commit()
if down: if down:
real_ip = flask_request.headers['X-Forwarded-For'] update_download_information(data.get('real_ip', '127.0.0.1'), down.id)
update_download_information(real_ip, down.id)
return epk_path, "get dictionary {}.".format("success" if epk_path else "no data") return epk_path, "get dictionary {}.".format("success" if epk_path else "no data")
......
...@@ -5,6 +5,7 @@ import json ...@@ -5,6 +5,7 @@ import json
import logging import logging
import traceback import traceback
import uuid import uuid
import time
import sqlite3 import sqlite3
from datetime import datetime from datetime import datetime
...@@ -55,6 +56,77 @@ def hello_evm(): ...@@ -55,6 +56,77 @@ def hello_evm():
return json.dumps(result) 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']) @api.route("/opqcp", methods=['POST'])
def action_opqcp(): def action_opqcp():
params = request.json params = request.json
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf_8 -*- # -*- coding: utf_8 -*-
import os
import logging import logging
import traceback import traceback
from flask import Blueprint, request from flask import Blueprint, request
...@@ -52,15 +51,18 @@ def delete(id): ...@@ -52,15 +51,18 @@ def delete(id):
@validate_schema(DownloadSchema) @validate_schema(DownloadSchema)
def get(): def get():
try: try:
result, message = signalManager.actionGetDownload.emit(request.schema_data) data = request.schema_data
print(message) data.update({ 'real_ip': request.headers.get('X-Forwarded-For', '127.0.0.1') })
result, message = signalManager.actionGetDownload.emit(data)
# 读取epk文件,按照格式返回相应结构体数据 # 读取epk文件,按照格式返回相应结构体数据
ret = "" logger.info(data)
if isinstance(result, str) and os.path.exists(result): if result:
with open(result, "rb") as f: ret = result.read_bytes()
ret = f.read() # with open(result.as_posix(), "rb") as f:
# ret = f.read()
# logger.info(type(ret))
return 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: except Exception as e:
traceback.print_exc() traceback.print_exc()
logger.error(str(e)) logger.error(str(e))
......
...@@ -28,7 +28,6 @@ def add(): ...@@ -28,7 +28,6 @@ def add():
return response_result(ResponseCode.REQUEST_ERROR, msg=message) return response_result(ResponseCode.REQUEST_ERROR, msg=message)
except Exception as e: except Exception as e:
traceback.print_exc() traceback.print_exc()
logger.error(str(e))
return response_result(ResponseCode.SERVER_ERROR, msg=str(e)) return response_result(ResponseCode.SERVER_ERROR, msg=str(e))
......
...@@ -15,7 +15,6 @@ ...@@ -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> <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.1.1/dist/gsap.min.js"></script>
</body> </body>
</html> </html>
\ No newline at end of file
''' '''
Author: your name Author: your name
Date: 2021-06-21 14:52:24 Date: 2021-06-21 14:52:24
LastEditTime: 2021-06-30 12:27:59 LastEditTime: 2021-07-08 23:50:12
LastEditors: Please set LastEditors LastEditors: Please set LastEditors
Description: In User Settings Edit Description: In User Settings Edit
FilePath: \evm-store\tools\modules\file-manager\main.py FilePath: \evm-store\tools\modules\file-manager\main.py
''' '''
import os import os
import shutil
import pprint import pprint
from pathlib import Path, PurePosixPath, PureWindowsPath from pathlib import Path
import platform
import json import json
from fs.osfs import OSFS
from fs import open_fs
from fs.walk import Walker
disk_root = "D:\\projects\\scriptiot\\evm_app_store_files" disk_root = "D:\\projects\\scriptiot\\evm_app_store_files"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment