diff --git a/fir_ser/api/migrations/0005_apptodeveloper_release_file.py b/fir_ser/api/migrations/0005_apptodeveloper_release_file.py new file mode 100644 index 0000000..5865230 --- /dev/null +++ b/fir_ser/api/migrations/0005_apptodeveloper_release_file.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.3 on 2020-05-05 14:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0004_auto_20200504_2054'), + ] + + operations = [ + migrations.AddField( + model_name='apptodeveloper', + name='release_file', + field=models.CharField(blank=True, max_length=128, null=True, verbose_name='源包名称'), + ), + ] diff --git a/fir_ser/api/models.py b/fir_ser/api/models.py index 24915ae..d49a349 100644 --- a/fir_ser/api/models.py +++ b/fir_ser/api/models.py @@ -233,6 +233,7 @@ class APPToDeveloper(models.Model): app_id = models.ForeignKey(to="Apps", on_delete=models.CASCADE, verbose_name="属于哪个APP") developerid = models.ForeignKey(to="AppIOSDeveloperInfo",on_delete=models.CASCADE, verbose_name="所使用苹果开发者账户") binary_file = models.CharField(max_length=128,blank=True,verbose_name="签名包名称",null=True,unique=True) + release_file = models.CharField(max_length=128,blank=True,verbose_name="源包名称",null=True) updated_time = models.DateTimeField(auto_now=True, verbose_name="更新时间") class Meta: diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py index 68f7dba..ab91435 100644 --- a/fir_ser/api/utils/app/supersignutils.py +++ b/fir_ser/api/utils/app/supersignutils.py @@ -174,8 +174,11 @@ class IosUtils(object): def resign(self): if AppUDID.objects.filter(app_id=self.app_obj, udid=self.udid_info.get('udid')).first().is_signed: - if APPToDeveloper.objects.filter(app_id=self.app_obj).first(): - return + apptodev_obj=APPToDeveloper.objects.filter(app_id=self.app_obj).first() + if apptodev_obj: + release_obj = AppReleaseInfo.objects.filter(app_id=self.app_obj, is_master=True).first() + if release_obj.release_id == apptodev_obj.release_file: + return self.download_profile() file_format_path_name = file_format_path(self.user_obj,self.auth) @@ -206,23 +209,20 @@ class IosUtils(object): APPSuperSignUsedInfo.objects.create(app_id=self.app_obj, user_id=self.user_obj, developerid=self.developer_obj, udid=AppUDID.objects.filter(app_id=self.app_obj,udid=self.udid_info.get('udid')).first()) - # 生成新的ipa,然后替换release,或许,binary_file 这个字段已经无用 - # AppReleaseInfo.objects.filter(app_id=self.app_obj,is_master=True).update(release_id=random_file_name) - del_cache_response_by_short(self.app_obj.short,self.app_obj.app_id,udid=self.udid_info.get('udid')) #创建 apptodev_obj=APPToDeveloper.objects.filter(developerid=self.developer_obj,app_id=self.app_obj).first() if apptodev_obj: - storage = Storage(self.user_obj) - storage.delete_file(apptodev_obj.binary_file, release_obj.release_type) - + storage = LocalStorage("localhost", False) + storage.del_file(apptodev_obj.binary_file+ ".ipa") apptodev_obj.binary_file=random_file_name + apptodev_obj.release_file=release_obj.release_id apptodev_obj.save() else: - APPToDeveloper.objects.create(developerid=self.developer_obj,app_id=self.app_obj,binary_file=random_file_name) + APPToDeveloper.objects.create(developerid=self.developer_obj,app_id=self.app_obj,binary_file=random_file_name,release_file=release_obj.release_id) @staticmethod def disable_udid(udid_obj,app_id):