|
|
@ -9,7 +9,9 @@ import random |
|
|
|
from api.utils.storage.storage import Storage |
|
|
|
from api.utils.storage.storage import Storage |
|
|
|
from api.utils.storage.caches import del_cache_response_by_short |
|
|
|
from api.utils.storage.caches import del_cache_response_by_short |
|
|
|
import logging |
|
|
|
import logging |
|
|
|
logger=logging.getLogger(__file__) |
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__file__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def make_resigned(bin_url, img_url, bundle_id, app_version, name): |
|
|
|
def make_resigned(bin_url, img_url, bundle_id, app_version, name): |
|
|
|
ios_plist_tem = """<?xml version="1.0" encoding="UTF-8"?> |
|
|
|
ios_plist_tem = """<?xml version="1.0" encoding="UTF-8"?> |
|
|
@ -128,7 +130,7 @@ def SaveAppInfos(app_file_name, user_obj, appinfo, bundle_id, app_img, short, si |
|
|
|
try: |
|
|
|
try: |
|
|
|
appmobj = Apps.objects.create(**appdata) |
|
|
|
appmobj = Apps.objects.create(**appdata) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
logger.error("create new app failed,appdata:%s Exception:%s"%(appdata,e)) |
|
|
|
logger.error("create new app failed,appdata:%s Exception:%s" % (appdata, e)) |
|
|
|
return False |
|
|
|
return False |
|
|
|
else: |
|
|
|
else: |
|
|
|
try: |
|
|
|
try: |
|
|
@ -139,7 +141,7 @@ def SaveAppInfos(app_file_name, user_obj, appinfo, bundle_id, app_img, short, si |
|
|
|
appmobj.bundle_id = bundle_id |
|
|
|
appmobj.bundle_id = bundle_id |
|
|
|
appmobj.save() |
|
|
|
appmobj.save() |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
logger.error("save app info failed,appmobj:%s Exception:%s"%(appmobj,e)) |
|
|
|
logger.error("save app info failed,appmobj:%s Exception:%s" % (appmobj, e)) |
|
|
|
appmobj.bundle_id = bundle_id |
|
|
|
appmobj.bundle_id = bundle_id |
|
|
|
appmobj.name = appinfo["labelname"] |
|
|
|
appmobj.name = appinfo["labelname"] |
|
|
|
appmobj.save() |
|
|
|
appmobj.save() |
|
|
@ -164,13 +166,15 @@ def SaveAppInfos(app_file_name, user_obj, appinfo, bundle_id, app_img, short, si |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
logging.error("create app release failed,release_data:%s Exception:%s" % (release_data, e)) |
|
|
|
logging.error("create app release failed,release_data:%s Exception:%s" % (release_data, e)) |
|
|
|
if newapp: |
|
|
|
if newapp: |
|
|
|
logger.info("create app release failed,release_data:%s ,and app is new ,so delete this app:%s" % (release_data, appmobj)) |
|
|
|
logger.info("create app release failed,release_data:%s ,and app is new ,so delete this app:%s" % ( |
|
|
|
|
|
|
|
release_data, appmobj)) |
|
|
|
appmobj.delete() |
|
|
|
appmobj.delete() |
|
|
|
return False |
|
|
|
return False |
|
|
|
try: |
|
|
|
try: |
|
|
|
history_release_limit = int(user_obj.history_release_limit) |
|
|
|
history_release_limit = int(user_obj.history_release_limit) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
logger.error("get history_release_limit failed,history_release_limit:%s Exception:%s" % (user_obj.history_release_limit, e)) |
|
|
|
logger.error("get history_release_limit failed,history_release_limit:%s Exception:%s" % ( |
|
|
|
|
|
|
|
user_obj.history_release_limit, e)) |
|
|
|
return True |
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
if history_release_limit != 0: |
|
|
|
if history_release_limit != 0: |
|
|
@ -180,7 +184,8 @@ def SaveAppInfos(app_file_name, user_obj, appinfo, bundle_id, app_img, short, si |
|
|
|
for release_obj in release_queryset: |
|
|
|
for release_obj in release_queryset: |
|
|
|
flag += 1 |
|
|
|
flag += 1 |
|
|
|
if flag > history_release_limit: |
|
|
|
if flag > history_release_limit: |
|
|
|
logging.info("history_release_limit:%s this release is to more,so delete it release_id:%s"%(history_release_limit,release_obj.release_id)) |
|
|
|
logging.info("history_release_limit:%s this release is to more,so delete it release_id:%s" % ( |
|
|
|
|
|
|
|
history_release_limit, release_obj.release_id)) |
|
|
|
storage.delete_file(release_obj.release_id, appmobj.type) |
|
|
|
storage.delete_file(release_obj.release_id, appmobj.type) |
|
|
|
storage.delete_file(release_obj.icon_url) |
|
|
|
storage.delete_file(release_obj.icon_url) |
|
|
|
release_obj.delete() |
|
|
|
release_obj.delete() |
|
|
|