超级签下载次数消化更换

pull/15/head
youngS 4 years ago
parent a39e3f623d
commit 04df14d919
  1. 9
      fir_ser/api/utils/app/supersignutils.py
  2. 9
      fir_ser/api/utils/storage/caches.py
  3. 6
      fir_ser/api/views/download.py

@ -12,7 +12,8 @@ from api.utils.app.iossignapi import ResignApp, AppDeveloperApiV2
from api.models import APPSuperSignUsedInfo, AppUDID, AppIOSDeveloperInfo, AppReleaseInfo, Apps, APPToDeveloper, \ from api.models import APPSuperSignUsedInfo, AppUDID, AppIOSDeveloperInfo, AppReleaseInfo, Apps, APPToDeveloper, \
UDIDsyncDeveloper, DeveloperAppID, DeveloperDevicesID UDIDsyncDeveloper, DeveloperAppID, DeveloperDevicesID
from api.utils.app.randomstrings import make_app_uuid, make_from_user_uuid from api.utils.app.randomstrings import make_app_uuid, make_from_user_uuid
from api.utils.storage.caches import del_cache_response_by_short, send_msg_over_limit, check_app_permission from api.utils.storage.caches import del_cache_response_by_short, send_msg_over_limit, check_app_permission, \
consume_user_download_times_by_app_obj
from api.utils.utils import delete_app_to_dev_and_file, send_ios_developer_active_status, delete_local_files, \ from api.utils.utils import delete_app_to_dev_and_file, send_ios_developer_active_status, delete_local_files, \
download_files_form_oss, get_developer_udided download_files_form_oss, get_developer_udided
from api.utils.baseutils import file_format_path, delete_app_profile_file, get_profile_full_path, get_user_domain_name, \ from api.utils.baseutils import file_format_path, delete_app_profile_file, get_profile_full_path, get_user_domain_name, \
@ -465,6 +466,12 @@ class IosUtils(object):
if res.code != 1000: if res.code != 1000:
return False, {'code': res.code, 'msg': res.msg} return False, {'code': res.code, 'msg': res.msg}
if consume_user_download_times_by_app_obj(self.app_obj):
d_result['code'] = 1009
d_result['msg'] = '可用下载额度不足,请联系开发者'
logger.error(d_result)
return False, d_result
if not self.developer_obj: if not self.developer_obj:
msg = "udid %s app %s not exists apple developer" % (self.udid_info.get('udid'), self.app_obj) msg = "udid %s app %s not exists apple developer" % (self.udid_info.get('udid'), self.app_obj)
d_result['code'] = 1005 d_result['code'] = 1005

@ -382,6 +382,15 @@ def check_user_has_all_download_times(app_obj):
user_id) user_id)
def consume_user_download_times_by_app_obj(app_obj):
user_id = app_obj.user_id_id
auth_status = get_user_cert_auth_status(user_id)
amount = get_app_d_count_by_app_id(app_obj.app_id)
if consume_user_download_times(user_id, app_obj.app_id, amount, auth_status):
return False
return True
def user_auth_success(user_id): def user_auth_success(user_id):
''' '''
认证成功需要调用该方法增加次数 认证成功需要调用该方法增加次数

@ -230,9 +230,9 @@ class InstallView(APIView):
logger.info("remote ip %s short %s download_url %s app_obj %s" % (ip, short, download_url, app_obj)) logger.info("remote ip %s short %s download_url %s app_obj %s" % (ip, short, download_url, app_obj))
set_app_download_by_cache(app_id) set_app_download_by_cache(app_id)
amount = app_obj.get("d_count") amount = app_obj.get("d_count")
# 超级签需要多消耗2倍下载次数 # # 超级签需要多消耗2倍下载次数
if app_obj.get("issupersign"): # if app_obj.get("issupersign"):
amount *= 2 # amount *= 2
auth_status = False auth_status = False
status = app_obj.get('user_id__certification__status', None) status = app_obj.get('user_id__certification__status', None)
if status and status == 1: if status and status == 1:

Loading…
Cancel
Save