优化代码,增加设备同步详细日志【有时候会删除该开发者下所有签名数据,很诡异】

xsign
nineven 3 years ago
parent cf14dcb0a5
commit 5901d63f3e
  1. 6
      fir_ser/common/libs/sendmsg/templates/check_developer.html
  2. 7
      fir_ser/tests/postudid.py
  3. 17
      fir_ser/xsign/utils/supersignutils.py

@ -10,10 +10,6 @@
margin-left: auto; margin-left: auto;
} }
.span12 {
width: 1170px;
}
.table { .table {
--bs-table-bg: transparent; --bs-table-bg: transparent;
--bs-table-accent-bg: transparent; --bs-table-accent-bg: transparent;
@ -136,7 +132,7 @@
</head> </head>
<body style="text-align: center"> <body style="text-align: center">
<div class="container-fluid"> <div class="container-fluid">
<div class="span12"> <div style="width: 100%">
<h3> <h3>
尊敬的用户 {{ username }} 你好,苹果开发者状态监测如下: 尊敬的用户 {{ username }} 你好,苹果开发者状态监测如下:
</h3> </h3>

@ -52,7 +52,7 @@ short_list = [
def postudid(short=short_list[0], udid=udid_lists[0]): def postudid(short=short_list[0], udid=udid_lists[0]):
data = '<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n<dict>\n\t<key>PRODUCT</key>\n\t<string>iPhone9,1</string>\n\t<key>SERIAL</key>\n\t<string>F71YD58GHG74</string>\n\t<key>UDID</key>\n\t<string>%s</string>\n\t<key>VERSION</key>\n\t<string>17E262</string>\n</dict>\n</plist>\n' % ( data = '<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n<dict>\n\t<key>PRODUCT</key>\n\t<string>iPhone9,1</string>\n\t<key>SERIAL</key>\n\t<string>F71YD58GHG74</string>\n\t<key>UDID</key>\n\t<string>%s</string>\n\t<key>VERSION</key>\n\t<string>17E262</string>\n</dict>\n</plist>\n' % (
udid) udid)
uri = "https://app.hehelucky.cn/udid/%s" % (short) uri = "https://app.hehelucky.cn/api/v1/fir/xsign/udid/%s" % (short)
req = requests.post(uri, data=data) req = requests.post(uri, data=data)
print(req.status_code, req.text) print(req.status_code, req.text)
@ -93,9 +93,8 @@ udid_test_s = [
"00008030-000E6CC122D2402E" "00008030-000E6CC122D2402E"
] ]
postudid(udid="41d1b77e3a831f82a0ca306beaceeb955280b57a", short='vcdp')
# postudid(udid="760862a7367dea986542dae17ee31cd139e454ad", short='semi') exit()
# exit()
def call_function_try_attempts(try_attempts=3): def call_function_try_attempts(try_attempts=3):

@ -1076,29 +1076,36 @@ class IosUtils(object):
udid_developer_obj_list = UDIDsyncDeveloper.objects.filter(developerid=developer_obj).values_list('udid') udid_developer_obj_list = UDIDsyncDeveloper.objects.filter(developerid=developer_obj).values_list('udid')
udid_developer_list = [x[0] for x in udid_developer_obj_list if len(x) > 0] udid_developer_list = [x[0] for x in udid_developer_obj_list if len(x) > 0]
udid_result_list = [device.udid for device in result] udid_result_list = [device.udid for device in result]
logger.warning(f"issuer_id:{developer_obj.issuer_id} udid database info: {udid_developer_list}")
logger.warning(f"issuer_id:{developer_obj.issuer_id} udid develope info: {udid_result_list}")
will_del_udid_list = list(set(udid_developer_list) - set(udid_result_list)) will_del_udid_list = list(set(udid_developer_list) - set(udid_result_list))
logger.warning(f"issuer_id:{developer_obj.issuer_id} udidsync will delete: {will_del_udid_list}")
udid_enabled_result_list = [device.udid for device in result if device.status == 'ENABLED'] udid_enabled_result_list = [device.udid for device in result if device.status == 'ENABLED']
will_del_disabled_udid_list = list(set(udid_developer_list) - set(udid_enabled_result_list)) will_del_disabled_udid_list = list(set(udid_developer_list) - set(udid_enabled_result_list))
logger.warning(f"issuer_id:{developer_obj.issuer_id} delete and disabled: {will_del_disabled_udid_list}")
for device_obj in result: for device_obj in result:
obj, create = update_or_create_developer_udid_info(device_obj, developer_obj) obj, create = update_or_create_developer_udid_info(device_obj, developer_obj)
if not create: if not create:
DeveloperDevicesID.objects.filter(udid=obj, developerid=developer_obj).update( DeveloperDevicesID.objects.filter(udid=obj, developerid=developer_obj).update(
**{'did': device_obj.id}) **{'did': device_obj.id})
AppUDID.objects.filter(udid__udid__in=will_del_disabled_udid_list, AppUDID.objects.filter(udid__udid__in=will_del_disabled_udid_list, udid__developerid=developer_obj).delete()
app_id__developerdevicesid__udid__in=UDIDsyncDeveloper.objects.filter(
udid__in=will_del_disabled_udid_list)).delete()
developer_device_list = DeveloperDevicesID.objects.filter(udid__udid__in=will_del_disabled_udid_list, developer_device_list = DeveloperDevicesID.objects.filter(udid__udid__in=will_del_disabled_udid_list,
developerid=developer_obj).all() developerid=developer_obj).all()
app_pk_list = []
for developer_device_obj in developer_device_list: for developer_device_obj in developer_device_list:
app_obj = developer_device_obj.app_id app_pk_list.append(developer_device_obj.app_id.pk)
developer_device_obj.delete()
for app_pk in list(set(app_pk_list)):
app_obj = Apps.objects.filter(pk=app_pk).first()
if APPSuperSignUsedInfo.objects.filter(developerid=developer_obj, app_id=app_obj).count() == 0: if APPSuperSignUsedInfo.objects.filter(developerid=developer_obj, app_id=app_obj).count() == 0:
logger.warning(f"issuer_id:{developer_obj.issuer_id} delete {app_obj} profile and sign ipa file")
IosUtils.clean_app_by_developer_obj(app_obj, developer_obj) IosUtils.clean_app_by_developer_obj(app_obj, developer_obj)
delete_app_to_dev_and_file(developer_obj, app_obj.pk) delete_app_to_dev_and_file(developer_obj, app_obj.pk)
delete_app_profile_file(developer_obj, app_obj) delete_app_profile_file(developer_obj, app_obj)
developer_device_obj.delete()
UDIDsyncDeveloper.objects.filter(udid__in=will_del_udid_list, developerid=developer_obj).delete() UDIDsyncDeveloper.objects.filter(udid__in=will_del_udid_list, developerid=developer_obj).delete()

Loading…
Cancel
Save