update
This commit is contained in:
parent
5f93914830
commit
163d4138b8
@ -22,21 +22,31 @@ class Bale:
|
||||
@classmethod
|
||||
def run_bale_apk(cls, dir_, id_):
|
||||
try:
|
||||
pkg_num = 0
|
||||
with open(os.path.join(settings.ROOT_DIR, 'ApkTool/channel.json'), 'r') as f:
|
||||
props = json.load(f)
|
||||
pkg_num = int(props.get('num', {}).get('value', 0))
|
||||
|
||||
cls.status = 'busy'
|
||||
make_tool = MakeTool(os.path.join(settings.ROOT_DIR, 'ApkTool/channel.json'))
|
||||
a, b = make_tool.run()
|
||||
|
||||
path = os.path.join(settings.ROOT_DIR, 'ApkTool/bin')
|
||||
if not os.path.exists(path):
|
||||
os.mkdir(path)
|
||||
|
||||
pkg_list = [os.path.join(path, item) for item in os.listdir(path) if item.endswith('.apk')]
|
||||
output_num = len(pkg_list)
|
||||
total_pkg = 0
|
||||
with open(os.path.join(settings.ROOT_DIR, 'ApkTool/channel.json'), 'r') as f:
|
||||
props = json.load(f)
|
||||
total_pkg = int(props.get('num', {}).get('value', 0))
|
||||
|
||||
# 打包任务失败
|
||||
if not a:
|
||||
data = {
|
||||
'id': id_,
|
||||
'url': '',
|
||||
'apkname': '',
|
||||
'total_pkg': pkg_num,
|
||||
'total_pkg': total_pkg,
|
||||
'current_pkg': 0,
|
||||
'output_num': output_num,
|
||||
'done': 0,
|
||||
'code': -2,
|
||||
'msg': b
|
||||
@ -44,12 +54,10 @@ class Bale:
|
||||
cls._post('http://gamesdk.legu.cc/api/subpackageRecord/getRecord', data=data)
|
||||
return
|
||||
|
||||
path = os.path.join(settings.ROOT_DIR, 'ApkTool/bin')
|
||||
if not os.path.exists(path):
|
||||
return
|
||||
cls.status = 'upload'
|
||||
print('开始上传包')
|
||||
count = 0
|
||||
|
||||
for item in os.listdir(path):
|
||||
if item.endswith('.apk'):
|
||||
count += 1
|
||||
@ -61,9 +69,10 @@ class Bale:
|
||||
'id': id_,
|
||||
'url': '',
|
||||
'apkname': item,
|
||||
'total_pkg': pkg_num,
|
||||
'total_pkg': total_pkg,
|
||||
'current_pkg': count,
|
||||
'done': int(count >= pkg_num),
|
||||
'output_num': output_num,
|
||||
'done': int(count >= output_num),
|
||||
'code': -1,
|
||||
'msg': msg
|
||||
}
|
||||
@ -72,9 +81,10 @@ class Bale:
|
||||
'id': id_,
|
||||
'url': msg,
|
||||
'apkname': item,
|
||||
'total_pkg': pkg_num,
|
||||
'total_pkg': total_pkg,
|
||||
'current_pkg': count,
|
||||
'done': int(count >= pkg_num),
|
||||
'output_num': output_num,
|
||||
'done': int(count >= output_num),
|
||||
'code': 0
|
||||
}
|
||||
cls._post('http://gamesdk.legu.cc/api/subpackageRecord/getRecord', data=data)
|
||||
|
Loading…
Reference in New Issue
Block a user