优化代码目录结构

dependabot/npm_and_yarn/fir_admin/url-parse-1.5.10
nineven 3 years ago
parent 518fc3101e
commit 42bab0739b
  1. 2
      fir_ser/admin/utils/serializer.py
  2. 4
      fir_ser/admin/views/app.py
  3. 2
      fir_ser/admin/views/celery_flower.py
  4. 4
      fir_ser/admin/views/domain.py
  5. 8
      fir_ser/admin/views/login.py
  6. 4
      fir_ser/admin/views/order.py
  7. 2
      fir_ser/admin/views/report.py
  8. 2
      fir_ser/admin/views/storage.py
  9. 2
      fir_ser/admin/views/supersign.py
  10. 6
      fir_ser/admin/views/user.py
  11. 6
      fir_ser/api/base_views.py
  12. 6
      fir_ser/api/migrations/0020_auto_20211104_1118.py
  13. 27
      fir_ser/api/migrations/0035_auto_20220214_2042.py
  14. 9
      fir_ser/api/models.py
  15. 8
      fir_ser/api/tasks.py
  16. 4
      fir_ser/api/utils/app/apputils.py
  17. 7
      fir_ser/api/utils/app/iossignapi.py
  18. 12
      fir_ser/api/utils/app/supersignutils.py
  19. 9
      fir_ser/api/utils/crontab/ctasks.py
  20. 2
      fir_ser/api/utils/crontab/iproxy.py
  21. 5
      fir_ser/api/utils/pay/__init__.py
  22. 12
      fir_ser/api/utils/serializer.py
  23. 16
      fir_ser/api/utils/utils.py
  24. 6
      fir_ser/api/views/advert.py
  25. 12
      fir_ser/api/views/apps.py
  26. 4
      fir_ser/api/views/domain.py
  27. 10
      fir_ser/api/views/download.py
  28. 14
      fir_ser/api/views/login.py
  29. 2
      fir_ser/api/views/logout.py
  30. 6
      fir_ser/api/views/order.py
  31. 6
      fir_ser/api/views/receiveudids.py
  32. 6
      fir_ser/api/views/report.py
  33. 2
      fir_ser/api/views/storage.py
  34. 18
      fir_ser/api/views/supersign.py
  35. 8
      fir_ser/api/views/thirdlogin.py
  36. 8
      fir_ser/api/views/uploads.py
  37. 2
      fir_ser/cli/views/apps.py
  38. 2
      fir_ser/cli/views/login.py
  39. 2
      fir_ser/cli/views/uploads.py
  40. 0
      fir_ser/common/base/daobase.py
  41. 0
      fir_ser/common/core/auth.py
  42. 16
      fir_ser/common/core/dbrouter.py
  43. 0
      fir_ser/common/core/decorators.py
  44. 0
      fir_ser/common/core/exception.py
  45. 64
      fir_ser/common/core/sysconfig.py
  46. 0
      fir_ser/common/core/throttle.py
  47. 2
      fir_ser/common/libs/apple/appleapiv3.py
  48. 0
      fir_ser/common/libs/geetest/geetest_lib.py
  49. 0
      fir_ser/common/libs/geetest/geetest_lib_result.py
  50. 4
      fir_ser/common/libs/geetest/geetest_utils.py
  51. 0
      fir_ser/common/libs/mp/__init__.py
  52. 0
      fir_ser/common/libs/mp/chat/__init__.py
  53. 0
      fir_ser/common/libs/mp/chat/receive.py
  54. 0
      fir_ser/common/libs/mp/chat/reply.py
  55. 0
      fir_ser/common/libs/mp/ierror.py
  56. 0
      fir_ser/common/libs/mp/utils.py
  57. 4
      fir_ser/common/libs/mp/wechat.py
  58. 4
      fir_ser/common/libs/pay/ali.py
  59. 0
      fir_ser/common/libs/pay/alipay/__init__.py
  60. 0
      fir_ser/common/libs/pay/alipay/exceptions.py
  61. 0
      fir_ser/common/libs/pay/alipay/loggers.py
  62. 11
      fir_ser/common/libs/pay/util.py
  63. 4
      fir_ser/common/libs/pay/wx.py
  64. 0
      fir_ser/common/libs/pay/wxpay/__init__.py
  65. 0
      fir_ser/common/libs/pay/wxpay/core.py
  66. 0
      fir_ser/common/libs/sendmsg/aliyunApi.py
  67. 0
      fir_ser/common/libs/sendmsg/emailApi.py
  68. 0
      fir_ser/common/libs/sendmsg/jiguangApi.py
  69. 0
      fir_ser/common/libs/storage/aliyunApi.py
  70. 2
      fir_ser/common/libs/storage/localApi.py
  71. 0
      fir_ser/common/libs/storage/qiniuApi.py
  72. 8
      fir_ser/common/utils/caches.py
  73. 11
      fir_ser/common/utils/sendmsg.py
  74. 14
      fir_ser/common/utils/storage.py
  75. 20
      fir_ser/config.py
  76. 41
      fir_ser/fir_ser/settings.py

@ -7,8 +7,8 @@ from api import models
from api.utils.serializer import AppReleaseSerializer, UserInfoSerializer, AppsSerializer, StorageSerializer, \ from api.utils.serializer import AppReleaseSerializer, UserInfoSerializer, AppsSerializer, StorageSerializer, \
DeveloperSerializer, SuperSignUsedSerializer, ThirdWxSerializer, DomainNameSerializer, BillInfoSerializer, \ DeveloperSerializer, SuperSignUsedSerializer, ThirdWxSerializer, DomainNameSerializer, BillInfoSerializer, \
AppReportSerializer AppReportSerializer
from api.utils.storage.storage import Storage
from common.base.baseutils import get_choices_dict, get_choices_name_from_key from common.base.baseutils import get_choices_dict, get_choices_name_from_key
from common.utils.storage import Storage
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -15,8 +15,8 @@ from admin.utils.utils import AppsPageNumber, ApiResponse, BaseModelSet
from api.base_views import app_delete from api.base_views import app_delete
from api.models import AppReleaseInfo, Apps from api.models import AppReleaseInfo, Apps
from api.utils.TokenManager import verify_token from api.utils.TokenManager import verify_token
from api.utils.auth import AdminTokenAuthentication from common.core.auth import AdminTokenAuthentication
from api.utils.storage.caches import del_cache_response_by_short, get_download_url_by_cache from common.utils.caches import del_cache_response_by_short, get_download_url_by_cache
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -6,7 +6,7 @@ from django.utils.translation import ugettext as _
from proxy.views import proxy_view from proxy.views import proxy_view
from rest_framework.views import APIView from rest_framework.views import APIView
from api.utils.auth import AdminTokenAuthentication from common.core.auth import AdminTokenAuthentication
flower_url = f'{settings.CELERY_FLOWER_HOST}:{settings.CELERY_FLOWER_PORT}' flower_url = f'{settings.CELERY_FLOWER_HOST}:{settings.CELERY_FLOWER_PORT}'

