update
This commit is contained in:
parent
5f93914830
commit
163d4138b8
@ -18,25 +18,35 @@ class Bale:
|
|||||||
if resp.status_code != 200:
|
if resp.status_code != 200:
|
||||||
if try_num > 0:
|
if try_num > 0:
|
||||||
return cls._post(url, data, try_num - 1)
|
return cls._post(url, data, try_num - 1)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run_bale_apk(cls, dir_, id_):
|
def run_bale_apk(cls, dir_, id_):
|
||||||
try:
|
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'
|
cls.status = 'busy'
|
||||||
make_tool = MakeTool(os.path.join(settings.ROOT_DIR, 'ApkTool/channel.json'))
|
make_tool = MakeTool(os.path.join(settings.ROOT_DIR, 'ApkTool/channel.json'))
|
||||||
a, b = make_tool.run()
|
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:
|
if not a:
|
||||||
data = {
|
data = {
|
||||||
'id': id_,
|
'id': id_,
|
||||||
'url': '',
|
'url': '',
|
||||||
'apkname': '',
|
'apkname': '',
|
||||||
'total_pkg': pkg_num,
|
'total_pkg': total_pkg,
|
||||||
'current_pkg': 0,
|
'current_pkg': 0,
|
||||||
|
'output_num': output_num,
|
||||||
'done': 0,
|
'done': 0,
|
||||||
'code': -2,
|
'code': -2,
|
||||||
'msg': b
|
'msg': b
|
||||||
@ -44,12 +54,10 @@ class Bale:
|
|||||||
cls._post('http://gamesdk.legu.cc/api/subpackageRecord/getRecord', data=data)
|
cls._post('http://gamesdk.legu.cc/api/subpackageRecord/getRecord', data=data)
|
||||||
return
|
return
|
||||||
|
|
||||||
path = os.path.join(settings.ROOT_DIR, 'ApkTool/bin')
|
|
||||||
if not os.path.exists(path):
|
|
||||||
return
|
|
||||||
cls.status = 'upload'
|
cls.status = 'upload'
|
||||||
print('开始上传包')
|
print('开始上传包')
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
for item in os.listdir(path):
|
for item in os.listdir(path):
|
||||||
if item.endswith('.apk'):
|
if item.endswith('.apk'):
|
||||||
count += 1
|
count += 1
|
||||||
@ -61,9 +69,10 @@ class Bale:
|
|||||||
'id': id_,
|
'id': id_,
|
||||||
'url': '',
|
'url': '',
|
||||||
'apkname': item,
|
'apkname': item,
|
||||||
'total_pkg': pkg_num,
|
'total_pkg': total_pkg,
|
||||||
'current_pkg': count,
|
'current_pkg': count,
|
||||||
'done': int(count >= pkg_num),
|
'output_num': output_num,
|
||||||
|
'done': int(count >= output_num),
|
||||||
'code': -1,
|
'code': -1,
|
||||||
'msg': msg
|
'msg': msg
|
||||||
}
|
}
|
||||||
@ -72,9 +81,10 @@ class Bale:
|
|||||||
'id': id_,
|
'id': id_,
|
||||||
'url': msg,
|
'url': msg,
|
||||||
'apkname': item,
|
'apkname': item,
|
||||||
'total_pkg': pkg_num,
|
'total_pkg': total_pkg,
|
||||||
'current_pkg': count,
|
'current_pkg': count,
|
||||||
'done': int(count >= pkg_num),
|
'output_num': output_num,
|
||||||
|
'done': int(count >= output_num),
|
||||||
'code': 0
|
'code': 0
|
||||||
}
|
}
|
||||||
cls._post('http://gamesdk.legu.cc/api/subpackageRecord/getRecord', data=data)
|
cls._post('http://gamesdk.legu.cc/api/subpackageRecord/getRecord', data=data)
|
||||||
|
Loading…
Reference in New Issue
Block a user