增加设置类型判断,修复设备同步只增不减的问题

super_sign_new
youngS 4 years ago
parent 95a96e5dc5
commit ccc9a176f4
  1. 22
      fir_ser/api/migrations/0011_auto_20210125_1137.py
  2. 4
      fir_ser/api/models.py
  3. 2
      fir_ser/api/utils/app/supersignutils.py

@ -0,0 +1,22 @@
# Generated by Django 3.0.3 on 2021-01-25 11:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0010_userinfo_api_token'),
]
operations = [
migrations.RemoveField(
model_name='udidsyncdeveloper',
name='created_time',
),
migrations.AddField(
model_name='udidsyncdeveloper',
name='platform',
field=models.SmallIntegerField(choices=[(0, 'app developer'), (1, 'fly分发')], default=0, verbose_name='udid所在平台'),
),
]

@ -270,7 +270,9 @@ class UDIDsyncDeveloper(models.Model):
product = models.CharField(max_length=64, verbose_name="产品", blank=True, null=True, ) product = models.CharField(max_length=64, verbose_name="产品", blank=True, null=True, )
serial = models.CharField(max_length=64, verbose_name="序列号", blank=True, null=True, ) serial = models.CharField(max_length=64, verbose_name="序列号", blank=True, null=True, )
version = models.CharField(max_length=64, verbose_name="型号", blank=True, null=True, ) version = models.CharField(max_length=64, verbose_name="型号", blank=True, null=True, )
created_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间") created_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
platform_choices = ((0, 'fly分发'), (1, 'app developer'),)
platform = models.SmallIntegerField(choices=platform_choices, default=0, verbose_name="udid所在平台")
class Meta: class Meta:
verbose_name = 'iOS开发平台同步设备信息' verbose_name = 'iOS开发平台同步设备信息'

@ -483,6 +483,7 @@ class IosUtils(object):
"get_device_from_developer developer_obj:%s user_obj:%s delete file failed Exception:%s" % ( "get_device_from_developer developer_obj:%s user_obj:%s delete file failed Exception:%s" % (
developer_obj, user_obj, e)) developer_obj, user_obj, e))
UDIDsyncDeveloper.objects.filter(developerid=developer_obj, platform=1).delete()
for devicestr in devices_info.split(">"): for devicestr in devices_info.split(">"):
formatdevice = re.findall(r'.*Device id="(.*)",.*name="(.*)",.*udid="(.*?)",.*model=(.*),.*', devicestr) formatdevice = re.findall(r'.*Device id="(.*)",.*name="(.*)",.*udid="(.*?)",.*model=(.*),.*', devicestr)
if formatdevice: if formatdevice:
@ -491,6 +492,7 @@ class IosUtils(object):
"product": formatdevice[0][1], "product": formatdevice[0][1],
"udid": formatdevice[0][2], "udid": formatdevice[0][2],
"version": formatdevice[0][3], "version": formatdevice[0][3],
"platform": 1
} }
app_udid_obj = UDIDsyncDeveloper.objects.filter(developerid=developer_obj, udid=device.get("udid")) app_udid_obj = UDIDsyncDeveloper.objects.filter(developerid=developer_obj, udid=device.get("udid"))
if app_udid_obj: if app_udid_obj:

Loading…
Cancel
Save