@ -13,8 +13,8 @@ from rest_framework.filters import OrderingFilter
from admin.utils.serializer import AdminDomainNameSerializer from admin.utils.serializer import AdminDomainNameSerializer
from admin.utils.utils import BaseModelSet, AppsPageNumber, ApiResponse from admin.utils.utils import BaseModelSet, AppsPageNumber, ApiResponse
from api.models import UserDomainInfo from api.models import UserDomainInfo
from api.utils.auth import AdminTokenAuthentication from common.core.auth import AdminTokenAuthentication
from api.utils.storage.caches import reset_app_wx_easy_type from common.utils.caches import reset_app_wx_easy_type
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -10,12 +10,12 @@ from django.contrib import auth
from rest_framework.views import APIView from rest_framework.views import APIView
from admin.utils.utils import ApiResponse from admin.utils.utils import ApiResponse
from api.utils.auth import ExpiringTokenAuthentication
from api.utils.serializer import UserInfoSerializer from api.utils.serializer import UserInfoSerializer
from api.utils.storage.caches import login_auth_failed
from api.utils.sysconfig import Config
from api.utils.throttle import VisitRegister1Throttle, VisitRegister2Throttle
from api.utils.utils import get_captcha, valid_captcha, set_user_token from api.utils.utils import get_captcha, valid_captcha, set_user_token
from common.core.auth import ExpiringTokenAuthentication
from common.core.sysconfig import Config
from common.core.throttle import VisitRegister1Throttle, VisitRegister2Throttle
from common.utils.caches import login_auth_failed
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -13,8 +13,8 @@ from rest_framework.filters import OrderingFilter
from admin.utils.serializer import AdminOrdersSerializer from admin.utils.serializer import AdminOrdersSerializer
from admin.utils.utils import BaseModelSet, AppsPageNumber, ApiResponse from admin.utils.utils import BaseModelSet, AppsPageNumber, ApiResponse
from api.models import UserInfo, Order from api.models import UserInfo, Order
from api.utils.auth import AdminTokenAuthentication from common.core.auth import AdminTokenAuthentication
from api.utils.storage.caches import update_order_info, admin_change_user_download_times from common.utils.caches import update_order_info, admin_change_user_download_times
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -13,7 +13,7 @@ from rest_framework.filters import OrderingFilter
from admin.utils.serializer import AdminAppReportSerializer from admin.utils.serializer import AdminAppReportSerializer
from admin.utils.utils import AppsPageNumber, BaseModelSet from admin.utils.utils import AppsPageNumber, BaseModelSet
from api.models import AppReportInfo from api.models import AppReportInfo
from api.utils.auth import AdminTokenAuthentication from common.core.auth import AdminTokenAuthentication
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -16,8 +16,8 @@ from admin.utils.serializer import AdminStorageSerializer
from admin.utils.utils import AppsPageNumber, BaseModelSet, ApiResponse from admin.utils.utils import AppsPageNumber, BaseModelSet, ApiResponse
from api.base_views import storage_change from api.base_views import storage_change
from api.models import UserInfo, AppStorage from api.models import UserInfo, AppStorage
from api.utils.auth import AdminTokenAuthentication
from common.base.baseutils import format_storage_selection from common.base.baseutils import format_storage_selection
from common.core.auth import AdminTokenAuthentication
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -14,10 +14,10 @@ from rest_framework.views import APIView
from admin.utils.serializer import AdminDeveloperSerializer, AdminSuperSignUsedSerializer, AdminBillInfoSerializer from admin.utils.serializer import AdminDeveloperSerializer, AdminSuperSignUsedSerializer, AdminBillInfoSerializer
from admin.utils.utils import AppsPageNumber, BaseModelSet, ApiResponse from admin.utils.utils import AppsPageNumber, BaseModelSet, ApiResponse
from api.models import APPSuperSignUsedInfo, AppIOSDeveloperInfo, IosDeveloperPublicPoolBill, IosDeveloperBill from api.models import APPSuperSignUsedInfo, AppIOSDeveloperInfo, IosDeveloperPublicPoolBill, IosDeveloperBill
from api.utils.auth import AdminTokenAuthentication
from api.utils.modelutils import get_user_public_used_sign_num, get_user_public_sign_num, get_user_obj_from_epu from api.utils.modelutils import get_user_public_used_sign_num, get_user_public_sign_num, get_user_obj_from_epu
from api.utils.utils import get_developer_devices from api.utils.utils import get_developer_devices
from common.base.baseutils import get_real_ip_address from common.base.baseutils import get_real_ip_address
from common.core.auth import AdminTokenAuthentication
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -14,10 +14,10 @@ from rest_framework.views import APIView
from admin.utils.serializer import AdminUserInfoSerializer, AdminUserCertificationSerializer, AdminThirdWxSerializer from admin.utils.serializer import AdminUserInfoSerializer, AdminUserCertificationSerializer, AdminThirdWxSerializer
from admin.utils.utils import AppsPageNumber, BaseModelSet, ApiResponse from admin.utils.utils import AppsPageNumber, BaseModelSet, ApiResponse
from api.models import UserInfo, UserCertificationInfo, ThirdWeChatUserInfo from api.models import UserInfo, UserCertificationInfo, ThirdWeChatUserInfo
from api.utils.auth import AdminTokenAuthentication
from api.utils.storage.caches import auth_user_download_times_gift
from api.utils.sysconfig import Config
from common.base.baseutils import get_dict_from_filter_fields from common.base.baseutils import get_dict_from_filter_fields
from common.core.auth import AdminTokenAuthentication
from common.core.sysconfig import Config
from common.utils.caches import auth_user_download_times_gift
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -9,12 +9,12 @@ import logging
from api.models import AppReleaseInfo, APPToDeveloper, UserInfo, AppScreenShot, AppStorage from api.models import AppReleaseInfo, APPToDeveloper, UserInfo, AppScreenShot, AppStorage
from api.utils.app.supersignutils import IosUtils from api.utils.app.supersignutils import IosUtils
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.storage.caches import del_cache_response_by_short, del_cache_by_delete_app, \
del_cache_storage
from api.utils.storage.storage import Storage
from api.utils.utils import delete_local_files, delete_app_screenshots_files, change_storage_and_change_head_img, \ from api.utils.utils import delete_local_files, delete_app_screenshots_files, change_storage_and_change_head_img, \
migrating_storage_data, clean_storage_data, check_storage_is_new_storage migrating_storage_data, clean_storage_data, check_storage_is_new_storage
from common.cache.state import MigrateStorageState from common.cache.state import MigrateStorageState
from common.utils.caches import del_cache_response_by_short, del_cache_by_delete_app, \
del_cache_storage
from common.utils.storage import Storage
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -2,7 +2,7 @@
from django.db import migrations, models from django.db import migrations, models
import api.utils.daobase import common.base.daobase
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -28,11 +28,11 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='appiosdeveloperinfo', model_name='appiosdeveloperinfo',
name='p8key', name='p8key',
field=api.utils.daobase.AESCharField(max_length=512, verbose_name='p8key'), field=common.base.daobase.AESCharField(max_length=512, verbose_name='p8key'),
), ),
migrations.AlterField( migrations.AlterField(
model_name='appstorage', model_name='appstorage',
name='secret_key', name='secret_key',
field=api.utils.daobase.AESCharField(blank=True, max_length=128, null=True, verbose_name='存储访问secret'), field=common.base.daobase.AESCharField(blank=True, max_length=128, null=True, verbose_name='存储访问secret'),
), ),
] ]

@ -0,0 +1,27 @@
# Generated by Django 3.2.3 on 2022-02-14 20:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0034_auto_20220208_0941'),
]
operations = [
migrations.AddField(
model_name='systemconfig',
name='enable',
field=models.BooleanField(default=True, verbose_name='是否启用该配置项'),
),
migrations.AlterField(
model_name='systemconfig',
name='key',
field=models.CharField(max_length=128, unique=True, verbose_name='配置名称'),
),
migrations.AlterField(
model_name='systemconfig',
name='value',
field=models.TextField(max_length=10240, verbose_name='配置值'),
),
]

@ -4,9 +4,9 @@ from django.db import models
from django.db.models import Count from django.db.models import Count
from api.utils.TokenManager import generate_alphanumeric_token_of_length, generate_numeric_token_of_length from api.utils.TokenManager import generate_alphanumeric_token_of_length, generate_numeric_token_of_length
######################################## 用户表 ########################################
from api.utils.daobase import AESCharField
from common.base.baseutils import make_random_uuid from common.base.baseutils import make_random_uuid
######################################## 用户表 ########################################
from common.base.daobase import AESCharField
# Create your models here. # Create your models here.
@ -651,8 +651,9 @@ class AppleDeveloperToAppUse(models.Model):
class SystemConfig(models.Model): class SystemConfig(models.Model):
key = models.CharField(max_length=256, unique=True, verbose_name="配置名称") key = models.CharField(max_length=128, unique=True, verbose_name="配置名称")
value = models.CharField(max_length=512, verbose_name="配置值") value = models.TextField(max_length=10240, verbose_name="配置值")
enable = models.BooleanField(default=True, verbose_name="是否启用该配置项")
description = models.CharField(verbose_name="备注", max_length=256, default='', blank=True) description = models.CharField(verbose_name="备注", max_length=256, default='', blank=True)
updated_time = models.DateTimeField(auto_now=True, verbose_name="更新时间") updated_time = models.DateTimeField(auto_now=True, verbose_name="更新时间")

