单个应用超级签加锁单线程执行;更新描述文件;迁移存储,清理头像缓存

pull/5/head
nineven 4 years ago
parent 51020ed73e
commit 65fadc2718
  1. 2
      fir_client/src/components/FirAppInfosBase.vue
  2. 6
      fir_ser/api/utils/app/supersignutils.py
  3. 3
      fir_ser/api/utils/storage/caches.py
  4. 1
      fir_ser/api/utils/storage/storage.py
  5. 5
      fir_ser/api/utils/utils.py
  6. BIN
      fir_ser/files/embedded.mobileprovision

@ -60,7 +60,7 @@
</el-col> </el-col>
<el-col :span="3" <el-col :span="3"
v-if="(appinfos.type===1 && master_release.release_type ===1) || appinfos.issupersign "> v-if="appinfos.type===1 || appinfos.issupersign ">
<a class="" ref="supersign" @click="supersign"><i <a class="" ref="supersign" @click="supersign"><i
class="el-icon-ship"></i>超级签名</a> class="el-icon-ship"></i>超级签名</a>
</el-col> </el-col>

@ -4,7 +4,7 @@
# author: liuyu # author: liuyu
# date: 2020/3/6 # date: 2020/3/6
import uuid, xmltodict, os, re, logging, time, requests import uuid, xmltodict, os, re, logging, time
from fir_ser.settings import SUPER_SIGN_ROOT, MEDIA_ROOT, SERVER_DOMAIN, MOBILECONFIG_SIGN_SSL from fir_ser.settings import SUPER_SIGN_ROOT, MEDIA_ROOT, SERVER_DOMAIN, MOBILECONFIG_SIGN_SSL
from api.utils.app.iossignapi import AppDeveloperApi, ResignApp, AppDeveloperApiV2 from api.utils.app.iossignapi import AppDeveloperApi, ResignApp, AppDeveloperApiV2
from api.models import APPSuperSignUsedInfo, AppUDID, AppIOSDeveloperInfo, AppReleaseInfo, Apps, APPToDeveloper, \ from api.models import APPSuperSignUsedInfo, AppUDID, AppIOSDeveloperInfo, AppReleaseInfo, Apps, APPToDeveloper, \
@ -15,6 +15,7 @@ from api.utils.storage.caches import del_cache_response_by_short, send_msg_over_
from api.utils.utils import file_format_path, delete_app_to_dev_and_file, delete_app_profile_file, \ from api.utils.utils import file_format_path, delete_app_to_dev_and_file, delete_app_profile_file, \
send_ios_developer_active_status, get_profile_full_path, delete_local_files, download_files_form_oss send_ios_developer_active_status, get_profile_full_path, delete_local_files, download_files_form_oss
from api.utils.storage.storage import Storage from api.utils.storage.storage import Storage
from django.core.cache import cache
logger = logging.getLogger(__file__) logger = logging.getLogger(__file__)
@ -488,6 +489,7 @@ class IosUtils(object):
logger.info( logger.info(
"call_loop download_profile appid:%s developer:%s count:%s" % (self.app_obj, self.developer_obj, count)) "call_loop download_profile appid:%s developer:%s count:%s" % (self.app_obj, self.developer_obj, count))
if self.developer_obj: if self.developer_obj:
with cache.lock("%s_%s_%s" % ('download_profile', self.app_obj, self.developer_obj)):
download_flag, result = IosUtils.exec_download_profile(self.app_obj, self.developer_obj, download_flag, result = IosUtils.exec_download_profile(self.app_obj, self.developer_obj,
self.udid_info, sign_try_attempts) self.udid_info, sign_try_attempts)
if download_flag: if download_flag:
@ -521,6 +523,8 @@ class IosUtils(object):
developerid=self.developer_obj, developerid=self.developer_obj,
app_id=self.app_obj) app_id=self.app_obj)
with cache.lock("%s_%s_%s" % ('run_sign', self.app_obj, self.developer_obj)):
logger.info("start run_sign ...")
return IosUtils.run_sign(self.user_obj, self.app_obj, self.developer_obj, download_flag, self, start_time, return IosUtils.run_sign(self.user_obj, self.app_obj, self.developer_obj, download_flag, self, start_time,
result) result)

@ -189,6 +189,9 @@ def del_cache_storage(user_obj):
for storage_key in cache.iter_keys(storage_keys): for storage_key in cache.iter_keys(storage_keys):
cache.delete(storage_key) cache.delete(storage_key)
download_val = CACHE_KEY_TEMPLATE.get('download_url_key')
cache.delete("_".join(['', download_val, os.path.basename(user_obj.head_img)]))
def set_app_today_download_times(app_id): def set_app_today_download_times(app_id):
now = timezone.now() now = timezone.now()

@ -118,6 +118,7 @@ class Storage(object):
base64.b64encode(json.dumps(auth).encode("utf-8")).decode("utf-8")[0:64]]) base64.b64encode(json.dumps(auth).encode("utf-8")).decode("utf-8")[0:64]])
new_storage_obj = cache.get(storage_key) new_storage_obj = cache.get(storage_key)
if new_storage_obj: if new_storage_obj:
logger.info("user %s get default storage obj cache %s" % (user, new_storage_obj))
return new_storage_obj return new_storage_obj
else: else:
if storage_type == 1: if storage_type == 1:

@ -305,17 +305,18 @@ def migrating_storage_file_data(user_obj, filename, new_storage_obj, clean_old_d
def migrating_storage_data(user_obj, new_storage_obj, clean_old_data): def migrating_storage_data(user_obj, new_storage_obj, clean_old_data):
for app_release_obj in AppReleaseInfo.objects.filter(app_id__user_id=user_obj).all(): for app_release_obj in AppReleaseInfo.objects.filter(app_id__user_id=user_obj).all():
#迁移APP数据 # 迁移APP数据
filename = get_filename_from_apptype(app_release_obj.release_id, app_release_obj.release_type) filename = get_filename_from_apptype(app_release_obj.release_id, app_release_obj.release_type)
migrating_storage_file_data(user_obj, filename, new_storage_obj, clean_old_data) migrating_storage_file_data(user_obj, filename, new_storage_obj, clean_old_data)
migrating_storage_file_data(user_obj, app_release_obj.icon_url, new_storage_obj, clean_old_data) migrating_storage_file_data(user_obj, app_release_obj.icon_url, new_storage_obj, clean_old_data)
#迁移超级签数据 # 迁移超级签数据
for apptodev_obj in APPToDeveloper.objects.filter(app_id=app_release_obj.app_id).all(): for apptodev_obj in APPToDeveloper.objects.filter(app_id=app_release_obj.app_id).all():
filename = get_filename_from_apptype(apptodev_obj.binary_file, app_release_obj.release_type) filename = get_filename_from_apptype(apptodev_obj.binary_file, app_release_obj.release_type)
migrating_storage_file_data(user_obj, filename, new_storage_obj, clean_old_data) migrating_storage_file_data(user_obj, filename, new_storage_obj, clean_old_data)
return True return True
def clean_storage_data(user_obj, storage_obj=None): def clean_storage_data(user_obj, storage_obj=None):
storage_obj = Storage(user_obj, storage_obj) storage_obj = Storage(user_obj, storage_obj)
for app_release_obj in AppReleaseInfo.objects.filter(app_id__user_id=user_obj).all(): for app_release_obj in AppReleaseInfo.objects.filter(app_id__user_id=user_obj).all():

Loading…
Cancel
Save