super_signature
nineven 5 years ago
parent 4180b82311
commit 616e959978
  1. 1
      fir_client/src/components/FirHeader.vue
  2. 4
      fir_ser/api/utils/app/supersignutils.py
  3. 21
      fir_ser/api/utils/serializer.py
  4. 14
      fir_ser/api/views/apps.py
  5. 22
      fir_ser/api/views/supersign.py

@ -61,6 +61,7 @@ import {logout} from '../restful'
}else if (command === 'storage') {
this.$router.push({name: 'FirUserProfileStorage'})
}else if (command === 'supersign') {
this.$store.dispatch('doucurrentapp', {});
this.$router.push({"name":'FirSuperSignBase', params: {act: "iosdeveloper"}})
}

@ -128,7 +128,7 @@ class IosUtils(object):
user_id=self.user_obj).first()
#只要账户下面存在udid,就可以使用该苹果开发者账户,避免多个开发者账户下面出现同一个udid
if usedeviceobj :#and usedeviceobj.developerid.use_number < usedeviceobj.developerid.usable_number:
developer_obj = usedeviceobj.developeridjj
developer_obj = usedeviceobj.developerid
else:
developer_udid_obj = UDIDsyncDeveloper.objects.filter(udid=self.udid_info.get('udid')).first()
if developer_udid_obj:
@ -216,7 +216,7 @@ class IosUtils(object):
if not appsupersign_obj.filter(app_id=self.app_obj, user_id=self.user_obj).first():
APPSuperSignUsedInfo.objects.create(app_id=self.app_obj, user_id=self.user_obj, developerid=self.developer_obj,
udid__udid=self.udid_info.get('udid'))
udid=AppUDID.objects.filter(app_id=self.app_obj,udid=self.udid_info.get('udid')).first())
del_cache_response_by_short(self.app_obj.short,self.app_obj.app_id,udid=self.udid_info.get('udid'))

@ -1,5 +1,6 @@
from rest_framework import serializers
from api import models
from django.db.models import Sum,F
from api.utils.app.apputils import bytes2human
from api.utils.TokenManager import DownloadToken
from api.utils.storage.storage import Storage
@ -242,6 +243,26 @@ def get_developer_udided(developer_obj):
return len(set(develoer_udid_lists)-set(supersign_udid_lists)),len(develoer_udid_lists)
def get_developer_devices(developer_obj_lists):
other_used_sum = 0
flyapp_used_sum = 0
for dev_obj in developer_obj_lists:
other_used, flyapp_used = get_developer_udided(dev_obj)
other_used_sum += other_used
flyapp_used_sum += flyapp_used
use_number_obj = developer_obj_lists.filter(is_actived=True)
if use_number_obj:
use_number_dict = use_number_obj.aggregate(usable_number=Sum('usable_number'), use_number=Sum('use_number'))
use_num = {
"all_usable_number": use_number_dict.get("usable_number", 0),
"all_use_number": use_number_dict.get("use_number", 0),
"other_used_sum": other_used_sum,
"flyapp_used_sum": flyapp_used_sum,
}
return use_num
class SuperSignUsedSerializer(serializers.ModelSerializer):
class Meta:
model = models.APPSuperSignUsedInfo

@ -16,7 +16,7 @@ from api.utils.app.randomstrings import make_from_user_uuid
from api.utils.storage.storage import Storage
from api.utils.storage.caches import del_cache_response_by_short,get_app_today_download_times
from api.models import Apps, AppReleaseInfo,APPToDeveloper,AppIOSDeveloperInfo
from api.utils.serializer import AppsSerializer, AppReleaseSerializer, UserInfoSerializer
from api.utils.serializer import AppsSerializer, AppReleaseSerializer, UserInfoSerializer,get_developer_devices
from rest_framework.pagination import PageNumberPagination
@ -181,15 +181,11 @@ class AppInfoView(APIView):
apps_obj.password = data.get("password", apps_obj.password)
apps_obj.isshow = data.get("isshow", apps_obj.isshow)
if apps_obj.type == 1:
now_can_use_number=0
developer_obj = AppIOSDeveloperInfo.objects.filter(user_id=request.user)
use_number_dict = developer_obj.filter(is_actived=True).filter(use_number__lt=F("usable_number")).aggregate(
usable_number=Sum('usable_number'), use_number=Sum('use_number'))
if use_number_dict and use_number_dict.get("usable_number", 0) and use_number_dict.get(
"use_number", 0):
now_can_use_number = use_number_dict.get("usable_number", 0) - use_number_dict.get(
"use_number", 0)
if now_can_use_number == 0:
use_num = get_developer_devices(developer_obj)
if use_num.get("flyapp_used_sum") >= use_num.get("all_usable_number"):
res.code = 1008
res.msg = "超级签余额不足,无法开启"
return Response(res.dict)

@ -9,10 +9,9 @@ from api.utils.response import BaseResponse
from api.utils.auth import ExpiringTokenAuthentication
from rest_framework.response import Response
from api.models import AppIOSDeveloperInfo,APPSuperSignUsedInfo,AppUDID,UDIDsyncDeveloper
from api.utils.serializer import DeveloperSerializer, SuperSignUsedSerializer,DeviceUDIDSerializer,get_developer_udided
from api.utils.serializer import DeveloperSerializer, SuperSignUsedSerializer,DeviceUDIDSerializer,get_developer_devices
from rest_framework.pagination import PageNumberPagination
from api.utils.app.supersignutils import IosUtils
from django.db.models import Sum,F
@ -32,24 +31,7 @@ class DeveloperView(APIView):
appid = request.query_params.get("appid", None)
developer_obj = AppIOSDeveloperInfo.objects.filter(user_id=request.user)
other_used_sum=0
flyapp_used_sum=0
for dev_obj in developer_obj:
other_used,flyapp_used=get_developer_udided(dev_obj)
other_used_sum+=other_used
flyapp_used_sum+=flyapp_used
use_number_obj = developer_obj.filter(is_actived=True)
if use_number_obj:
use_number_dict=use_number_obj.aggregate(usable_number=Sum('usable_number'),use_number=Sum('use_number'))
res.use_num={
"all_usable_number":use_number_dict.get("usable_number", 0),
"all_use_number":use_number_dict.get("use_number", 0),
"other_used_sum":other_used_sum,
"flyapp_used_sum":flyapp_used_sum,
}
res.use_num=get_developer_devices(developer_obj)
if appid:
developer_obj=developer_obj.filter(email=appid)

Loading…
Cancel
Save