@ -14,12 +14,12 @@ from api.utils.app.supersignutils import IosUtils, resign_by_app_id_and_develope
from api.utils.crontab.ctasks import sync_download_times, auto_clean_upload_tmp_file, auto_delete_ios_mobile_tmp_file, \ from api.utils.crontab.ctasks import sync_download_times, auto_clean_upload_tmp_file, auto_delete_ios_mobile_tmp_file, \
auto_check_ios_developer_active auto_check_ios_developer_active
from api.utils.crontab.iproxy import get_best_proxy_ips, clean_ip_proxy_infos from api.utils.crontab.iproxy import get_best_proxy_ips, clean_ip_proxy_infos
from api.utils.geetest.geetest_utils import check_bypass_status
from api.utils.mp.wechat import sync_wx_access_token
from api.utils.storage.storage import get_local_storage
from api.utils.sysconfig import Config, invalid_config_cache
from api.views.login import get_login_type from api.views.login import get_login_type
from common.cache.state import MigrateStorageState from common.cache.state import MigrateStorageState
from common.core.sysconfig import Config, invalid_config_cache
from common.libs.geetest.geetest_utils import check_bypass_status
from common.libs.mp.wechat import sync_wx_access_token
from common.utils.storage import get_local_storage
from fir_ser.celery import app from fir_ser.celery import app
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -8,10 +8,10 @@ import random
from api.models import AppReleaseInfo, Apps from api.models import AppReleaseInfo, Apps
from api.utils.modelutils import get_user_domain_name from api.utils.modelutils import get_user_domain_name
from api.utils.storage.caches import del_cache_response_by_short
from api.utils.storage.storage import Storage
from common.base.baseutils import make_app_uuid from common.base.baseutils import make_app_uuid
from common.cache.state import MigrateStorageState from common.cache.state import MigrateStorageState
from common.utils.caches import del_cache_response_by_short
from common.utils.storage import Storage
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -15,10 +15,11 @@ from OpenSSL.crypto import (load_pkcs12, dump_certificate_request, dump_privatek
from api.models import AppIOSDeveloperInfo from api.models import AppIOSDeveloperInfo
from api.utils.app.shellcmds import shell_command, use_user_pass from api.utils.app.shellcmds import shell_command, use_user_pass
from api.utils.apple.appleapiv3 import AppStoreConnectApi
from common.base.baseutils import get_format_time, format_apple_date, make_app_uuid from common.base.baseutils import get_format_time, format_apple_date, make_app_uuid
from common.cache.state import CleanErrorBundleIdSignDataState from common.cache.state import CleanErrorBundleIdSignDataState
from fir_ser.settings import SUPER_SIGN_ROOT, DEVELOPER_WRITE_STATUS from common.core.sysconfig import Config
from common.libs.apple.appleapiv3 import AppStoreConnectApi
from fir_ser.settings import SUPER_SIGN_ROOT
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -238,7 +239,7 @@ class AppDeveloperApiV2(object):
return attr(*args, **kwargs) return attr(*args, **kwargs)
else: else:
if AppIOSDeveloperInfo.objects.filter(pk=self.developer_pk, if AppIOSDeveloperInfo.objects.filter(pk=self.developer_pk,
status__in=DEVELOPER_WRITE_STATUS).first(): status__in=Config.DEVELOPER_WRITE_STATUS).first():
start_time = time.time() start_time = time.time()
logger.info(f'{self.issuer_id} calling {attr.__name__} time:{start_time}') logger.info(f'{self.issuer_id} calling {attr.__name__} time:{start_time}')
result = attr(*args, **kwargs) result = attr(*args, **kwargs)

@ -23,17 +23,17 @@ from api.utils.modelutils import get_ios_developer_public_num, check_ipa_is_late
update_or_create_developer_udid_info, check_uid_has_relevant update_or_create_developer_udid_info, check_uid_has_relevant
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import BillAppInfoSerializer, BillDeveloperInfoSerializer from api.utils.serializer import BillAppInfoSerializer, BillDeveloperInfoSerializer
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, add_udid_cache_queue, get_and_clean_udid_cache_queue
from api.utils.storage.storage import Storage
from api.utils.sysconfig import Config
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 common.base.baseutils import file_format_path, delete_app_profile_file, get_profile_full_path, format_apple_date, \ from common.base.baseutils import file_format_path, delete_app_profile_file, get_profile_full_path, format_apple_date, \
get_format_time, make_app_uuid, make_from_user_uuid get_format_time, make_app_uuid, make_from_user_uuid
from common.base.magic import run_function_by_locker, call_function_try_attempts from common.base.magic import run_function_by_locker, call_function_try_attempts
from common.cache.state import CleanErrorBundleIdSignDataState from common.cache.state import CleanErrorBundleIdSignDataState
from fir_ser.settings import SUPER_SIGN_ROOT, MEDIA_ROOT, DEVELOPER_USE_STATUS from common.core.sysconfig import Config
from common.utils.caches import del_cache_response_by_short, send_msg_over_limit, check_app_permission, \
consume_user_download_times_by_app_obj, add_udid_cache_queue, get_and_clean_udid_cache_queue
from common.utils.storage import Storage
from fir_ser.settings import SUPER_SIGN_ROOT, MEDIA_ROOT
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -286,7 +286,7 @@ def get_developer_user_by_app_udid(user_objs, udid, app_obj, private_first=True,
""" """
if read_only: if read_only:
status_choice = DEVELOPER_USE_STATUS status_choice = Config.DEVELOPER_USE_STATUS
else: else:
status_choice = [1] status_choice = [1]
status_filter = {'developerid__certid__isnull': False, 'developerid__status__in': status_choice} status_filter = {'developerid__certid__isnull': False, 'developerid__status__in': status_choice}

@ -12,10 +12,10 @@ from django.core.cache import cache
from api.models import Apps, UserInfo, AppIOSDeveloperInfo from api.models import Apps, UserInfo, AppIOSDeveloperInfo
from api.utils.app.supersignutils import IosUtils from api.utils.app.supersignutils import IosUtils
from api.utils.storage.storage import Storage
from api.utils.sysconfig import Config
from api.utils.utils import send_ios_developer_active_status from api.utils.utils import send_ios_developer_active_status
from fir_ser.settings import CACHE_KEY_TEMPLATE, SYNC_CACHE_TO_DATABASE, SUPER_SIGN_ROOT, DEVELOPER_AUTO_CHECK_STATUS from common.core.sysconfig import Config
from common.utils.storage import Storage
from fir_ser.settings import CACHE_KEY_TEMPLATE, SYNC_CACHE_TO_DATABASE, SUPER_SIGN_ROOT
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -66,7 +66,8 @@ def auto_delete_ios_mobile_tmp_file():
def auto_check_ios_developer_active(): def auto_check_ios_developer_active():
all_ios_developer = AppIOSDeveloperInfo.objects.filter(status__in=DEVELOPER_AUTO_CHECK_STATUS, auto_check=True) all_ios_developer = AppIOSDeveloperInfo.objects.filter(status__in=Config.DEVELOPER_AUTO_CHECK_STATUS,
auto_check=True)
error_issuer_id = {} error_issuer_id = {}
for ios_developer in all_ios_developer: for ios_developer in all_ios_developer:
userinfo = ios_developer.user_id userinfo = ios_developer.user_id

@ -10,8 +10,8 @@ from concurrent.futures import ThreadPoolExecutor
import requests import requests
from api.utils.sysconfig import Config
from common.cache.storage import IpProxyListCache, IpProxyActiveCache from common.cache.storage import IpProxyListCache, IpProxyActiveCache
from common.core.sysconfig import Config
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -1,5 +0,0 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# project: 5月
# author: NinEveN
# date: 2021/5/27

@ -8,12 +8,12 @@ from api import models
from api.utils.TokenManager import make_token from api.utils.TokenManager import make_token
from api.utils.app.apputils import bytes2human from api.utils.app.apputils import bytes2human
from api.utils.modelutils import get_user_domain_name, get_app_domain_name, get_app_download_uri from api.utils.modelutils import get_user_domain_name, get_app_domain_name, get_app_download_uri
from api.utils.storage.caches import get_user_free_download_times, get_user_cert_auth_status
from api.utils.storage.storage import Storage
from api.utils.utils import get_developer_udided from api.utils.utils import get_developer_udided
from common.base.baseutils import get_choices_dict, AppleDeveloperUid from common.base.baseutils import get_choices_dict, AppleDeveloperUid
from common.cache.storage import AdPicShowCache from common.cache.storage import AdPicShowCache
from fir_ser.settings import DEVELOPER_USE_STATUS, DEVELOPER_UID_KEY from common.core.sysconfig import Config
from common.utils.caches import get_user_free_download_times, get_user_cert_auth_status
from common.utils.storage import Storage
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -422,7 +422,7 @@ class DeveloperSerializer(serializers.ModelSerializer):
app_id = self.context.get('app_id', '') app_id = self.context.get('app_id', '')
if app_id: if app_id:
developer_app_obj = models.DeveloperAppID.objects.filter(developerid=obj, developer_app_obj = models.DeveloperAppID.objects.filter(developerid=obj,
developerid__status__in=DEVELOPER_USE_STATUS, developerid__status__in=Config.DEVELOPER_USE_STATUS,
developerid__certid__isnull=False) developerid__certid__isnull=False)
if developer_app_obj.filter(app_id__app_id=app_id).distinct().count(): if developer_app_obj.filter(app_id__app_id=app_id).distinct().count():
return False return False
@ -477,7 +477,7 @@ class SuperSignUsedSerializer(serializers.ModelSerializer):
if self.context.get('mine'): if self.context.get('mine'):
return issuer_id return issuer_id
else: else:
return f"{DEVELOPER_UID_KEY}{AppleDeveloperUid().get_encrypt_uid(issuer_id)}" return f"{Config.DEVELOPER_UID_KEY}{AppleDeveloperUid().get_encrypt_uid(issuer_id)}"
def get_developer_description(self, obj): def get_developer_description(self, obj):
if self.context.get('mine'): if self.context.get('mine'):
@ -528,7 +528,7 @@ class DeviceUDIDSerializer(serializers.ModelSerializer):
if self.context.get('mine'): if self.context.get('mine'):
return issuer_id return issuer_id
else: else:
return f"{DEVELOPER_UID_KEY}{AppleDeveloperUid().get_encrypt_uid(issuer_id)}" return f"{Config.DEVELOPER_UID_KEY}{AppleDeveloperUid().get_encrypt_uid(issuer_id)}"
def get_developer_status(self, obj): def get_developer_status(self, obj):
return obj.udid.developerid.get_status_display() return obj.udid.developerid.get_status_display()

@ -17,14 +17,14 @@ from api.models import APPSuperSignUsedInfo, APPToDeveloper, \
from api.utils.TokenManager import generate_numeric_token_of_length, generate_alphanumeric_token_of_length, make_token, \ from api.utils.TokenManager import generate_numeric_token_of_length, generate_alphanumeric_token_of_length, make_token, \
verify_token verify_token
from api.utils.modelutils import get_app_d_count_by_app_id from api.utils.modelutils import get_app_d_count_by_app_id
from api.utils.sendmsg.sendmsg import SendMessage
from api.utils.storage.caches import consume_user_download_times
from api.utils.storage.localApi import LocalStorage
from api.utils.storage.storage import Storage
from api.utils.sysconfig import Config
from common.base.baseutils import get_real_ip_address from common.base.baseutils import get_real_ip_address
from common.cache.storage import UserTokenCache, TempCache from common.cache.storage import UserTokenCache, TempCache
from fir_ser.settings import CAPTCHA_LENGTH, MEDIA_ROOT, DEVELOPER_USE_STATUS from common.core.sysconfig import Config
from common.libs.storage.localApi import LocalStorage
from common.utils.caches import consume_user_download_times
from common.utils.sendmsg import SendMessage
from common.utils.storage import Storage
from fir_ser.settings import CAPTCHA_LENGTH, MEDIA_ROOT
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -62,13 +62,13 @@ def get_developer_devices(developer_obj_lists):
other_used_sum = 0 other_used_sum = 0
flyapp_used_sum = 0 flyapp_used_sum = 0
max_total = 0 max_total = 0
for dev_obj in developer_obj_lists.filter(status__in=DEVELOPER_USE_STATUS): for dev_obj in developer_obj_lists.filter(status__in=Config.DEVELOPER_USE_STATUS):
other_used, flyapp_used, _ = get_developer_udided(dev_obj) other_used, flyapp_used, _ = get_developer_udided(dev_obj)
other_used_sum += other_used other_used_sum += other_used
flyapp_used_sum += flyapp_used flyapp_used_sum += flyapp_used
max_total += 100 max_total += 100
use_number_obj_list = developer_obj_lists.filter(status__in=DEVELOPER_USE_STATUS) use_number_obj_list = developer_obj_lists.filter(status__in=Config.DEVELOPER_USE_STATUS)
all_use_number = 0 all_use_number = 0
all_usable_number = 0 all_usable_number = 0
for use_number_obj in use_number_obj_list: for use_number_obj in use_number_obj_list:

@ -9,12 +9,12 @@ from rest_framework.response import Response
from rest_framework.views import APIView from rest_framework.views import APIView
from api.models import UserAdDisplayInfo from api.models import UserAdDisplayInfo
from api.utils.auth import ExpiringTokenAuthentication, UserAdInfoPermission
from api.utils.modelutils import PageNumber from api.utils.modelutils import PageNumber
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import UserAdInfoSerializer from api.utils.serializer import UserAdInfoSerializer
from api.utils.storage.caches import reset_short_response_cache from common.core.auth import ExpiringTokenAuthentication, UserAdInfoPermission
from api.utils.storage.storage import Storage from common.utils.caches import reset_short_response_cache
from common.utils.storage import Storage
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -15,15 +15,15 @@ from api.base_views import app_delete
from api.models import Apps, AppReleaseInfo, APPToDeveloper, UserInfo, AppScreenShot, AppUDID from api.models import Apps, AppReleaseInfo, APPToDeveloper, UserInfo, AppScreenShot, AppUDID
from api.tasks import run_resign_task from api.tasks import run_resign_task
from api.utils.app.supersignutils import IosUtils from api.utils.app.supersignutils import IosUtils
from api.utils.auth import ExpiringTokenAuthentication
from api.utils.modelutils import get_user_domain_name, get_app_domain_name, check_super_sign_permission from api.utils.modelutils import get_user_domain_name, get_app_domain_name, check_super_sign_permission
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import AppsSerializer, AppReleaseSerializer, AppsListSerializer, AppsQrListSerializer from api.utils.serializer import AppsSerializer, AppReleaseSerializer, AppsListSerializer, AppsQrListSerializer
from api.utils.storage.caches import del_cache_response_by_short, get_app_today_download_times, del_cache_by_delete_app
from api.utils.storage.storage import Storage
from api.utils.utils import delete_local_files, delete_app_screenshots_files from api.utils.utils import delete_local_files, delete_app_screenshots_files
from common.cache.state import MigrateStorageState, CleanAppSignDataState from common.cache.state import MigrateStorageState, CleanAppSignDataState
from fir_ser.settings import DEVELOPER_WRITE_STATUS from common.core.auth import ExpiringTokenAuthentication
from common.core.sysconfig import Config
from common.utils.caches import del_cache_response_by_short, get_app_today_download_times, del_cache_by_delete_app
from common.utils.storage import Storage
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -258,7 +258,7 @@ class AppInfoView(APIView):
if app_obj.change_auto_sign: if app_obj.change_auto_sign:
flag = False flag = False
if AppUDID.objects.filter(app_id=app_obj, sign_status=2, if AppUDID.objects.filter(app_id=app_obj, sign_status=2,
udid__developerid__status__in=DEVELOPER_WRITE_STATUS).first(): udid__developerid__status__in=Config.DEVELOPER_WRITE_STATUS).first():
flag = True flag = True
c_task = run_resign_task(app_obj.pk, flag) c_task = run_resign_task(app_obj.pk, flag)
@ -266,7 +266,7 @@ class AppInfoView(APIView):
if app_obj.change_auto_sign: if app_obj.change_auto_sign:
flag = False flag = False
if AppUDID.objects.filter(app_id=app_obj, sign_status=2, if AppUDID.objects.filter(app_id=app_obj, sign_status=2,
udid__developerid__status__in=DEVELOPER_WRITE_STATUS).first(): udid__developerid__status__in=Config.DEVELOPER_WRITE_STATUS).first():
flag = True flag = True
c_task = run_resign_task(app_obj.pk, flag, False) c_task = run_resign_task(app_obj.pk, flag, False)

@ -9,12 +9,12 @@ from rest_framework.response import Response
from rest_framework.views import APIView from rest_framework.views import APIView
from api.models import UserDomainInfo, Apps from api.models import UserDomainInfo, Apps
from api.utils.auth import ExpiringTokenAuthentication
from api.utils.modelutils import get_user_domain_name, get_min_default_domain_cname_obj, PageNumber from api.utils.modelutils import get_user_domain_name, get_min_default_domain_cname_obj, PageNumber
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import DomainNameSerializer from api.utils.serializer import DomainNameSerializer
from api.utils.storage.caches import del_cache_response_by_short, reset_app_wx_easy_type
from common.base.baseutils import is_valid_domain, get_cname_from_domain, get_choices_dict from common.base.baseutils import is_valid_domain, get_cname_from_domain, get_choices_dict
from common.core.auth import ExpiringTokenAuthentication
from common.utils.caches import del_cache_response_by_short, reset_app_wx_easy_type
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -15,17 +15,17 @@ from api.models import Apps, AppReleaseInfo, APPToDeveloper, APPSuperSignUsedInf
from api.utils.TokenManager import verify_token from api.utils.TokenManager import verify_token
from api.utils.app.apputils import make_resigned from api.utils.app.apputils import make_resigned
from api.utils.app.supersignutils import make_sign_udid_mobile_config from api.utils.app.supersignutils import make_sign_udid_mobile_config
from api.utils.decorators import cache_response # 本来使用的是 drf-extensions==0.7.0 但是还未支持该版本Django
from api.utils.modelutils import get_filename_form_file, check_app_domain_name_access, \ from api.utils.modelutils import get_filename_form_file, check_app_domain_name_access, \
ad_random_weight, get_app_download_uri ad_random_weight, get_app_download_uri
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import AppsShortSerializer, AppAdInfoSerializer from api.utils.serializer import AppsShortSerializer, AppAdInfoSerializer
from api.utils.storage.caches import check_app_permission, get_app_download_url
from api.utils.storage.storage import Storage, get_local_storage
from api.utils.sysconfig import Config
from api.utils.throttle import VisitShortThrottle, InstallShortThrottle, InstallThrottle1, InstallThrottle2
from common.base.baseutils import get_profile_full_path, make_random_uuid, get_origin_domain_name, \ from common.base.baseutils import get_profile_full_path, make_random_uuid, get_origin_domain_name, \
format_get_uri, get_server_domain_from_request format_get_uri, get_server_domain_from_request
from common.core.decorators import cache_response # 本来使用的是 drf-extensions==0.7.0 但是还未支持该版本Django
from common.core.sysconfig import Config
from common.core.throttle import VisitShortThrottle, InstallShortThrottle, InstallThrottle1, InstallThrottle2
from common.utils.caches import check_app_permission, get_app_download_url
from common.utils.storage import Storage, get_local_storage
from fir_ser import settings from fir_ser import settings
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -5,20 +5,20 @@ from rest_framework.response import Response
from rest_framework.views import APIView from rest_framework.views import APIView
from api.models import UserInfo, UserCertificationInfo, CertificationInfo, Apps from api.models import UserInfo, UserCertificationInfo, CertificationInfo, Apps
from api.utils.auth import ExpiringTokenAuthentication
from api.utils.geetest.geetest_utils import first_register, second_validate
from api.utils.modelutils import get_min_default_domain_cname_obj, add_remote_info_from_request from api.utils.modelutils import get_min_default_domain_cname_obj, add_remote_info_from_request
from api.utils.mp.wechat import make_wx_login_qrcode, show_qrcode_url
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import UserInfoSerializer, CertificationSerializer, UserCertificationSerializer from api.utils.serializer import UserInfoSerializer, CertificationSerializer, UserCertificationSerializer
from api.utils.storage.caches import login_auth_failed, set_wx_ticket_login_info_cache, get_wx_ticket_login_info_cache, \
new_user_download_times_gift
from api.utils.sysconfig import Config
from api.utils.throttle import VisitRegister1Throttle, VisitRegister2Throttle, GetAuthC1Throttle, GetAuthC2Throttle
from api.utils.utils import get_captcha, valid_captcha, \ from api.utils.utils import get_captcha, valid_captcha, \
get_sender_sms_token, is_valid_sender_code, get_sender_email_token, get_random_username, \ get_sender_sms_token, is_valid_sender_code, get_sender_email_token, get_random_username, \
check_username_exists, set_user_token, clean_user_token_and_cache check_username_exists, set_user_token, clean_user_token_and_cache
from common.base.baseutils import is_valid_phone, is_valid_email, get_real_ip_address from common.base.baseutils import is_valid_phone, is_valid_email, get_real_ip_address
from common.core.auth import ExpiringTokenAuthentication
from common.core.sysconfig import Config
from common.core.throttle import VisitRegister1Throttle, VisitRegister2Throttle, GetAuthC1Throttle, GetAuthC2Throttle
from common.libs.geetest.geetest_utils import first_register, second_validate
from common.libs.mp.wechat import make_wx_login_qrcode, show_qrcode_url
from common.utils.caches import login_auth_failed, set_wx_ticket_login_info_cache, get_wx_ticket_login_info_cache, \
new_user_download_times_gift
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -5,8 +5,8 @@ from rest_framework.response import Response
from rest_framework.views import APIView from rest_framework.views import APIView
from api.models import Token from api.models import Token
from api.utils.auth import ExpiringTokenAuthentication
from common.cache.storage import RedisCacheBase from common.cache.storage import RedisCacheBase
from common.core.auth import ExpiringTokenAuthentication
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -10,13 +10,13 @@ from rest_framework.response import Response
from rest_framework.views import APIView from rest_framework.views import APIView
from api.models import Price, Order from api.models import Price, Order
from api.utils.auth import ExpiringTokenAuthentication
from api.utils.modelutils import PageNumber from api.utils.modelutils import PageNumber
from api.utils.pay.util import get_pay_obj_form_name, get_enable_pay_choices, get_payment_type
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import PriceSerializer, OrdersSerializer from api.utils.serializer import PriceSerializer, OrdersSerializer
from api.utils.storage.caches import update_order_status
from common.base.baseutils import get_order_num, get_choices_dict from common.base.baseutils import get_order_num, get_choices_dict
from common.core.auth import ExpiringTokenAuthentication
from common.libs.pay.util import get_pay_obj_form_name, get_enable_pay_choices, get_payment_type
from common.utils.caches import update_order_status
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -17,10 +17,10 @@ from api.utils.app.supersignutils import udid_bytes_to_dict, make_sign_udid_mobi
from api.utils.modelutils import get_redirect_server_domain, add_remote_info_from_request, \ from api.utils.modelutils import get_redirect_server_domain, add_remote_info_from_request, \
get_app_download_uri get_app_download_uri
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.storage.caches import check_app_permission
from api.utils.sysconfig import Config
from api.utils.throttle import ReceiveUdidThrottle1, ReceiveUdidThrottle2
from common.base.baseutils import get_real_ip_address, make_random_uuid, get_server_domain_from_request from common.base.baseutils import get_real_ip_address, make_random_uuid, get_server_domain_from_request
from common.core.sysconfig import Config
from common.core.throttle import ReceiveUdidThrottle1, ReceiveUdidThrottle2
from common.utils.caches import check_app_permission
from fir_ser.celery import app from fir_ser.celery import app
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -12,11 +12,11 @@ from api.models import Apps, AppReportInfo
from api.utils.modelutils import add_remote_info_from_request from api.utils.modelutils import add_remote_info_from_request
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import AppReportSerializer from api.utils.serializer import AppReportSerializer
from api.utils.storage.caches import login_auth_failed
from api.utils.sysconfig import Config
from api.utils.throttle import InstallThrottle2
from api.utils.utils import is_valid_sender_code, get_captcha from api.utils.utils import is_valid_sender_code, get_captcha
from common.base.baseutils import get_real_ip_address, get_choices_dict from common.base.baseutils import get_real_ip_address, get_choices_dict
from common.core.sysconfig import Config
from common.core.throttle import InstallThrottle2
from common.utils.caches import login_auth_failed
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -12,12 +12,12 @@ from rest_framework.views import APIView
from api.base_views import storage_change, app_delete from api.base_views import storage_change, app_delete
from api.models import AppStorage, Apps from api.models import AppStorage, Apps
from api.utils.app.apputils import clean_history_apps from api.utils.app.apputils import clean_history_apps
from api.utils.auth import ExpiringTokenAuthentication, StoragePermission
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import StorageSerializer from api.utils.serializer import StorageSerializer
from api.utils.utils import upload_oss_default_head_img from api.utils.utils import upload_oss_default_head_img
from common.base.baseutils import get_choices_dict from common.base.baseutils import get_choices_dict
from common.cache.state import MigrateStorageState from common.cache.state import MigrateStorageState
from common.core.auth import ExpiringTokenAuthentication, StoragePermission
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -16,18 +16,18 @@ from api.models import AppIOSDeveloperInfo, APPSuperSignUsedInfo, AppUDID, IosDe
UDIDsyncDeveloper, AppleDeveloperToAppUse, Apps, DeveloperAppID, APPToDeveloper, DeveloperDevicesID, \ UDIDsyncDeveloper, AppleDeveloperToAppUse, Apps, DeveloperAppID, APPToDeveloper, DeveloperDevicesID, \
IosDeveloperBill, UserInfo IosDeveloperBill, UserInfo
from api.utils.app.supersignutils import IosUtils from api.utils.app.supersignutils import IosUtils
from api.utils.auth import ExpiringTokenAuthentication, SuperSignPermission
from api.utils.modelutils import get_user_public_used_sign_num, get_user_public_sign_num, PageNumber, \ from api.utils.modelutils import get_user_public_used_sign_num, get_user_public_sign_num, PageNumber, \
check_uid_has_relevant check_uid_has_relevant
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import DeveloperSerializer, SuperSignUsedSerializer, DeviceUDIDSerializer, BillInfoSerializer, \ from api.utils.serializer import DeveloperSerializer, SuperSignUsedSerializer, DeviceUDIDSerializer, BillInfoSerializer, \
DeveloperDeviceSerializer, AppleDeveloperToAppUseSerializer, AppleDeveloperToAppUseAppsSerializer, \ DeveloperDeviceSerializer, AppleDeveloperToAppUseSerializer, AppleDeveloperToAppUseAppsSerializer, \
BillTransferSerializer BillTransferSerializer
from api.utils.storage.caches import get_app_download_url
from api.utils.utils import get_developer_devices from api.utils.utils import get_developer_devices
from common.base.baseutils import get_choices_dict, get_choices_name_from_key, AppleDeveloperUid, get_real_ip_address from common.base.baseutils import get_choices_dict, get_choices_name_from_key, AppleDeveloperUid, get_real_ip_address
from common.cache.state import CleanSignDataState, MigrateStorageState from common.cache.state import CleanSignDataState, MigrateStorageState
from fir_ser.settings import DEVELOPER_USE_STATUS, DEVELOPER_DISABLED_STATUS, DEVELOPER_UID_KEY from common.core.auth import ExpiringTokenAuthentication, SuperSignPermission
from common.core.sysconfig import Config
from common.utils.caches import get_app_download_url
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -77,7 +77,7 @@ class DeveloperView(APIView):
res.data = developer_serializer.data res.data = developer_serializer.data
res.count = developer_obj.count() res.count = developer_obj.count()
res.status_choices = get_choices_dict(AppIOSDeveloperInfo.status_choices, DEVELOPER_DISABLED_STATUS) res.status_choices = get_choices_dict(AppIOSDeveloperInfo.status_choices, Config.DEVELOPER_DISABLED_STATUS)
res.apple_auth_list = get_choices_dict(AppIOSDeveloperInfo.auth_type_choices) res.apple_auth_list = get_choices_dict(AppIOSDeveloperInfo.auth_type_choices)
return Response(res.dict) return Response(res.dict)
@ -93,7 +93,7 @@ class DeveloperView(APIView):
res = BaseResponse() res = BaseResponse()
result_list = [] result_list = []
for developer_s_obj in AppIOSDeveloperInfo.objects.filter(user_id=request.user, for developer_s_obj in AppIOSDeveloperInfo.objects.filter(user_id=request.user,
status__in=DEVELOPER_USE_STATUS).all(): status__in=Config.DEVELOPER_USE_STATUS).all():
status, result = IosUtils.get_device_from_developer(developer_s_obj) status, result = IosUtils.get_device_from_developer(developer_s_obj)
if not status: if not status:
result_list.append(result.get("err_info")) result_list.append(result.get("err_info"))
@ -111,7 +111,7 @@ class DeveloperView(APIView):
elif act == "setstatus": elif act == "setstatus":
issuer_ids = data.get("issuer_ids", []) issuer_ids = data.get("issuer_ids", [])
status = data.get("status", None) status = data.get("status", None)
if issuer_ids and status is not None: if issuer_ids and status is not None and status not in Config.DEVELOPER_DISABLED_STATUS:
status_text = get_choices_name_from_key(AppIOSDeveloperInfo.status_choices, status) status_text = get_choices_name_from_key(AppIOSDeveloperInfo.status_choices, status)
if status_text: if status_text:
AppIOSDeveloperInfo.objects.filter(user_id=request.user, issuer_id__in=issuer_ids).update( AppIOSDeveloperInfo.objects.filter(user_id=request.user, issuer_id__in=issuer_ids).update(
@ -323,12 +323,12 @@ class SuperSignUsedView(APIView):
other_uid_info = data.get('other_uid', '') other_uid_info = data.get('other_uid', '')
if device_udid and developer_id and bundle_id: if device_udid and developer_id and bundle_id:
app_obj = Apps.objects.filter(user_id=request.user, bundle_id=bundle_id).first() app_obj = Apps.objects.filter(user_id=request.user, bundle_id=bundle_id).first()
if app_obj is None and not developer_id.startswith(DEVELOPER_UID_KEY): if app_obj is None and not developer_id.startswith(Config.DEVELOPER_UID_KEY):
if other_uid_info: if other_uid_info:
other_uid = other_uid_info.get('uid') other_uid = other_uid_info.get('uid')
if other_uid and check_uid_has_relevant(request.user.uid, other_uid): if other_uid and check_uid_has_relevant(request.user.uid, other_uid):
app_obj = Apps.objects.filter(bundle_id=bundle_id).first() app_obj = Apps.objects.filter(bundle_id=bundle_id).first()
if developer_id.startswith(DEVELOPER_UID_KEY): if developer_id.startswith(Config.DEVELOPER_UID_KEY):
developer_id = AppleDeveloperUid().get_decrypt_uid(developer_id.lstrip('T:')) developer_id = AppleDeveloperUid().get_decrypt_uid(developer_id.lstrip('T:'))
app_to_dev_obj = APPToDeveloper.objects.filter(app_id=app_obj, developerid__issuer_id=developer_id).first() app_to_dev_obj = APPToDeveloper.objects.filter(app_id=app_obj, developerid__issuer_id=developer_id).first()
@ -744,7 +744,7 @@ class AppleDeveloperBindAppsView(APIView):
for item in add_issuer_ids: for item in add_issuer_ids:
developer_obj = AppIOSDeveloperInfo.objects.filter(issuer_id=item, user_id=request.user, developer_obj = AppIOSDeveloperInfo.objects.filter(issuer_id=item, user_id=request.user,
status__in=DEVELOPER_USE_STATUS, status__in=Config.DEVELOPER_USE_STATUS,
certid__isnull=False).first() certid__isnull=False).first()
developer_aid_obj = DeveloperAppID.objects.filter(developerid=developer_obj) developer_aid_obj = DeveloperAppID.objects.filter(developerid=developer_obj)
is_exist = developer_aid_obj.filter(app_id=app_obj).count() is_exist = developer_aid_obj.filter(app_id=app_obj).count()

@ -12,14 +12,14 @@ from rest_framework.views import APIView
from rest_framework_xml.parsers import XMLParser from rest_framework_xml.parsers import XMLParser
from api.models import ThirdWeChatUserInfo, UserInfo, UserCertificationInfo from api.models import ThirdWeChatUserInfo, UserInfo, UserCertificationInfo
from api.utils.auth import ExpiringTokenAuthentication
from api.utils.modelutils import PageNumber from api.utils.modelutils import PageNumber
from api.utils.mp.chat import reply, receive
from api.utils.mp.wechat import check_signature, WxMsgCrypt, get_userinfo_from_openid, WxTemplateMsg
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import ThirdWxSerializer from api.utils.serializer import ThirdWxSerializer
from api.utils.storage.caches import set_wx_ticket_login_info_cache, get_wx_ticket_login_info_cache
from api.views.login import get_login_type from api.views.login import get_login_type
from common.core.auth import ExpiringTokenAuthentication
from common.libs.mp.chat import reply, receive
from common.libs.mp.wechat import check_signature, WxMsgCrypt, get_userinfo_from_openid, WxTemplateMsg
from common.utils.caches import set_wx_ticket_login_info_cache, get_wx_ticket_login_info_cache
from config import WEB_DOMAIN from config import WEB_DOMAIN
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -14,14 +14,14 @@ from api.models import Apps, AppReleaseInfo, UserInfo, AppScreenShot, Certificat
from api.tasks import run_resign_task from api.tasks import run_resign_task
from api.utils.TokenManager import verify_token from api.utils.TokenManager import verify_token
from api.utils.app.apputils import get_random_short, save_app_infos from api.utils.app.apputils import get_random_short, save_app_infos
from api.utils.auth import ExpiringTokenAuthentication
from api.utils.modelutils import check_super_sign_permission, get_app_download_uri from api.utils.modelutils import check_super_sign_permission, get_app_download_uri
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.storage.caches import upload_file_tmp_name, del_cache_response_by_short
from api.utils.storage.storage import Storage
from api.utils.sysconfig import Config
from common.base.baseutils import make_app_uuid, make_from_user_uuid from common.base.baseutils import make_app_uuid, make_from_user_uuid
from common.cache.state import MigrateStorageState from common.cache.state import MigrateStorageState
from common.core.auth import ExpiringTokenAuthentication
from common.core.sysconfig import Config
from common.utils.caches import upload_file_tmp_name, del_cache_response_by_short
from common.utils.storage import Storage
from fir_ser import settings from fir_ser import settings
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -6,8 +6,8 @@
import logging import logging
from api.utils.auth import ApiTokenAuthentication
from api.views.apps import AppsView, AppInfoView, AppReleaseInfoView from api.views.apps import AppsView, AppInfoView, AppReleaseInfoView
from common.core.auth import ApiTokenAuthentication
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -1,7 +1,7 @@
import logging import logging
from api.utils.auth import ApiTokenAuthentication
from api.views.login import UserInfoView from api.views.login import UserInfoView
from common.core.auth import ApiTokenAuthentication
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -5,8 +5,8 @@
# date: 2020/3/6 # date: 2020/3/6
from api.utils.auth import ApiTokenAuthentication
from api.views.uploads import AppAnalyseView, UploadView from api.views.uploads import AppAnalyseView, UploadView
from common.core.auth import ApiTokenAuthentication
class CliAppAnalyseView(AppAnalyseView): class CliAppAnalyseView(AppAnalyseView):

@ -0,0 +1,16 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author: NinEveN
# date: 2022/2/14
class DBRouter(object):
def db_for_read(self, model, **hints):
#
# if model._meta.model_name == 'Price':
# return 'db1'
# else:
# return 'default'
return 'slave'
def db_for_write(self, model, **hints):
return 'default'

@ -15,7 +15,7 @@ from rest_framework import serializers
from api.models import SystemConfig from api.models import SystemConfig
from common.cache.storage import SystemConfigCache from common.cache.storage import SystemConfigCache
from config import BASECONF, API_DOMAIN, MOBILEPROVISION, WEB_DOMAIN, THIRDLOGINCONF, AUTHCONF, IPACONF, MSGCONF, \ from config import BASECONF, API_DOMAIN, MOBILEPROVISION, WEB_DOMAIN, THIRDLOGINCONF, AUTHCONF, IPACONF, MSGCONF, \
DOWNLOADTIMESCONF DOWNLOADTIMESCONF, PAYCONF, STORAGEKEYCONF, SENDERCONF, APPLEDEVELOPERCONF
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -45,7 +45,7 @@ def get_render_value(value):
if value: if value:
try: try:
context_dict = {} context_dict = {}
for sys_obj_dict in SystemConfig.objects.values().all(): for sys_obj_dict in SystemConfig.objects.filter(enable=True).values().all():
if re.findall('{{.*%s.*}}' % sys_obj_dict['key'], sys_obj_dict['value']): if re.findall('{{.*%s.*}}' % sys_obj_dict['key'], sys_obj_dict['value']):
logger.warning(f"get same render key. so continue") logger.warning(f"get same render key. so continue")
continue continue
@ -62,7 +62,7 @@ class ConfigCacheBase(object):
self.px = px self.px = px
def get_value_from_db(self, key): def get_value_from_db(self, key):
data = SystemConfigSerializer(SystemConfig.objects.filter(key=key).first()).data data = SystemConfigSerializer(SystemConfig.objects.filter(enable=True, key=key).first()).data
if re.findall('{{.*%s.*}}' % data['key'], data['value']): if re.findall('{{.*%s.*}}' % data['key'], data['value']):
logger.warning(f"get same render key. so get default value") logger.warning(f"get same render key. so get default value")
data['key'] = '' data['key'] = ''
@ -121,10 +121,6 @@ class ConfigCacheBase(object):
def FILE_UPLOAD_DOMAIN(self): def FILE_UPLOAD_DOMAIN(self):
return self.get_value('FILE_UPLOAD_DOMAIN', self.API_DOMAIN) return self.get_value('FILE_UPLOAD_DOMAIN', self.API_DOMAIN)
@property
def CAN_RENDER_KEY(self):
return self.get_value('CAN_RENDER_KEY', [])
class BaseConfCache(ConfigCacheBase): class BaseConfCache(ConfigCacheBase):
def __init__(self): def __init__(self):
@ -277,7 +273,59 @@ class EmailMsgCache(ConfigCacheBase):
return super().get_value('MSG_AUTO_CHECK_DEVELOPER', MSGCONF.MSG_AUTO_CHECK_DEVELOPER) return super().get_value('MSG_AUTO_CHECK_DEVELOPER', MSGCONF.MSG_AUTO_CHECK_DEVELOPER)
class ConfigCache(BaseConfCache, IpaConfCache, AuthConfCache, EmailMsgCache, UserDownloadTimesCache, GeeTestConfCache): class PayConfCache(ConfigCacheBase):
def __init__(self):
super(PayConfCache, self).__init__()
@property
def PAY_SUCCESS_URL(self):
return super().get_value('PAY_SUCCESS_URL', PAYCONF.PAY_SUCCESS_URL)
@property
def APP_NOTIFY_URL(self):
return super().get_value('APP_NOTIFY_URL', PAYCONF.APP_NOTIFY_URL)
@property
def PAY_CONFIG_KEY_INFO(self):
return super().get_value('PAY_CONFIG_KEY_INFO', PAYCONF.PAY_CONFIG_KEY_INFO)
class ThirdPartConfCache(ConfigCacheBase):
def __init__(self):
super(ThirdPartConfCache, self).__init__()
@property
def STORAGE(self):
return super().get_value('STORAGE', STORAGEKEYCONF.STORAGE)
@property
def SENDER(self):
return super().get_value('SENDER', SENDERCONF.SENDER)
class AppleDeveloperConfCache(ConfigCacheBase):
def __init__(self):
super(AppleDeveloperConfCache, self).__init__()
@property
def DEVELOPER_USE_STATUS(self):
return super().get_value('DEVELOPER_USE_STATUS', APPLEDEVELOPERCONF.DEVELOPER_USE_STATUS)
@property
def DEVELOPER_AUTO_CHECK_STATUS(self):
return super().get_value('SENDER', APPLEDEVELOPERCONF.DEVELOPER_AUTO_CHECK_STATUS)
@property
def DEVELOPER_WRITE_STATUS(self):
return super().get_value('SENDER', APPLEDEVELOPERCONF.DEVELOPER_WRITE_STATUS)
@property
def DEVELOPER_DISABLED_STATUS(self):
return super().get_value('SENDER', APPLEDEVELOPERCONF.DEVELOPER_DISABLED_STATUS)
class ConfigCache(BaseConfCache, IpaConfCache, AuthConfCache, EmailMsgCache, UserDownloadTimesCache, GeeTestConfCache,
PayConfCache, ThirdPartConfCache, AppleDeveloperConfCache):
def __init__(self): def __init__(self):
super(ConfigCache, self).__init__() super(ConfigCache, self).__init__()

@ -16,7 +16,7 @@ import jwt
import requests import requests
from api.utils.crontab.iproxy import get_proxy_ip_from_cache from api.utils.crontab.iproxy import get_proxy_ip_from_cache
from api.utils.sysconfig import Config from common.core.sysconfig import Config
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -10,8 +10,8 @@ import logging
import requests import requests
from django.core.cache import cache as redis_connect from django.core.cache import cache as redis_connect
from api.utils.geetest.geetest_lib import GeetestLib from common.core.sysconfig import Config
from api.utils.sysconfig import Config from common.libs.geetest.geetest_lib import GeetestLib
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -9,10 +9,10 @@ from hashlib import sha1
import requests import requests
from api.utils.mp.utils import WxMsgCryptBase
from api.utils.sysconfig import Config
from common.base.baseutils import get_format_time from common.base.baseutils import get_format_time
from common.cache.storage import WxTokenCache from common.cache.storage import WxTokenCache
from common.core.sysconfig import Config
from common.libs.mp.utils import WxMsgCryptBase
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -10,8 +10,8 @@ import json
import logging import logging
from datetime import datetime, timedelta from datetime import datetime, timedelta
from api.utils.pay.alipay import AliPay, AliPayConfig from common.libs.pay.alipay import AliPay, AliPayConfig
from api.utils.storage.caches import update_order_info, update_order_status from common.utils.caches import update_order_info, update_order_status
logger = logging.getLogger('pay') logger = logging.getLogger('pay')

@ -3,14 +3,13 @@
# project: 4月 # project: 4月
# author: NinEveN # author: NinEveN
# date: 2021/4/18 # date: 2021/4/18
from common.core.sysconfig import Config
from api.utils.pay.ali import Alipay from common.libs.pay.ali import Alipay
from api.utils.pay.wx import Weixinpay from common.libs.pay.wx import Weixinpay
from fir_ser.settings import PAY_CONFIG_KEY_INFO
def get_pay_obj_form_name(pay_name): def get_pay_obj_form_name(pay_name):
for pay_info in PAY_CONFIG_KEY_INFO: for pay_info in Config.PAY_CONFIG_KEY_INFO:
if pay_name == pay_info.get('NAME', '') and pay_info.get('ENABLED', False): if pay_name == pay_info.get('NAME', '') and pay_info.get('ENABLED', False):
auth_info = pay_info.get('AUTH', None) auth_info = pay_info.get('AUTH', None)
p_type = pay_info.get('TYPE', '') p_type = pay_info.get('TYPE', '')
@ -25,7 +24,7 @@ def get_pay_obj_form_name(pay_name):
def get_enable_pay_choices(): def get_enable_pay_choices():
pay_choices = [] pay_choices = []
for pay_info in PAY_CONFIG_KEY_INFO: for pay_info in Config.PAY_CONFIG_KEY_INFO:
if pay_info.get('ENABLED', False): if pay_info.get('ENABLED', False):
pay_choices.append({'type': pay_info.get('TYPE'), 'name': pay_info.get('NAME', '')}) pay_choices.append({'type': pay_info.get('TYPE'), 'name': pay_info.get('NAME', '')})
return pay_choices return pay_choices

@ -8,8 +8,8 @@ import json
import logging import logging
from datetime import datetime, timedelta from datetime import datetime, timedelta
from api.utils.pay.wxpay import WeChatPay, WeChatPayType from common.libs.pay.wxpay import WeChatPay, WeChatPayType
from api.utils.storage.caches import update_order_info, update_order_status from common.utils.caches import update_order_info, update_order_status
logger = logging.getLogger('pay') logger = logging.getLogger('pay')

@ -10,7 +10,7 @@ import logging
import os import os
from api.utils.TokenManager import make_token from api.utils.TokenManager import make_token
from api.utils.storage.aliyunApi import AliYunCdn from common.libs.storage.aliyunApi import AliYunCdn
from fir_ser import settings from fir_ser import settings
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

@ -16,15 +16,15 @@ from api.models import Apps, UserInfo, AppReleaseInfo, AppUDID, APPToDeveloper,
UserCertificationInfo, Order UserCertificationInfo, Order
from api.utils.modelutils import get_app_d_count_by_app_id, get_app_domain_name, get_user_domain_name, \ from api.utils.modelutils import get_app_d_count_by_app_id, get_app_domain_name, get_user_domain_name, \
add_remote_info_from_request add_remote_info_from_request
from api.utils.storage.storage import Storage, LocalStorage
from api.utils.sysconfig import Config
from common.base.baseutils import check_app_password, get_order_num, get_real_ip_address from common.base.baseutils import check_app_password, get_order_num, get_real_ip_address
from common.cache.invalid import invalid_app_cache, invalid_short_cache, invalid_app_download_times_cache, \ from common.cache.invalid import invalid_app_cache, invalid_short_cache, invalid_app_download_times_cache, \
invalid_head_img_cache invalid_head_img_cache
from common.cache.storage import AppDownloadTodayTimesCache, AppDownloadTimesCache, DownloadUrlCache, AppInstanceCache, \ from common.cache.storage import AppDownloadTodayTimesCache, AppDownloadTimesCache, DownloadUrlCache, AppInstanceCache, \
UploadTmpFileNameCache, RedisCacheBase, UserCanDownloadCache, UserFreeDownloadTimesCache, WxTicketCache, \ UploadTmpFileNameCache, RedisCacheBase, UserCanDownloadCache, UserFreeDownloadTimesCache, WxTicketCache, \
SignUdidQueueCache, CloudStorageCache SignUdidQueueCache, CloudStorageCache
from fir_ser.settings import CACHE_KEY_TEMPLATE, SYNC_CACHE_TO_DATABASE, DEVELOPER_USE_STATUS from common.core.sysconfig import Config
from common.utils.storage import Storage, LocalStorage
from fir_ser.settings import CACHE_KEY_TEMPLATE, SYNC_CACHE_TO_DATABASE
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -49,7 +49,7 @@ def get_download_url_by_cache(app_obj, filename, limit, isdownload=True, key='',
if appudid_obj: if appudid_obj:
super_sign_obj = APPSuperSignUsedInfo.objects.filter(udid__udid__udid=udid, super_sign_obj = APPSuperSignUsedInfo.objects.filter(udid__udid__udid=udid,
app_id_id=app_obj.get("pk"), app_id_id=app_obj.get("pk"),
developerid__status__in=DEVELOPER_USE_STATUS).last() developerid__status__in=Config.DEVELOPER_USE_STATUS).last()
if super_sign_obj and super_sign_obj.user_id.supersign_active: if super_sign_obj and super_sign_obj.user_id.supersign_active:
app_to_developer_obj = APPToDeveloper.objects.filter(app_id_id=app_obj.get("pk"), app_to_developer_obj = APPToDeveloper.objects.filter(app_id_id=app_obj.get("pk"),
developerid=super_sign_obj.developerid).last() developerid=super_sign_obj.developerid).last()

@ -6,10 +6,10 @@
import logging import logging
from fir_ser.settings import THIRD_PART_CONFIG_KEY_INFO from common.core.sysconfig import Config
from .aliyunApi import AliMsgSender from common.libs.sendmsg.aliyunApi import AliMsgSender
from .emailApi import EmailMsgSender from common.libs.sendmsg.emailApi import EmailMsgSender
from .jiguangApi import JiGuangMsgSender from common.libs.sendmsg.jiguangApi import JiGuangMsgSender
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -21,8 +21,7 @@ def get_default_sender(send_type):
1: 阿里云 1: 阿里云
2: 极光 2: 极光
""" """
sender_lists = THIRD_PART_CONFIG_KEY_INFO.get('sender_key') for sender in Config.SENDER:
for sender in sender_lists:
if sender.get("active", None): if sender.get("active", None):
sender_type = sender.get('type', None) sender_type = sender.get('type', None)
auth = sender.get('auth', {}) auth = sender.get('auth', {})

@ -10,10 +10,10 @@ import time
from common.base.baseutils import get_dict_from_filter_fields from common.base.baseutils import get_dict_from_filter_fields
from common.base.magic import run_function_by_locker from common.base.magic import run_function_by_locker
from common.cache.storage import CloudStorageCache, LocalStorageCache, DownloadUrlCache from common.cache.storage import CloudStorageCache, LocalStorageCache, DownloadUrlCache
from fir_ser.settings import THIRD_PART_CONFIG_KEY_INFO from common.core.sysconfig import Config
from .aliyunApi import AliYunOss, AliYunCdn from common.libs.storage.aliyunApi import AliYunOss, AliYunCdn
from .localApi import LocalStorage from common.libs.storage.localApi import LocalStorage
from .qiniuApi import QiNiuOss from common.libs.storage.qiniuApi import QiNiuOss
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -140,8 +140,7 @@ class Storage(object):
def get_local_storage(clean_cache=False): def get_local_storage(clean_cache=False):
storage_lists = THIRD_PART_CONFIG_KEY_INFO.get('storage_key') for storage in Config.STORAGE:
for storage in storage_lists:
storage_type = storage.get('type', None) storage_type = storage.get('type', None)
if storage_type == 0: if storage_type == 0:
auth = storage.get('auth', {}) auth = storage.get('auth', {})
@ -162,8 +161,7 @@ def get_local_storage(clean_cache=False):
def get_storage_form_conf(user): def get_storage_form_conf(user):
storage_lists = THIRD_PART_CONFIG_KEY_INFO.get('storage_key', []) for storage in Config.STORAGE:
for storage in storage_lists:
if storage.get("active", None): if storage.get("active", None):
storage_type = storage.get('type', None) storage_type = storage.get('type', None)
auth = storage.get('auth', {}) auth = storage.get('auth', {})

@ -271,7 +271,8 @@ class IPACONF(object):
class PAYCONF(object): class PAYCONF(object):
PAY_SUCCESS_URL = '%s/user/orders' % WEB_DOMAIN # 前端页面,支付成功跳转页面 PAY_SUCCESS_URL = '{{WEB_DOMAIN}}/user/orders' # 前端页面,支付成功跳转页面
APP_NOTIFY_URL = '{{API_DOMAIN}}/api/v1/fir/server/pay_success' # 支付支付回调URL
PAY_CONFIG_KEY_INFO = [ PAY_CONFIG_KEY_INFO = [
{ {
'NAME': 'alipay', 'NAME': 'alipay',
@ -285,8 +286,8 @@ MIIEowIBAAKCAQEAhqf2mwftoxZDNpl4eWsQ6mEfXgMlNPr6jv72ecA4hbKWqChXQmGS1T+0VsRTSoOX
'ALI_PUBLIC_KEY': '''-----BEGIN CERTIFICATE----- 'ALI_PUBLIC_KEY': '''-----BEGIN CERTIFICATE-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkru1ulQV1v4q+q38nyzgkdd3evf7C1/Ipu6K+ZFb5FiuxJ7mildkBSuKz/8+TRd+tjgk2lfc2ehK5pja3cxDO/nb25sBoWiU09rtxgXLehLsgRRhatbICrlOnYxg5aiB5odAp3NMRqore4lnVYwfIyL9M49I0G/NbQzYjUQvAQJsnHwc6a6Kuqi1CwR1WXI0sDF9w7KXC4vRFFIUTwI4bVq4HQWI7NhbgEajHM/j6D6Bh/OMcTYnJJzCja0WmZRe5flfCsELlPESOCWUMbYoaNfBzpNvvyOpmRgs9jgy2WY9SeaB9hxwkpr8tOd2Sc7j3221JKCyDaFAX+4zPy7/fQIDAQAB MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkru1ulQV1v4q+q38nyzgkdd3evf7C1/Ipu6K+ZFb5FiuxJ7mildkBSuKz/8+TRd+tjgk2lfc2ehK5pja3cxDO/nb25sBoWiU09rtxgXLehLsgRRhatbICrlOnYxg5aiB5odAp3NMRqore4lnVYwfIyL9M49I0G/NbQzYjUQvAQJsnHwc6a6Kuqi1CwR1WXI0sDF9w7KXC4vRFFIUTwI4bVq4HQWI7NhbgEajHM/j6D6Bh/OMcTYnJJzCja0WmZRe5flfCsELlPESOCWUMbYoaNfBzpNvvyOpmRgs9jgy2WY9SeaB9hxwkpr8tOd2Sc7j3221JKCyDaFAX+4zPy7/fQIDAQAB
-----END CERTIFICATE-----''', -----END CERTIFICATE-----''',
'APP_NOTIFY_URL': '%s/api/v1/fir/server/pay_success' % API_DOMAIN, # 支付支付回调URL 'APP_NOTIFY_URL': '{{APP_NOTIFY_URL}}', # 支付支付回调URL
'RETURN_URL': PAY_SUCCESS_URL, # 支付前端页面回调URL 'RETURN_URL': '{{PAY_SUCCESS_URL}}', # 支付前端页面回调URL
'SUBJECT': '向 FLY分发平台 充值', 'SUBJECT': '向 FLY分发平台 充值',
} }
}, },
@ -327,8 +328,8 @@ daWIhg++OHN2MBRutj7oL/AFAxyu467YA5+itEJLHNATbOr/s13S66nePNXox/hr
bIX1aWjPxirQX9mzaL3oEQI= bIX1aWjPxirQX9mzaL3oEQI=
-----END PRIVATE KEY-----''', -----END PRIVATE KEY-----''',
'API_V3_KEY': '60DbP621a9C3162dDd4AB9c2O15a005L', 'API_V3_KEY': '60DbP621a9C3162dDd4AB9c2O15a005L',
'APP_NOTIFY_URL': '%s/api/v1/fir/server/pay_success' % API_DOMAIN, # 支付支付回调URL 'APP_NOTIFY_URL': '{{APP_NOTIFY_URL}}', # 支付支付回调URL
'RETURN_URL': PAY_SUCCESS_URL, # 支付前端页面回调URL 'RETURN_URL': '{{PAY_SUCCESS_URL}}', # 支付前端页面回调URL
'SUBJECT': '向 FLY分发平台 充值', 'SUBJECT': '向 FLY分发平台 充值',
} }
} }
@ -346,3 +347,12 @@ class DOWNLOADTIMESCONF(object):
AUTH_USER_FREE_DOWNLOAD_TIMES = 10 AUTH_USER_FREE_DOWNLOAD_TIMES = 10
NEW_USER_GIVE_DOWNLOAD_TIMES = 100 NEW_USER_GIVE_DOWNLOAD_TIMES = 100
AUTH_USER_GIVE_DOWNLOAD_TIMES = 200 AUTH_USER_GIVE_DOWNLOAD_TIMES = 200
class APPLEDEVELOPERCONF(object):
# (-1, '疑似被封'), (0, '未激活'), (1, '已激活'), (2, '协议待同意'), (3, '维护中'), (4, '证书过期'), (5, '状态异常')
DEVELOPER_USE_STATUS = [1, 2, 3, 4, 5] # 开发者可用状态,详情查看 model.AppIOSDeveloperInfo
DEVELOPER_AUTO_CHECK_STATUS = [1, 2] # 定时认证自动检测
DEVELOPER_WRITE_STATUS = [1, 3, 4] # 开发者api写操作查询
DEVELOPER_DISABLED_STATUS = [2, 4, 5] # 开发者不可 修改为状态,用户前端控制
DEVELOPER_UID_KEY = "T:" # 开发者共享给其他第三方用户, 中间必须包含 : 前端需要根据 : 进行分割

@ -99,7 +99,19 @@ DATABASES = {
# 设置MySQL的驱动 # 设置MySQL的驱动
# 'OPTIONS': {'init_command': 'SET storage_engine=INNODB'}, # 'OPTIONS': {'init_command': 'SET storage_engine=INNODB'},
'OPTIONS': {'init_command': 'SET sql_mode="STRICT_TRANS_TABLES"', 'charset': 'utf8mb4'} 'OPTIONS': {'init_command': 'SET sql_mode="STRICT_TRANS_TABLES"', 'charset': 'utf8mb4'}
} },
# 'slave': {
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': DBCONF.name,
# 'USER': DBCONF.user,
# 'PASSWORD': DBCONF.password,
# 'HOST': DBCONF.host,
# 'PORT': DBCONF.port,
# 'CONN_MAX_AGE': 600,
# # 设置MySQL的驱动
# # 'OPTIONS': {'init_command': 'SET storage_engine=INNODB'},
# 'OPTIONS': {'init_command': 'SET sql_mode="STRICT_TRANS_TABLES"', 'charset': 'utf8mb4'}
# }
# 'default': { # 'default': {
# 'ENGINE': 'django.db.backends.postgresql', # 'ENGINE': 'django.db.backends.postgresql',
# 'NAME': DBCONF.name, # 'NAME': DBCONF.name,
@ -121,6 +133,15 @@ DATABASES = {
} }
# 读写分离 可能会出现 the current database router prevents this relation.
# 1.项目设置了router读写分离,且在ORM create()方法中,使用了前边filter()方法得到的数据,
# 2.由于django是惰性查询,前边的filter()并没有立即查询,而是在create()中引用了filter()的数据时,执行了filter(),
# 3.此时写操作的db指针指向write_db,filter()的db指针指向read_db,两者发生冲突,导致服务禁止了此次与mysql的交互
# 解决办法:
# 在前边filter()方法中,使用using()方法,使filter()方法立即与数据库交互,查出数据。
# DATABASE_ROUTERS = ['common.core.dbrouter.DBRouter']
# Password validation # Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
@ -144,10 +165,10 @@ REST_FRAMEWORK = {
# 'rest_framework.renderers.BrowsableAPIRenderer', # 'rest_framework.renderers.BrowsableAPIRenderer',
), ),
'DEFAULT_THROTTLE_CLASSES': [ 'DEFAULT_THROTTLE_CLASSES': [
'api.utils.throttle.LoginUserThrottle', 'common.core.throttle.LoginUserThrottle',
], ],
'DEFAULT_THROTTLE_RATES': BASECONF.DEFAULT_THROTTLE_RATES, 'DEFAULT_THROTTLE_RATES': BASECONF.DEFAULT_THROTTLE_RATES,
'EXCEPTION_HANDLER': 'admin.utils.exception.common_exception_handler', 'EXCEPTION_HANDLER': 'common.core.exception.common_exception_handler',
} }
# Internationalization # Internationalization
@ -236,11 +257,6 @@ CORS_ALLOW_HEADERS = (
"x-token" "x-token"
) )
THIRD_PART_CONFIG_KEY_INFO = {
# APP存储配置
'storage_key': STORAGEKEYCONF.STORAGE,
'sender_key': SENDERCONF.SENDER
}
CACHE_KEY_TEMPLATE = { CACHE_KEY_TEMPLATE = {
'sysconfig_key': 'sysconfig', 'sysconfig_key': 'sysconfig',
'user_can_download_key': 'user_can_download', 'user_can_download_key': 'user_can_download',
@ -268,13 +284,6 @@ CACHE_KEY_TEMPLATE = {
DATA_DOWNLOAD_KEY = "d_token" DATA_DOWNLOAD_KEY = "d_token"
FILE_UPLOAD_TMP_KEY = ".tmp" FILE_UPLOAD_TMP_KEY = ".tmp"
DEVELOPER_UID_KEY = "T:"
# (-1, '疑似被封'), (0, '未激活'), (1, '已激活'), (2, '协议待同意'), (3, '维护中'), (4, '证书过期'), (5, '状态异常')
DEVELOPER_USE_STATUS = [1, 2, 3, 4, 5] # 开发者可用状态,详情查看 model.AppIOSDeveloperInfo
DEVELOPER_AUTO_CHECK_STATUS = [1, 2] # 定时认证自动检测
DEVELOPER_WRITE_STATUS = [1, 3, 4] # 开发者api写操作查询
DEVELOPER_DISABLED_STATUS = [2, 4, 5] # 开发者不可 修改为状态
SYNC_CACHE_TO_DATABASE = { SYNC_CACHE_TO_DATABASE = {
'download_times': 10, # 下载次数同步时间 'download_times': 10, # 下载次数同步时间
@ -387,8 +396,6 @@ LOGGING = {
}, },
} }
PAY_CONFIG_KEY_INFO = PAYCONF.PAY_CONFIG_KEY_INFO
# 结果存放到Django|redis # 结果存放到Django|redis
# CELERY_RESULT_BACKEND = 'django-db' # CELERY_RESULT_BACKEND = 'django-db'
# CELERY_RESULT_BACKEND = 'django-cache' # CELERY_RESULT_BACKEND = 'django-cache'

Loading…
Cancel
Save