diff --git a/fir_ser/admin/admin.py b/fir_ser/admin/admin.py index 8c38f3f..846f6b4 100644 --- a/fir_ser/admin/admin.py +++ b/fir_ser/admin/admin.py @@ -1,3 +1 @@ -from django.contrib import admin - # Register your models here. diff --git a/fir_ser/admin/models.py b/fir_ser/admin/models.py index 71a8362..6b20219 100644 --- a/fir_ser/admin/models.py +++ b/fir_ser/admin/models.py @@ -1,3 +1 @@ -from django.db import models - # Create your models here. diff --git a/fir_ser/admin/tests.py b/fir_ser/admin/tests.py index 7ce503c..a39b155 100644 --- a/fir_ser/admin/tests.py +++ b/fir_ser/admin/tests.py @@ -1,3 +1 @@ -from django.test import TestCase - # Create your tests here. diff --git a/fir_ser/admin/urls.py b/fir_ser/admin/urls.py index c161bf3..ff876c5 100644 --- a/fir_ser/admin/urls.py +++ b/fir_ser/admin/urls.py @@ -14,13 +14,14 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.urls import re_path -from admin.views.login import LoginView, LoginUserView -from admin.views.user import UserInfoView, UserCertificationInfoView, ThirdWxAccountView + from admin.views.app import AppInfoView, AppReleaseInfoView -from admin.views.storage import StorageInfoView, StorageChangeView +from admin.views.domain import DomainNameInfoView +from admin.views.login import LoginView, LoginUserView from admin.views.order import OrderInfoView +from admin.views.storage import StorageInfoView, StorageChangeView from admin.views.supersign import DeveloperInfoView, DevicesInfoView -from admin.views.domain import DomainNameInfoView +from admin.views.user import UserInfoView, UserCertificationInfoView, ThirdWxAccountView urlpatterns = [ # path("",include(router.urls)), diff --git a/fir_ser/admin/views/app.py b/fir_ser/admin/views/app.py index f423e51..1a798fd 100644 --- a/fir_ser/admin/views/app.py +++ b/fir_ser/admin/views/app.py @@ -4,27 +4,20 @@ # author: liuyu # date: 2021/4/11 -from django.contrib import auth -from api.models import Token, AppReleaseInfo, Apps +import logging + +from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response +from rest_framework.views import APIView +from api.base_views import app_delete +from api.models import AppReleaseInfo, Apps from api.utils.TokenManager import verify_token from api.utils.auth import AdminTokenAuthentication -from api.utils.serializer import AdminAppsSerializer, AdminAppReleaseSerializer -from django.core.cache import cache -from rest_framework.views import APIView -import binascii -import os, datetime -from api.utils.utils import get_captcha, valid_captcha, get_choices_dict -from api.utils.response import BaseResponse -from fir_ser.settings import CACHE_KEY_TEMPLATE, LOGIN -from api.utils.storage.caches import login_auth_failed, del_cache_response_by_short, get_app_instance_by_cache, \ - get_download_url_by_cache -import logging -from api.utils.throttle import VisitRegister1Throttle, VisitRegister2Throttle -from rest_framework.pagination import PageNumberPagination from api.utils.baseutils import get_dict_from_filter_fields -from api.base_views import app_delete +from api.utils.response import BaseResponse +from api.utils.serializer import AdminAppsSerializer, AdminAppReleaseSerializer +from api.utils.storage.caches import del_cache_response_by_short, get_download_url_by_cache logger = logging.getLogger(__name__) diff --git a/fir_ser/admin/views/celery_flower.py b/fir_ser/admin/views/celery_flower.py index 6ef9a61..1c3d6f3 100644 --- a/fir_ser/admin/views/celery_flower.py +++ b/fir_ser/admin/views/celery_flower.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -from django.http import HttpResponse from django.conf import settings +from django.http import HttpResponse from django.utils.translation import ugettext as _ from proxy.views import proxy_view from rest_framework.views import APIView diff --git a/fir_ser/admin/views/domain.py b/fir_ser/admin/views/domain.py index d4349df..ce6e1a1 100644 --- a/fir_ser/admin/views/domain.py +++ b/fir_ser/admin/views/domain.py @@ -4,17 +4,18 @@ # author: liuyu # date: 2021/4/11 -from api.models import UserDomainInfo -from rest_framework.response import Response -from api.utils.auth import AdminTokenAuthentication -from api.utils.serializer import AdminDomainNameSerializer -from rest_framework.views import APIView -from api.utils.response import BaseResponse -from api.utils.storage.caches import del_cache_response_by_short, reset_app_wx_easy_type import logging + from rest_framework.pagination import PageNumberPagination +from rest_framework.response import Response +from rest_framework.views import APIView + +from api.models import UserDomainInfo +from api.utils.auth import AdminTokenAuthentication from api.utils.baseutils import get_dict_from_filter_fields -from api.base_views import app_delete +from api.utils.response import BaseResponse +from api.utils.serializer import AdminDomainNameSerializer +from api.utils.storage.caches import reset_app_wx_easy_type logger = logging.getLogger(__name__) diff --git a/fir_ser/admin/views/login.py b/fir_ser/admin/views/login.py index 242354e..d2e6d2a 100644 --- a/fir_ser/admin/views/login.py +++ b/fir_ser/admin/views/login.py @@ -4,17 +4,19 @@ # author: liuyu # date: 2021/4/11 +import logging + from django.contrib import auth from rest_framework.response import Response -from api.utils.auth import ExpiringTokenAuthentication -from api.utils.serializer import UserInfoSerializer from rest_framework.views import APIView -from api.utils.utils import get_captcha, valid_captcha, set_user_token + +from api.utils.auth import ExpiringTokenAuthentication from api.utils.response import BaseResponse -from fir_ser.settings import CACHE_KEY_TEMPLATE, LOGIN +from api.utils.serializer import UserInfoSerializer from api.utils.storage.caches import login_auth_failed -import logging from api.utils.throttle import VisitRegister1Throttle, VisitRegister2Throttle +from api.utils.utils import get_captcha, valid_captcha, set_user_token +from fir_ser.settings import LOGIN logger = logging.getLogger(__name__) diff --git a/fir_ser/admin/views/order.py b/fir_ser/admin/views/order.py index 60dac31..37aa786 100644 --- a/fir_ser/admin/views/order.py +++ b/fir_ser/admin/views/order.py @@ -4,26 +4,19 @@ # author: liuyu # date: 2021/4/11 -from django.contrib import auth +import logging -from api.base_views import storage_change -from api.models import Token, UserInfo, Order +from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response +from rest_framework.views import APIView + +from api.models import UserInfo, Order from api.utils.auth import AdminTokenAuthentication from api.utils.baseutils import get_dict_from_filter_fields -from api.utils.serializer import AdminStorageSerializer, AdminUserCertificationSerializer, AdminOrdersSerializer -from django.core.cache import cache -from rest_framework.views import APIView -import binascii -import os, datetime -from api.utils.utils import get_captcha, valid_captcha, get_choices_dict, get_order_num from api.utils.response import BaseResponse -from fir_ser.settings import CACHE_KEY_TEMPLATE, LOGIN -from api.utils.storage.caches import login_auth_failed, update_order_info -import logging -from api.utils.throttle import VisitRegister1Throttle, VisitRegister2Throttle -from rest_framework.pagination import PageNumberPagination -from api.utils.baseutils import format_storage_selection +from api.utils.serializer import AdminOrdersSerializer +from api.utils.storage.caches import update_order_info +from api.utils.utils import get_order_num logger = logging.getLogger(__name__) diff --git a/fir_ser/admin/views/storage.py b/fir_ser/admin/views/storage.py index b182c30..e363a26 100644 --- a/fir_ser/admin/views/storage.py +++ b/fir_ser/admin/views/storage.py @@ -4,26 +4,19 @@ # author: liuyu # date: 2021/4/11 -from django.contrib import auth +import logging -from api.base_views import storage_change -from api.models import Token, UserInfo, AppStorage +from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response +from rest_framework.views import APIView + +from api.base_views import storage_change +from api.models import UserInfo, AppStorage from api.utils.auth import AdminTokenAuthentication +from api.utils.baseutils import format_storage_selection from api.utils.baseutils import get_dict_from_filter_fields -from api.utils.serializer import AdminStorageSerializer, AdminUserCertificationSerializer -from django.core.cache import cache -from rest_framework.views import APIView -import binascii -import os, datetime -from api.utils.utils import get_captcha, valid_captcha, get_choices_dict from api.utils.response import BaseResponse -from fir_ser.settings import CACHE_KEY_TEMPLATE, LOGIN -from api.utils.storage.caches import login_auth_failed -import logging -from api.utils.throttle import VisitRegister1Throttle, VisitRegister2Throttle -from rest_framework.pagination import PageNumberPagination -from api.utils.baseutils import format_storage_selection +from api.utils.serializer import AdminStorageSerializer logger = logging.getLogger(__name__) diff --git a/fir_ser/admin/views/supersign.py b/fir_ser/admin/views/supersign.py index 3c56037..38d37cb 100644 --- a/fir_ser/admin/views/supersign.py +++ b/fir_ser/admin/views/supersign.py @@ -4,24 +4,17 @@ # author: liuyu # date: 2021/4/11 -from django.contrib import auth -from api.models import Token, APPSuperSignUsedInfo, AppIOSDeveloperInfo +import logging + +from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response +from rest_framework.views import APIView + +from api.models import APPSuperSignUsedInfo, AppIOSDeveloperInfo from api.utils.auth import AdminTokenAuthentication from api.utils.baseutils import get_dict_from_filter_fields -from api.utils.serializer import AdminDeveloperSerializer, AdminUserCertificationSerializer, \ - AdminSuperSignUsedSerializer -from django.core.cache import cache -from rest_framework.views import APIView -import binascii -import os, datetime -from api.utils.utils import get_captcha, valid_captcha, get_choices_dict from api.utils.response import BaseResponse -from fir_ser.settings import CACHE_KEY_TEMPLATE, LOGIN -from api.utils.storage.caches import login_auth_failed -import logging -from api.utils.throttle import VisitRegister1Throttle, VisitRegister2Throttle -from rest_framework.pagination import PageNumberPagination +from api.utils.serializer import AdminDeveloperSerializer, AdminSuperSignUsedSerializer logger = logging.getLogger(__name__) diff --git a/fir_ser/admin/views/user.py b/fir_ser/admin/views/user.py index 2b5513e..1a1bdc5 100644 --- a/fir_ser/admin/views/user.py +++ b/fir_ser/admin/views/user.py @@ -4,23 +4,17 @@ # author: liuyu # date: 2021/4/11 -from django.contrib import auth -from api.models import Token, UserInfo, UserCertificationInfo, ThirdWeChatUserInfo +import logging + +from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response +from rest_framework.views import APIView + +from api.models import UserInfo, UserCertificationInfo, ThirdWeChatUserInfo from api.utils.auth import AdminTokenAuthentication from api.utils.baseutils import get_dict_from_filter_fields -from api.utils.serializer import AdminUserInfoSerializer, AdminUserCertificationSerializer, AdminThirdWxSerializer -from django.core.cache import cache -from rest_framework.views import APIView -import binascii -import os, datetime -from api.utils.utils import get_captcha, valid_captcha, get_choices_dict from api.utils.response import BaseResponse -from fir_ser.settings import CACHE_KEY_TEMPLATE, LOGIN -from api.utils.storage.caches import login_auth_failed -import logging -from api.utils.throttle import VisitRegister1Throttle, VisitRegister2Throttle -from rest_framework.pagination import PageNumberPagination +from api.utils.serializer import AdminUserInfoSerializer, AdminUserCertificationSerializer, AdminThirdWxSerializer logger = logging.getLogger(__name__) diff --git a/fir_ser/api/base_views.py b/fir_ser/api/base_views.py index b497c2f..708ac93 100644 --- a/fir_ser/api/base_views.py +++ b/fir_ser/api/base_views.py @@ -4,14 +4,14 @@ # author: NinEveN # date: 2021/4/13 -from api.utils.response import BaseResponse +import logging +from api.models import AppReleaseInfo, APPToDeveloper, UserInfo, AppScreenShot, AppStorage from api.utils.app.supersignutils import IosUtils -from api.utils.storage.storage import Storage +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, MigrateStorageState -from api.models import AppReleaseInfo, APPToDeveloper, UserInfo, AppScreenShot, AppStorage -import logging +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, \ migrating_storage_data, clean_storage_data, check_storage_is_new_storage diff --git a/fir_ser/api/management/commands/services/command.py b/fir_ser/api/management/commands/services/command.py index 99e7a2d..70e90e0 100644 --- a/fir_ser/api/management/commands/services/command.py +++ b/fir_ser/api/management/commands/services/command.py @@ -1,7 +1,8 @@ -from django.core.management.base import BaseCommand, CommandError +from django.core.management.base import BaseCommand from django.db.models import TextChoices -from .utils import ServicesUtil + from .hands import * +from .utils import ServicesUtil class Services(TextChoices): diff --git a/fir_ser/api/management/commands/services/hands.py b/fir_ser/api/management/commands/services/hands.py index 1f9c271..bfceb79 100644 --- a/fir_ser/api/management/commands/services/hands.py +++ b/fir_ser/api/management/commands/services/hands.py @@ -1,13 +1,14 @@ +import logging import os +import subprocess import sys -import logging -from django.conf import settings -from config import BASE_DIR +import time + import psutil +from django.conf import settings -import time -import subprocess from config import BASECONF +from config import BASE_DIR try: __version__ = BASECONF.VERSION diff --git a/fir_ser/api/management/commands/services/services/__init__.py b/fir_ser/api/management/commands/services/services/__init__.py index 5918309..f327280 100644 --- a/fir_ser/api/management/commands/services/services/__init__.py +++ b/fir_ser/api/management/commands/services/services/__init__.py @@ -1,5 +1,5 @@ from .beat import * +from .celery_default import * from .flower import * from .gunicorn import * -from .celery_default import * from .uwsgi import * diff --git a/fir_ser/api/management/commands/services/services/base.py b/fir_ser/api/management/commands/services/services/base.py index 357f6fe..81bd5be 100644 --- a/fir_ser/api/management/commands/services/services/base.py +++ b/fir_ser/api/management/commands/services/services/base.py @@ -1,9 +1,9 @@ import abc -import shutil -import psutil import datetime -import threading import pwd +import shutil +import threading + from ..hands import * diff --git a/fir_ser/api/management/commands/services/services/beat.py b/fir_ser/api/management/commands/services/services/beat.py index 0600f50..3f7c736 100644 --- a/fir_ser/api/management/commands/services/services/beat.py +++ b/fir_ser/api/management/commands/services/services/beat.py @@ -1,7 +1,8 @@ -from ..hands import * -from .base import BaseService from django.core.cache import cache +from .base import BaseService +from ..hands import * + __all__ = ['BeatService'] diff --git a/fir_ser/api/management/commands/services/services/celery_base.py b/fir_ser/api/management/commands/services/services/celery_base.py index eca414a..1c06801 100644 --- a/fir_ser/api/management/commands/services/services/celery_base.py +++ b/fir_ser/api/management/commands/services/services/celery_base.py @@ -1,5 +1,5 @@ -from ..hands import * from .base import BaseService +from ..hands import * class CeleryBaseService(BaseService): diff --git a/fir_ser/api/management/commands/services/services/flower.py b/fir_ser/api/management/commands/services/services/flower.py index 30ba8aa..7e72027 100644 --- a/fir_ser/api/management/commands/services/services/flower.py +++ b/fir_ser/api/management/commands/services/services/flower.py @@ -1,5 +1,5 @@ -from ..hands import * from .base import BaseService +from ..hands import * __all__ = ['FlowerService'] diff --git a/fir_ser/api/management/commands/services/services/gunicorn.py b/fir_ser/api/management/commands/services/services/gunicorn.py index f3c3d76..5411ba8 100644 --- a/fir_ser/api/management/commands/services/services/gunicorn.py +++ b/fir_ser/api/management/commands/services/services/gunicorn.py @@ -1,5 +1,5 @@ -from ..hands import * from .base import BaseService +from ..hands import * __all__ = ['GunicornService'] diff --git a/fir_ser/api/management/commands/services/services/uwsgi.py b/fir_ser/api/management/commands/services/services/uwsgi.py index 3a0db98..443035b 100644 --- a/fir_ser/api/management/commands/services/services/uwsgi.py +++ b/fir_ser/api/management/commands/services/services/uwsgi.py @@ -1,5 +1,5 @@ -from ..hands import * from .base import BaseService +from ..hands import * __all__ = ['UwsgiService'] diff --git a/fir_ser/api/management/commands/services/utils.py b/fir_ser/api/management/commands/services/utils.py index c9d844c..866bddf 100644 --- a/fir_ser/api/management/commands/services/utils.py +++ b/fir_ser/api/management/commands/services/utils.py @@ -1,7 +1,9 @@ -import threading import signal +import threading + import daemon from daemon import pidfile + from .hands import * from .hands import __version__ from .services.base import BaseService diff --git a/fir_ser/api/migrations/0001_initial.py b/fir_ser/api/migrations/0001_initial.py index 23c5daa..fc0291c 100644 --- a/fir_ser/api/migrations/0001_initial.py +++ b/fir_ser/api/migrations/0001_initial.py @@ -1,9 +1,9 @@ # Generated by Django 3.0.3 on 2021-05-27 13:55 -from django.conf import settings import django.contrib.auth.models -from django.db import migrations, models import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models price_info_list = [ { diff --git a/fir_ser/api/migrations/0005_thirdwechatuserinfo.py b/fir_ser/api/migrations/0005_thirdwechatuserinfo.py index d368933..a7a2a11 100644 --- a/fir_ser/api/migrations/0005_thirdwechatuserinfo.py +++ b/fir_ser/api/migrations/0005_thirdwechatuserinfo.py @@ -1,8 +1,8 @@ # Generated by Django 3.2.3 on 2021-09-07 19:18 +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): diff --git a/fir_ser/api/migrations/0012_useraddisplayinfo.py b/fir_ser/api/migrations/0012_useraddisplayinfo.py index 9a683c1..4270c34 100644 --- a/fir_ser/api/migrations/0012_useraddisplayinfo.py +++ b/fir_ser/api/migrations/0012_useraddisplayinfo.py @@ -1,8 +1,8 @@ # Generated by Django 3.2.3 on 2021-10-14 14:35 +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): diff --git a/fir_ser/api/migrations/0015_iosdeveloperpublicpoolbill_remoteclientinfo.py b/fir_ser/api/migrations/0015_iosdeveloperpublicpoolbill_remoteclientinfo.py index c9f2c32..64e024a 100644 --- a/fir_ser/api/migrations/0015_iosdeveloperpublicpoolbill_remoteclientinfo.py +++ b/fir_ser/api/migrations/0015_iosdeveloperpublicpoolbill_remoteclientinfo.py @@ -1,8 +1,8 @@ # Generated by Django 3.2.3 on 2021-10-30 10:57 +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): diff --git a/fir_ser/api/migrations/0016_alter_appudid_udid.py b/fir_ser/api/migrations/0016_alter_appudid_udid.py index 1cbd765..7d9e024 100644 --- a/fir_ser/api/migrations/0016_alter_appudid_udid.py +++ b/fir_ser/api/migrations/0016_alter_appudid_udid.py @@ -1,7 +1,7 @@ # Generated by Django 3.2.3 on 2021-10-30 11:52 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/fir_ser/api/models.py b/fir_ser/api/models.py index ca9b920..0e20654 100644 --- a/fir_ser/api/models.py +++ b/fir_ser/api/models.py @@ -1,14 +1,14 @@ -from django.db import models - -# Create your models here. - +from django.contrib.auth.models import AbstractUser from django.contrib.contenttypes.models import ContentType +from django.db import models -from django.contrib.auth.models import AbstractUser from api.utils.TokenManager import generate_alphanumeric_token_of_length, generate_numeric_token_of_length from api.utils.baseutils import make_random_uuid +# Create your models here. + + ######################################## 用户表 ######################################## diff --git a/fir_ser/api/tasks.py b/fir_ser/api/tasks.py index d98fb2d..7a8c73c 100644 --- a/fir_ser/api/tasks.py +++ b/fir_ser/api/tasks.py @@ -7,16 +7,14 @@ from celery import shared_task from django.core.cache import cache -from api.utils.mp.wechat import sync_wx_access_token -from api.utils.storage.storage import get_local_storage - from api.models import Apps -from api.utils.app.supersignutils import IosUtils, resign_by_app_id, get_ios_developer_public_num +from api.utils.app.supersignutils import IosUtils, resign_by_app_id 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 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.views.login import get_login_type - from fir_ser.celery import app from fir_ser.settings import LOGIN, CHANGER, REGISTER diff --git a/fir_ser/api/urls.py b/fir_ser/api/urls.py index c4863e3..4f542a5 100644 --- a/fir_ser/api/urls.py +++ b/fir_ser/api/urls.py @@ -15,19 +15,19 @@ Including another URLconf """ from django.urls import re_path +from api.views.advert import UserAdInfoView +from api.views.apps import AppsView, AppInfoView, AppReleaseInfoView +from api.views.domain import DomainCnameView, DomainInfoView +from api.views.download import ShortDownloadView from api.views.login import LoginView, UserInfoView, RegistView, AuthorizationView, ChangeAuthorizationView, \ UserApiTokenView, CertificationView, ChangeInfoView, WeChatLoginView, WeChatLoginCheckView from api.views.logout import LogoutView -from api.views.apps import AppsView, AppInfoView, AppReleaseInfoView -from api.views.download import ShortDownloadView -from api.views.uploads import AppAnalyseView, UploadView -from api.views.storage import StorageView -from api.views.receiveudids import IosUDIDView, TaskView from api.views.order import PriceView, OrderView, PaySuccess +from api.views.receiveudids import IosUDIDView, TaskView +from api.views.storage import StorageView from api.views.supersign import DeveloperView, SuperSignUsedView, AppUDIDUsedView, SuperSignCertView -from api.views.domain import DomainCnameView, DomainInfoView from api.views.thirdlogin import ValidWxChatToken, ThirdWxAccount -from api.views.advert import UserAdInfoView +from api.views.uploads import AppAnalyseView, UploadView # router=DefaultRouter() # router.register("apps", AppsView) diff --git a/fir_ser/api/utils/TokenManager.py b/fir_ser/api/utils/TokenManager.py index 2916482..0dc406a 100644 --- a/fir_ser/api/utils/TokenManager.py +++ b/fir_ser/api/utils/TokenManager.py @@ -3,13 +3,15 @@ # project: 3月 # author: liuyu # date: 2020/3/8 -import uuid -import string +import logging import random +import string import time +import uuid + from django.core.cache import cache + from fir_ser.settings import CACHE_KEY_TEMPLATE -import logging logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/app/apputils.py b/fir_ser/api/utils/app/apputils.py index 06f7fad..fa6deb1 100644 --- a/fir_ser/api/utils/app/apputils.py +++ b/fir_ser/api/utils/app/apputils.py @@ -3,13 +3,14 @@ # project: 3月 # author: liuyu # date: 2020/3/6 -from api.models import AppReleaseInfo, Apps +import logging import random + +from api.models import AppReleaseInfo, Apps from api.utils.baseutils import make_app_uuid from api.utils.modelutils import get_user_domain_name -from api.utils.storage.storage import Storage from api.utils.storage.caches import del_cache_response_by_short -import logging +from api.utils.storage.storage import Storage logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/app/firApi.py b/fir_ser/api/utils/app/firApi.py index 4d522b8..d291240 100644 --- a/fir_ser/api/utils/app/firApi.py +++ b/fir_ser/api/utils/app/firApi.py @@ -4,12 +4,16 @@ # author: NinEveN # date: 2019/12/19 -import requests -import zipfile, re, os, random, io -from androguard.core.bytecodes import apk +import io +import os import plistlib +import re +import zipfile + import qrcode +import requests from PIL import Image +from androguard.core.bytecodes import apk def bytes2human(n): diff --git a/fir_ser/api/utils/app/iossignapi.py b/fir_ser/api/utils/app/iossignapi.py index 2fdac42..5cbcab1 100644 --- a/fir_ser/api/utils/app/iossignapi.py +++ b/fir_ser/api/utils/app/iossignapi.py @@ -3,19 +3,20 @@ # project: 4月 # author: liuyu # date: 2020/4/24 +import base64 import datetime - -from api.utils.app.shellcmds import shell_command, use_user_pass -from api.utils.baseutils import get_format_time, format_apple_date, make_app_uuid -from fir_ser.settings import SUPER_SIGN_ROOT +import logging import os import re -import logging -from api.utils.apple.appleapiv3 import AppStoreConnectApi -import base64 + from OpenSSL.crypto import (load_pkcs12, dump_certificate_request, dump_privatekey, PKey, TYPE_RSA, X509Req, dump_certificate, load_privatekey, load_certificate, PKCS12, FILETYPE_PEM, FILETYPE_ASN1) +from api.utils.app.shellcmds import shell_command, use_user_pass +from api.utils.apple.appleapiv3 import AppStoreConnectApi +from api.utils.baseutils import get_format_time, format_apple_date, make_app_uuid +from fir_ser.settings import SUPER_SIGN_ROOT + logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/app/raqc.py b/fir_ser/api/utils/app/raqc.py index 63c0fcb..fb20af7 100644 --- a/fir_ser/api/utils/app/raqc.py +++ b/fir_ser/api/utils/app/raqc.py @@ -13,9 +13,10 @@ Python生成二维码 v1.0 ''' +import os + import qrcode from PIL import Image -import os # 生成二维码图片 diff --git a/fir_ser/api/utils/app/shellcmds.py b/fir_ser/api/utils/app/shellcmds.py index 8410044..b242728 100644 --- a/fir_ser/api/utils/app/shellcmds.py +++ b/fir_ser/api/utils/app/shellcmds.py @@ -3,11 +3,15 @@ # project: 3月 # author: liuyu # date: 2020/3/6 -import time, re, os, signal -from subprocess import Popen, PIPE +import json import logging -import paramiko, json +import os +import signal import socket +import time +from subprocess import Popen, PIPE + +import paramiko logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py index 6aaf93d..a8e5cb8 100644 --- a/fir_ser/api/utils/app/supersignutils.py +++ b/fir_ser/api/utils/app/supersignutils.py @@ -8,9 +8,9 @@ import logging import os import time import uuid -import xmltodict import zipfile +import xmltodict from django.core.cache import cache from django.db.models import Sum diff --git a/fir_ser/api/utils/apple/appleapiv3.py b/fir_ser/api/utils/apple/appleapiv3.py index 875b27d..33dab48 100644 --- a/fir_ser/api/utils/apple/appleapiv3.py +++ b/fir_ser/api/utils/apple/appleapiv3.py @@ -6,13 +6,14 @@ # pip install pyjwt import base64 -import os import datetime -import requests -import jwt import logging +import os from collections import namedtuple +import jwt +import requests + logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/auth.py b/fir_ser/api/utils/auth.py index 68352d7..ac867a4 100644 --- a/fir_ser/api/utils/auth.py +++ b/fir_ser/api/utils/auth.py @@ -3,14 +3,16 @@ # project: 9月 # author: NinEveN # date: 2020/9/24 +import base64 + from django.core.cache import cache +from django.http.cookie import parse_cookie from rest_framework.authentication import BaseAuthentication from rest_framework.exceptions import AuthenticationFailed -from api.models import UserInfo from rest_framework.permissions import BasePermission + +from api.models import UserInfo from fir_ser.settings import CACHE_KEY_TEMPLATE -from django.http.cookie import parse_cookie -import base64 def get_cookie_token(request): diff --git a/fir_ser/api/utils/baseutils.py b/fir_ser/api/utils/baseutils.py index 3c22219..42026c4 100644 --- a/fir_ser/api/utils/baseutils.py +++ b/fir_ser/api/utils/baseutils.py @@ -4,17 +4,19 @@ # author: NinEveN # date: 2021/4/16 -import os, re, time - import datetime -from django.utils import timezone +import logging +import os +import re +import time +import uuid -from fir_ser.settings import SUPER_SIGN_ROOT, SERVER_DOMAIN -from django.core.validators import validate_email from django.core.exceptions import ValidationError -import logging +from django.core.validators import validate_email +from django.utils import timezone from dns.resolver import Resolver -import uuid + +from fir_ser.settings import SUPER_SIGN_ROOT, SERVER_DOMAIN logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/crontab/ctasks.py b/fir_ser/api/utils/crontab/ctasks.py index 89e1521..5c680d8 100644 --- a/fir_ser/api/utils/crontab/ctasks.py +++ b/fir_ser/api/utils/crontab/ctasks.py @@ -4,14 +4,17 @@ # author: liuyu # date: 2020/4/7 +import logging +import os +import time + +from django.core.cache import cache + from api.models import Apps, UserInfo, AppIOSDeveloperInfo -from api.utils.storage.storage import Storage from api.utils.app.supersignutils import IosUtils +from api.utils.storage.storage import Storage from api.utils.utils import send_ios_developer_active_status -from django.core.cache import cache from fir_ser.settings import CACHE_KEY_TEMPLATE, SYNC_CACHE_TO_DATABASE, SUPER_SIGN_ROOT, MSGTEMPLATE -import time, os -import logging logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/geetest/geetest_lib.py b/fir_ser/api/utils/geetest/geetest_lib.py index 02cf6e8..8878e76 100644 --- a/fir_ser/api/utils/geetest/geetest_lib.py +++ b/fir_ser/api/utils/geetest/geetest_lib.py @@ -1,8 +1,9 @@ -import random +import hashlib +import hmac import json +import random + import requests -import hmac -import hashlib from .geetest_lib_result import GeetestLibResult diff --git a/fir_ser/api/utils/geetest/geetest_utils.py b/fir_ser/api/utils/geetest/geetest_utils.py index 3c43f70..b926897 100644 --- a/fir_ser/api/utils/geetest/geetest_utils.py +++ b/fir_ser/api/utils/geetest/geetest_utils.py @@ -4,13 +4,15 @@ # author: NinEveN # date: 2021/3/25 -import requests import json import logging + +import requests from django.core.cache import cache as redis_connect + +from api.utils.geetest.geetest_lib import GeetestLib from fir_ser.settings import GEETEST_ID, GEETEST_KEY, GEETEST_BYPASS_URL, \ GEETEST_BYPASS_STATUS_KEY -from api.utils.geetest.geetest_lib import GeetestLib logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/middlewares.py b/fir_ser/api/utils/middlewares.py index 0bae9cd..d2491bc 100644 --- a/fir_ser/api/utils/middlewares.py +++ b/fir_ser/api/utils/middlewares.py @@ -1,6 +1,7 @@ -from django.utils.deprecation import MiddlewareMixin import logging +from django.utils.deprecation import MiddlewareMixin + logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/modelutils.py b/fir_ser/api/utils/modelutils.py index eb3a0d4..5188b5e 100644 --- a/fir_ser/api/utils/modelutils.py +++ b/fir_ser/api/utils/modelutils.py @@ -5,12 +5,13 @@ # date: 2021/4/16 -from django.db.models import Count -import random -from api.models import AppReleaseInfo, UserDomainInfo, DomainCnameInfo, UserAdDisplayInfo, RemoteClientInfo import logging +import random from urllib.parse import urljoin +from django.db.models import Count + +from api.models import AppReleaseInfo, UserDomainInfo, DomainCnameInfo, UserAdDisplayInfo, RemoteClientInfo from api.utils.baseutils import get_server_domain_from_request, get_user_default_domain_name, get_real_ip_address, \ get_origin_domain_name diff --git a/fir_ser/api/utils/mp/utils.py b/fir_ser/api/utils/mp/utils.py index 1195cc2..318268b 100644 --- a/fir_ser/api/utils/mp/utils.py +++ b/fir_ser/api/utils/mp/utils.py @@ -5,15 +5,17 @@ # date: 2021/9/6 import base64 +import hashlib import logging -import string import random +import socket +import string import struct -import hashlib -from Crypto.Cipher import AES -import xml.etree.cElementTree as ET import time -import socket +import xml.etree.cElementTree as ET + +from Crypto.Cipher import AES + from . import ierror logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/mp/wechat.py b/fir_ser/api/utils/mp/wechat.py index a58b038..a134670 100644 --- a/fir_ser/api/utils/mp/wechat.py +++ b/fir_ser/api/utils/mp/wechat.py @@ -3,16 +3,16 @@ # project: 9月 # author: NinEveN # date: 2021/9/6 -from hashlib import sha1 -import requests -import logging import json +import logging +from hashlib import sha1 +import requests from django.core.cache import cache from api.utils.baseutils import get_format_time -from fir_ser.settings import THIRDLOGINCONF, CACHE_KEY_TEMPLATE from api.utils.mp.utils import WxMsgCryptBase +from fir_ser.settings import THIRDLOGINCONF, CACHE_KEY_TEMPLATE logger = logging.getLogger(__name__) wx_login_info = THIRDLOGINCONF.wx_official diff --git a/fir_ser/api/utils/pay/ali.py b/fir_ser/api/utils/pay/ali.py index d1fe961..f928579 100644 --- a/fir_ser/api/utils/pay/ali.py +++ b/fir_ser/api/utils/pay/ali.py @@ -6,12 +6,12 @@ # pip install alipay-sdk-python==3.3.398 -from api.utils.pay.alipay import AliPay -from api.utils.pay.alipay.utils import AliPayConfig -from datetime import datetime, timedelta -from api.utils.storage.caches import update_order_info, update_order_status import json import logging +from datetime import datetime, timedelta + +from api.utils.pay.alipay import AliPay, AliPayConfig +from api.utils.storage.caches import update_order_info, update_order_status logger = logging.getLogger('pay') diff --git a/fir_ser/api/utils/pay/alipay/__init__.py b/fir_ser/api/utils/pay/alipay/__init__.py index c3205bf..532d996 100644 --- a/fir_ser/api/utils/pay/alipay/__init__.py +++ b/fir_ser/api/utils/pay/alipay/__init__.py @@ -5,19 +5,20 @@ ~~~~~~~~~~ """ +import hashlib import json +from base64 import decodebytes, encodebytes from datetime import datetime from functools import partial +from urllib.parse import quote_plus +from urllib.request import urlopen -import hashlib import OpenSSL from Crypto.Hash import SHA, SHA256 from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_v1_5 -from .compat import decodebytes, encodebytes, quote_plus, urlopen from .exceptions import AliPayException, AliPayValidationError -from .utils import AliPayConfig from .loggers import logger # 常见加密算法 @@ -32,6 +33,11 @@ CryptoAlgSet = ( ) +class AliPayConfig: + def __init__(self, timeout=15): + self.timeout = timeout + + class BaseAliPay: @property def appid(self): diff --git a/fir_ser/api/utils/pay/alipay/compat.py b/fir_ser/api/utils/pay/alipay/compat.py deleted file mode 100644 index 533d596..0000000 --- a/fir_ser/api/utils/pay/alipay/compat.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 -""" - compat.py - ~~~~~~~~~~ - -""" -from urllib.parse import quote_plus -from urllib.request import urlopen -from base64 import decodebytes, encodebytes diff --git a/fir_ser/api/utils/pay/alipay/loggers.py b/fir_ser/api/utils/pay/alipay/loggers.py index 3bb9f8d..ed4089c 100644 --- a/fir_ser/api/utils/pay/alipay/loggers.py +++ b/fir_ser/api/utils/pay/alipay/loggers.py @@ -1,4 +1,3 @@ -import logging import logging.config logging.config.dictConfig({ diff --git a/fir_ser/api/utils/pay/alipay/utils.py b/fir_ser/api/utils/pay/alipay/utils.py deleted file mode 100644 index ccf34b7..0000000 --- a/fir_ser/api/utils/pay/alipay/utils.py +++ /dev/null @@ -1,10 +0,0 @@ -""" - alipay/utils.py - ~~~~~~~~~~ - -""" - - -class AliPayConfig: - def __init__(self, timeout=15): - self.timeout = timeout diff --git a/fir_ser/api/utils/pay/util.py b/fir_ser/api/utils/pay/util.py index 4b4fb01..e800b06 100644 --- a/fir_ser/api/utils/pay/util.py +++ b/fir_ser/api/utils/pay/util.py @@ -4,9 +4,9 @@ # author: NinEveN # date: 2021/4/18 -from fir_ser.settings import PAY_CONFIG_KEY_INFO from api.utils.pay.ali import Alipay from api.utils.pay.wx import Weixinpay +from fir_ser.settings import PAY_CONFIG_KEY_INFO def get_pay_obj_form_name(pay_name): diff --git a/fir_ser/api/utils/pay/wx.py b/fir_ser/api/utils/pay/wx.py index 414606b..761a029 100644 --- a/fir_ser/api/utils/pay/wx.py +++ b/fir_ser/api/utils/pay/wx.py @@ -4,11 +4,12 @@ # author: NinEveN # date: 2021/3/18 -from api.utils.pay.wxpay import WeChatPay, WeChatPayType -from datetime import datetime, timedelta -from api.utils.storage.caches import update_order_info, update_order_status import json import logging +from datetime import datetime, timedelta + +from api.utils.pay.wxpay import WeChatPay, WeChatPayType +from api.utils.storage.caches import update_order_info, update_order_status logger = logging.getLogger('pay') diff --git a/fir_ser/api/utils/pay/wxpay/core.py b/fir_ser/api/utils/pay/wxpay/core.py index baf9ffa..cf4a84f 100644 --- a/fir_ser/api/utils/pay/wxpay/core.py +++ b/fir_ser/api/utils/pay/wxpay/core.py @@ -1,16 +1,12 @@ # -*- coding: utf-8 -*- import json -from enum import Enum - -import requests - -# -*- coding: utf-8 -*- - import time import uuid from base64 import b64decode, b64encode -import json +from enum import Enum +import requests +from OpenSSL import crypto from cryptography.exceptions import InvalidSignature from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric.padding import PKCS1v15 @@ -18,7 +14,6 @@ from cryptography.hazmat.primitives.ciphers.aead import AESGCM from cryptography.hazmat.primitives.hashes import SHA256 from cryptography.hazmat.primitives.serialization import (load_pem_private_key, load_pem_public_key) -from OpenSSL import crypto def build_authorization(path, diff --git a/fir_ser/api/utils/sendmsg/aliyunApi.py b/fir_ser/api/utils/sendmsg/aliyunApi.py index 5c46287..a537b8e 100644 --- a/fir_ser/api/utils/sendmsg/aliyunApi.py +++ b/fir_ser/api/utils/sendmsg/aliyunApi.py @@ -5,9 +5,10 @@ # date: 2020/3/22 +import json + from aliyunsdkcore.client import AcsClient from aliyunsdkcore.request import CommonRequest -import json class AliMsgSender(object): diff --git a/fir_ser/api/utils/sendmsg/jiguangApi.py b/fir_ser/api/utils/sendmsg/jiguangApi.py index fcdb4c8..2eaef1f 100644 --- a/fir_ser/api/utils/sendmsg/jiguangApi.py +++ b/fir_ser/api/utils/sendmsg/jiguangApi.py @@ -4,9 +4,10 @@ # author: liuyu # date: 2020/3/22 -import requests import json +import requests + class JiGuangMsgSender(object): BASE_URL = 'https://api.sms.jpush.cn/v1/' diff --git a/fir_ser/api/utils/sendmsg/sendmsg.py b/fir_ser/api/utils/sendmsg/sendmsg.py index 30c05a0..059b4e9 100644 --- a/fir_ser/api/utils/sendmsg/sendmsg.py +++ b/fir_ser/api/utils/sendmsg/sendmsg.py @@ -4,11 +4,12 @@ # author: liuyu # date: 2020/3/23 +import logging + +from fir_ser.settings import THIRD_PART_CONFIG_KEY_INFO from .aliyunApi import AliMsgSender from .emailApi import EmailMsgSender from .jiguangApi import JiGuangMsgSender -from fir_ser.settings import THIRD_PART_CONFIG_KEY_INFO -import logging logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/serializer.py b/fir_ser/api/utils/serializer.py index a257435..0eacc60 100644 --- a/fir_ser/api/utils/serializer.py +++ b/fir_ser/api/utils/serializer.py @@ -1,12 +1,15 @@ +import logging +import os + from rest_framework import serializers + from api import models from api.utils.TokenManager import make_token from api.utils.app.apputils import bytes2human from api.utils.modelutils import get_user_domain_name, get_app_domain_name, get_redirect_server_domain +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, get_choices_dict, get_choices_name_from_key -from api.utils.storage.caches import get_user_free_download_times, get_user_cert_auth_status -import os, logging logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/storage/aliyunApi.py b/fir_ser/api/utils/storage/aliyunApi.py index c367907..8ec30fb 100644 --- a/fir_ser/api/utils/storage/aliyunApi.py +++ b/fir_ser/api/utils/storage/aliyunApi.py @@ -6,15 +6,16 @@ # pip install aliyun-python-sdk-sts oss2 +import hashlib import json +import logging import os -from aliyunsdkcore import client -from aliyunsdksts.request.v20150401 import AssumeRoleRequest -import oss2 import re -import hashlib import time -import logging + +import oss2 +from aliyunsdkcore import client +from aliyunsdksts.request.v20150401 import AssumeRoleRequest from oss2 import SizedFileAdapter, determine_part_size from oss2.models import PartInfo diff --git a/fir_ser/api/utils/storage/caches.py b/fir_ser/api/utils/storage/caches.py index 65dd31d..13d86c4 100644 --- a/fir_ser/api/utils/storage/caches.py +++ b/fir_ser/api/utils/storage/caches.py @@ -4,19 +4,21 @@ # author: liuyu # date: 2020/4/7 +import logging +import os +import time + from django.core.cache import cache -from api.models import Apps, UserInfo, AppReleaseInfo, AppUDID, APPToDeveloper, APPSuperSignUsedInfo, \ - UserCertificationInfo, Order -import time, os +from django.db.models import F from django.utils import timezone +from api.models import Apps, UserInfo, AppReleaseInfo, AppUDID, APPToDeveloper, APPSuperSignUsedInfo, \ + UserCertificationInfo, Order +from api.utils.baseutils import check_app_password +from api.utils.modelutils import get_app_d_count_by_app_id, get_app_domain_name, get_user_domain_name +from api.utils.storage.storage import Storage, LocalStorage from fir_ser.settings import CACHE_KEY_TEMPLATE, SERVER_DOMAIN, SYNC_CACHE_TO_DATABASE, DEFAULT_MOBILEPROVISION, \ USER_FREE_DOWNLOAD_TIMES, AUTH_USER_FREE_DOWNLOAD_TIMES -from api.utils.storage.storage import Storage, LocalStorage -from api.utils.modelutils import get_app_d_count_by_app_id, get_app_domain_name, get_user_domain_name -from api.utils.baseutils import check_app_password -import logging -from django.db.models import F logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/storage/localApi.py b/fir_ser/api/utils/storage/localApi.py index 7669e10..918829e 100644 --- a/fir_ser/api/utils/storage/localApi.py +++ b/fir_ser/api/utils/storage/localApi.py @@ -6,11 +6,12 @@ """ 本地存储api """ +import logging +import os + from api.utils.TokenManager import make_token from api.utils.storage.aliyunApi import AliYunCdn from fir_ser import settings -import os -import logging logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/storage/qiniuApi.py b/fir_ser/api/utils/storage/qiniuApi.py index 98ee645..d69669d 100644 --- a/fir_ser/api/utils/storage/qiniuApi.py +++ b/fir_ser/api/utils/storage/qiniuApi.py @@ -6,10 +6,12 @@ """ 主要是调用七牛云存储,处理七牛云存储的逻辑 """ +import logging +import os + +import requests from qiniu import Auth, put_file, etag from qiniu import BucketManager -import os, requests -import logging logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/storage/storage.py b/fir_ser/api/utils/storage/storage.py index 3df793f..f07f063 100644 --- a/fir_ser/api/utils/storage/storage.py +++ b/fir_ser/api/utils/storage/storage.py @@ -4,15 +4,19 @@ # author: liuyu # date: 2020/3/23 +import base64 +import json +import logging +import time + +from django.core.cache import cache + from api.models import UserInfo -from .aliyunApi import AliYunOss, AliYunCdn -from .qiniuApi import QiNiuOss -from .localApi import LocalStorage -import json, time, base64 from api.utils.baseutils import get_dict_from_filter_fields from fir_ser.settings import THIRD_PART_CONFIG_KEY_INFO, CACHE_KEY_TEMPLATE -from django.core.cache import cache -import logging +from .aliyunApi import AliYunOss, AliYunCdn +from .localApi import LocalStorage +from .qiniuApi import QiNiuOss logger = logging.getLogger(__name__) diff --git a/fir_ser/api/utils/tempcaches.py b/fir_ser/api/utils/tempcaches.py index 44c133d..efa00b8 100644 --- a/fir_ser/api/utils/tempcaches.py +++ b/fir_ser/api/utils/tempcaches.py @@ -4,9 +4,10 @@ # author: NinEveN # date: 2020/9/24 -from django.core.cache import cache import base64 +from django.core.cache import cache + class TmpCache(object): diff --git a/fir_ser/api/utils/throttle.py b/fir_ser/api/utils/throttle.py index a4be7fd..a45a610 100644 --- a/fir_ser/api/utils/throttle.py +++ b/fir_ser/api/utils/throttle.py @@ -4,9 +4,10 @@ # author: NinEveN # date: 2021/3/25 -from rest_framework.throttling import SimpleRateThrottle import hashlib +from rest_framework.throttling import SimpleRateThrottle + class VisitShortThrottle(SimpleRateThrottle): """短连接用户访问频率限制1""" diff --git a/fir_ser/api/utils/utils.py b/fir_ser/api/utils/utils.py index fd93f27..9188a43 100644 --- a/fir_ser/api/utils/utils.py +++ b/fir_ser/api/utils/utils.py @@ -3,24 +3,27 @@ # project: 5月 # author: liuyu # date: 2020/5/7 -import os, datetime, random import binascii +import datetime +import logging +import os +import random + +from captcha.helpers import captcha_image_url +from captcha.models import CaptchaStore +from django.core.cache import cache -from api.utils.modelutils import get_app_d_count_by_app_id -from fir_ser.settings import SERVER_DOMAIN, CAPTCHA_LENGTH, MEDIA_ROOT, CACHE_KEY_TEMPLATE from api.models import APPSuperSignUsedInfo, APPToDeveloper, \ UDIDsyncDeveloper, UserInfo, AppReleaseInfo, AppScreenShot, Token, DeveloperDevicesID, UserAdDisplayInfo -from api.utils.storage.localApi import LocalStorage -from api.utils.storage.storage import Storage -from api.utils.tempcaches import TmpCache from api.utils.TokenManager import generate_numeric_token_of_length, generate_alphanumeric_token_of_length, make_token, \ verify_token +from api.utils.modelutils import get_app_d_count_by_app_id from api.utils.sendmsg.sendmsg import SendMessage -from captcha.models import CaptchaStore -from captcha.helpers import captcha_image_url from api.utils.storage.caches import consume_user_download_times -from django.core.cache import cache -import logging +from api.utils.storage.localApi import LocalStorage +from api.utils.storage.storage import Storage +from api.utils.tempcaches import TmpCache +from fir_ser.settings import SERVER_DOMAIN, CAPTCHA_LENGTH, MEDIA_ROOT, CACHE_KEY_TEMPLATE logger = logging.getLogger(__name__) diff --git a/fir_ser/api/views/advert.py b/fir_ser/api/views/advert.py index ce4cd52..719b152 100644 --- a/fir_ser/api/views/advert.py +++ b/fir_ser/api/views/advert.py @@ -3,16 +3,16 @@ # project: 10月 # author: liuyu # date: 2021/10/14 -from rest_framework.views import APIView +import logging -from api.utils.response import BaseResponse -from api.utils.auth import ExpiringTokenAuthentication, UserAdInfoPermission +from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response +from rest_framework.views import APIView + from api.models import UserAdDisplayInfo +from api.utils.auth import ExpiringTokenAuthentication, UserAdInfoPermission +from api.utils.response import BaseResponse from api.utils.serializer import UserAdInfoSerializer -from rest_framework.pagination import PageNumberPagination -import logging - from api.utils.storage.caches import reset_short_response_cache from api.utils.storage.storage import Storage diff --git a/fir_ser/api/views/apps.py b/fir_ser/api/views/apps.py index 430cb34..b1c7fe1 100644 --- a/fir_ser/api/views/apps.py +++ b/fir_ser/api/views/apps.py @@ -4,23 +4,24 @@ # author: liuyu # date: 2020/3/4 +import logging + +from django.db.models import Sum +from rest_framework.pagination import PageNumberPagination +from rest_framework.response import Response from rest_framework.views import APIView +from api.base_views import app_delete +from api.models import Apps, AppReleaseInfo, APPToDeveloper, AppIOSDeveloperInfo, UserInfo, AppScreenShot from api.tasks import run_resign_task -from api.utils.response import BaseResponse -from api.utils.auth import ExpiringTokenAuthentication -from rest_framework.response import Response -from django.db.models import Sum from api.utils.app.supersignutils import IosUtils, get_ios_developer_public_num -from api.utils.storage.storage import Storage -from api.utils.storage.caches import del_cache_response_by_short, get_app_today_download_times, del_cache_by_delete_app -from api.models import Apps, AppReleaseInfo, APPToDeveloper, AppIOSDeveloperInfo, UserInfo, AppScreenShot +from api.utils.auth import ExpiringTokenAuthentication +from api.utils.modelutils import get_user_domain_name, get_app_domain_name +from api.utils.response import BaseResponse from api.utils.serializer import AppsSerializer, AppReleaseSerializer, AppsListSerializer -from rest_framework.pagination import PageNumberPagination -import logging +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.modelutils import get_user_domain_name, get_app_domain_name -from api.base_views import app_delete logger = logging.getLogger(__name__) diff --git a/fir_ser/api/views/domain.py b/fir_ser/api/views/domain.py index 10df95e..aaee37b 100644 --- a/fir_ser/api/views/domain.py +++ b/fir_ser/api/views/domain.py @@ -3,17 +3,17 @@ # project: 3月 # author: NinEveN # date: 2021/3/29 +import logging + from rest_framework.pagination import PageNumberPagination +from rest_framework.response import Response from rest_framework.views import APIView +from api.models import UserDomainInfo, Apps +from api.utils.auth import ExpiringTokenAuthentication, DownloadQrPermission from api.utils.baseutils import is_valid_domain, get_cname_from_domain from api.utils.modelutils import get_user_domain_name, get_min_default_domain_cname_obj from api.utils.response import BaseResponse -from api.utils.auth import ExpiringTokenAuthentication, DownloadQrPermission -from rest_framework.response import Response -from api.models import UserDomainInfo, Apps -import logging - from api.utils.serializer import DomainNameSerializer from api.utils.storage.caches import del_cache_response_by_short, reset_app_wx_easy_type from api.utils.utils import get_choices_dict diff --git a/fir_ser/api/views/download.py b/fir_ser/api/views/download.py index d8dfca4..ccd04bc 100644 --- a/fir_ser/api/views/download.py +++ b/fir_ser/api/views/download.py @@ -4,28 +4,29 @@ # author: liuyu # date: 2020/3/6 +import logging +import os + +from django.http import FileResponse +from rest_framework.response import Response from rest_framework.views import APIView +from api.models import Apps, AppReleaseInfo, APPToDeveloper, APPSuperSignUsedInfo from api.utils.TokenManager import verify_token -from api.utils.response import BaseResponse -from rest_framework.response import Response -from fir_ser import settings from api.utils.app.apputils import make_resigned from api.utils.app.supersignutils import make_sign_udid_mobile_config -from api.utils.storage.storage import Storage, get_local_storage -from api.utils.storage.caches import get_app_instance_by_cache, get_download_url_by_cache, set_app_download_by_cache, \ - del_cache_response_by_short, consume_user_download_times, check_app_permission -import os -from api.utils.decorators import cache_response # 本来使用的是 drf-extensions==0.7.0 但是还未支持该版本Django -from api.utils.serializer import AppsShortSerializer, AppAdInfoSerializer -from api.models import Apps, AppReleaseInfo, APPToDeveloper, APPSuperSignUsedInfo -from django.http import FileResponse -import logging from api.utils.baseutils import get_profile_full_path, make_random_uuid, get_real_ip_address, get_origin_domain_name, \ format_get_uri, get_post_udid_url -from api.utils.throttle import VisitShortThrottle, InstallShortThrottle, InstallThrottle1, InstallThrottle2 +from api.utils.decorators import cache_response # 本来使用的是 drf-extensions==0.7.0 但是还未支持该版本Django from api.utils.modelutils import get_app_domain_name, get_filename_form_file, check_app_domain_name_access, \ ad_random_weight, get_redirect_server_domain +from api.utils.response import BaseResponse +from api.utils.serializer import AppsShortSerializer, AppAdInfoSerializer +from api.utils.storage.caches import get_app_instance_by_cache, get_download_url_by_cache, set_app_download_by_cache, \ + del_cache_response_by_short, consume_user_download_times, check_app_permission +from api.utils.storage.storage import Storage, get_local_storage +from api.utils.throttle import VisitShortThrottle, InstallShortThrottle, InstallThrottle1, InstallThrottle2 +from fir_ser import settings logger = logging.getLogger(__name__) diff --git a/fir_ser/api/views/login.py b/fir_ser/api/views/login.py index 0065dc4..3d3bdde 100644 --- a/fir_ser/api/views/login.py +++ b/fir_ser/api/views/login.py @@ -1,24 +1,24 @@ -from django.contrib import auth +import logging -from api.models import Token, UserInfo, UserCertificationInfo, CertificationInfo +from django.contrib import auth +from django.core.cache import cache from rest_framework.response import Response +from rest_framework.views import APIView +from api.models import Token, UserInfo, UserCertificationInfo, CertificationInfo +from api.utils.auth import ExpiringTokenAuthentication +from api.utils.baseutils import is_valid_phone, is_valid_email, get_real_ip_address +from api.utils.geetest.geetest_utils import first_register, second_validate +from api.utils.modelutils import get_min_default_domain_cname_obj from api.utils.mp.wechat import make_wx_login_qrcode, show_qrcode_url +from api.utils.response import BaseResponse from api.utils.serializer import UserInfoSerializer, CertificationSerializer, UserCertificationSerializer -from django.core.cache import cache -from rest_framework.views import APIView +from api.utils.storage.caches import login_auth_failed, set_wx_ticket_login_info_cache, get_wx_ticket_login_info_cache +from api.utils.throttle import VisitRegister1Throttle, VisitRegister2Throttle, GetAuthC1Throttle, GetAuthC2Throttle from api.utils.utils import get_captcha, valid_captcha, \ get_sender_sms_token, is_valid_sender_code, get_sender_email_token, get_random_username, \ check_username_exists, set_user_token -from api.utils.baseutils import is_valid_phone, is_valid_email, get_real_ip_address -from api.utils.modelutils import get_min_default_domain_cname_obj -from api.utils.auth import ExpiringTokenAuthentication -from api.utils.response import BaseResponse from fir_ser.settings import REGISTER, LOGIN, CHANGER -from api.utils.storage.caches import login_auth_failed, set_wx_ticket_login_info_cache, get_wx_ticket_login_info_cache -import logging -from api.utils.geetest.geetest_utils import first_register, second_validate -from api.utils.throttle import VisitRegister1Throttle, VisitRegister2Throttle, GetAuthC1Throttle, GetAuthC2Throttle logger = logging.getLogger(__name__) diff --git a/fir_ser/api/views/logout.py b/fir_ser/api/views/logout.py index f3e6dc2..ac50b81 100644 --- a/fir_ser/api/views/logout.py +++ b/fir_ser/api/views/logout.py @@ -1,10 +1,12 @@ -from rest_framework.views import APIView -from api.utils.auth import ExpiringTokenAuthentication -from api.models import Token +import logging + +from django.contrib import auth from django.core.cache import cache from rest_framework.response import Response -from django.contrib import auth -import logging +from rest_framework.views import APIView + +from api.models import Token +from api.utils.auth import ExpiringTokenAuthentication logger = logging.getLogger(__name__) diff --git a/fir_ser/api/views/order.py b/fir_ser/api/views/order.py index 92c418b..a39d6b2 100644 --- a/fir_ser/api/views/order.py +++ b/fir_ser/api/views/order.py @@ -4,17 +4,19 @@ # author: NinEveN # date: 2021/3/29 -from rest_framework.views import APIView -from api.utils.response import BaseResponse -from api.utils.auth import ExpiringTokenAuthentication +import logging + +from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response +from rest_framework.views import APIView + from api.models import Price, Order +from api.utils.auth import ExpiringTokenAuthentication +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.serializer import PriceSerializer, OrdersSerializer -from rest_framework.pagination import PageNumberPagination -from api.utils.utils import get_order_num, get_choices_dict from api.utils.storage.caches import update_order_status -import logging -from api.utils.pay.util import get_pay_obj_form_name, get_enable_pay_choices, get_payment_type +from api.utils.utils import get_order_num, get_choices_dict logger = logging.getLogger(__name__) diff --git a/fir_ser/api/views/receiveudids.py b/fir_ser/api/views/receiveudids.py index f64f12d..5e08fc7 100644 --- a/fir_ser/api/views/receiveudids.py +++ b/fir_ser/api/views/receiveudids.py @@ -3,23 +3,23 @@ # project: 3月 # author: liuyu # date: 2020/3/6 -from api.utils.app.supersignutils import udid_bytes_to_dict, make_sign_udid_mobile_config, IosUtils +import logging -from api.models import Apps -from django.views import View +from celery.exceptions import TimeoutError from django.http import HttpResponsePermanentRedirect, FileResponse, HttpResponse +from django.views import View from rest_framework.response import Response +from rest_framework.views import APIView + +from api.models import Apps from api.tasks import run_sign_task +from api.utils.app.supersignutils import udid_bytes_to_dict, make_sign_udid_mobile_config +from api.utils.baseutils import get_real_ip_address, get_http_server_domain, make_random_uuid +from api.utils.modelutils import get_app_domain_name, get_redirect_server_domain from api.utils.response import BaseResponse from api.utils.storage.caches import check_app_permission from api.utils.throttle import ReceiveUdidThrottle1, ReceiveUdidThrottle2 from fir_ser.celery import app -import logging -from rest_framework.views import APIView - -from api.utils.baseutils import get_real_ip_address, get_http_server_domain, make_random_uuid -from api.utils.modelutils import get_app_domain_name, get_redirect_server_domain -from celery.exceptions import TimeoutError logger = logging.getLogger(__name__) diff --git a/fir_ser/api/views/storage.py b/fir_ser/api/views/storage.py index 46b14c8..957aa80 100644 --- a/fir_ser/api/views/storage.py +++ b/fir_ser/api/views/storage.py @@ -4,17 +4,18 @@ # author: liuyu # date: 2020/3/4 +import logging + +from rest_framework.response import Response from rest_framework.views import APIView from api.base_views import storage_change -from api.utils.response import BaseResponse -from api.utils.auth import ExpiringTokenAuthentication, StoragePermission -from rest_framework.response import Response from api.models import AppStorage, UserInfo +from api.utils.auth import ExpiringTokenAuthentication, StoragePermission +from api.utils.response import BaseResponse +from api.utils.serializer import StorageSerializer from api.utils.storage.caches import MigrateStorageState from api.utils.utils import upload_oss_default_head_img, get_choices_dict -from api.utils.serializer import StorageSerializer -import logging logger = logging.getLogger(__name__) diff --git a/fir_ser/api/views/supersign.py b/fir_ser/api/views/supersign.py index 821818e..9b1f22b 100644 --- a/fir_ser/api/views/supersign.py +++ b/fir_ser/api/views/supersign.py @@ -3,18 +3,19 @@ # project: 3月 # author: liuyu # date: 2020/3/4 +import logging + from django.http.response import FileResponse +from rest_framework.pagination import PageNumberPagination +from rest_framework.response import Response from rest_framework.views import APIView -from api.utils.response import BaseResponse -from api.utils.auth import ExpiringTokenAuthentication, SuperSignPermission -from rest_framework.response import Response from api.models import AppIOSDeveloperInfo, APPSuperSignUsedInfo, AppUDID -from api.utils.serializer import DeveloperSerializer, SuperSignUsedSerializer, DeviceUDIDSerializer -from rest_framework.pagination import PageNumberPagination from api.utils.app.supersignutils import IosUtils +from api.utils.auth import ExpiringTokenAuthentication, SuperSignPermission +from api.utils.response import BaseResponse +from api.utils.serializer import DeveloperSerializer, SuperSignUsedSerializer, DeviceUDIDSerializer from api.utils.utils import get_developer_devices, get_choices_dict -import logging logger = logging.getLogger(__name__) diff --git a/fir_ser/api/views/thirdlogin.py b/fir_ser/api/views/thirdlogin.py index ce7564f..2854485 100644 --- a/fir_ser/api/views/thirdlogin.py +++ b/fir_ser/api/views/thirdlogin.py @@ -3,16 +3,17 @@ # project: 3月 # author: NinEveN # date: 2021/3/29 -from rest_framework.pagination import PageNumberPagination -from rest_framework.response import Response -from django.http.response import HttpResponse import logging import random + +from django.http.response import HttpResponse +from rest_framework.pagination import PageNumberPagination +from rest_framework.response import Response from rest_framework.views import APIView from rest_framework_xml.parsers import XMLParser + from api.models import ThirdWeChatUserInfo, UserInfo, UserCertificationInfo from api.utils.auth import ExpiringTokenAuthentication - 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 diff --git a/fir_ser/api/views/uploads.py b/fir_ser/api/views/uploads.py index 536d01b..2a03e5c 100644 --- a/fir_ser/api/views/uploads.py +++ b/fir_ser/api/views/uploads.py @@ -3,20 +3,24 @@ # project: 3月 # author: liuyu # date: 2020/3/6 +import json +import logging +import os + +from rest_framework.response import Response +from rest_framework.views import APIView + +from api.models import Apps, AppReleaseInfo, UserInfo, AppScreenShot, CertificationInfo, UserAdDisplayInfo +from api.tasks import run_resign_task from api.utils.TokenManager import verify_token from api.utils.app.apputils import get_random_short, save_app_infos -from api.utils.modelutils import get_app_domain_name, get_redirect_server_domain -from api.utils.storage.storage import Storage -from api.utils.storage.caches import upload_file_tmp_name, del_cache_response_by_short -from api.models import Apps, AppReleaseInfo, UserInfo, AppScreenShot, CertificationInfo, UserAdDisplayInfo +from api.utils.auth import ExpiringTokenAuthentication from api.utils.baseutils import make_app_uuid, make_from_user_uuid -from rest_framework.views import APIView +from api.utils.modelutils import get_app_domain_name, get_redirect_server_domain from api.utils.response import BaseResponse -from api.utils.auth import ExpiringTokenAuthentication -from rest_framework.response import Response +from api.utils.storage.caches import upload_file_tmp_name, del_cache_response_by_short +from api.utils.storage.storage import Storage from fir_ser import settings -from api.tasks import run_resign_task -import os, json, logging logger = logging.getLogger(__name__) diff --git a/fir_ser/cli.py b/fir_ser/cli.py index b217f9b..c4c36d3 100644 --- a/fir_ser/cli.py +++ b/fir_ser/cli.py @@ -4,12 +4,12 @@ # author: NinEveN # date: 2021/1/9 import argparse +import json import os -import sys import plistlib import random import re -import json +import sys import zipfile ''' diff --git a/fir_ser/cli/urls.py b/fir_ser/cli/urls.py index 0c3ad17..f09db92 100644 --- a/fir_ser/cli/urls.py +++ b/fir_ser/cli/urls.py @@ -13,10 +13,10 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ -from django.urls import path, re_path, include +from django.urls import re_path -from cli.views.login import CliUserInfoView from cli.views.apps import CliAppsView, CliAppInfoView, CliAppReleaseInfoView +from cli.views.login import CliUserInfoView from cli.views.uploads import CliAppAnalyseView, CliUploadView urlpatterns = [ diff --git a/fir_ser/cli/views/apps.py b/fir_ser/cli/views/apps.py index 83b806d..d5ef45f 100644 --- a/fir_ser/cli/views/apps.py +++ b/fir_ser/cli/views/apps.py @@ -4,9 +4,10 @@ # author: liuyu # date: 2020/3/4 +import logging + from api.utils.auth import ApiTokenAuthentication from api.views.apps import AppsView, AppInfoView, AppReleaseInfoView -import logging logger = logging.getLogger(__name__) diff --git a/fir_ser/cli/views/login.py b/fir_ser/cli/views/login.py index e6bd1f0..df2ff4c 100644 --- a/fir_ser/cli/views/login.py +++ b/fir_ser/cli/views/login.py @@ -1,6 +1,6 @@ -from api.utils.auth import ApiTokenAuthentication import logging +from api.utils.auth import ApiTokenAuthentication from api.views.login import UserInfoView logger = logging.getLogger(__name__) diff --git a/fir_ser/fir_ser/celery.py b/fir_ser/fir_ser/celery.py index 8492f0b..ae1e97c 100644 --- a/fir_ser/fir_ser/celery.py +++ b/fir_ser/fir_ser/celery.py @@ -5,10 +5,10 @@ # date: 2021/5/27 import os + from celery import Celery # set the default Django settings module for the 'celery' program. -from fir_ser.settings import SYNC_CACHE_TO_DATABASE, GEETEST_CYCLE_TIME os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fir_ser.settings') diff --git a/fir_ser/fir_ser/urls.py b/fir_ser/fir_ser/urls.py index 93bc4fb..f12104d 100644 --- a/fir_ser/fir_ser/urls.py +++ b/fir_ser/fir_ser/urls.py @@ -18,9 +18,9 @@ from django.urls import re_path, include from django.views.static import serve from admin.views.celery_flower import CeleryFlowerView -from fir_ser import settings from api.views.download import DownloadView, InstallView from api.views.receiveudids import IosUDIDView, ShowUdidView +from fir_ser import settings urlpatterns = [ re_path('fly.admin/', admin.site.urls), diff --git a/fir_ser/tests/postudid.py b/fir_ser/tests/postudid.py index fe78613..2625cba 100644 --- a/fir_ser/tests/postudid.py +++ b/fir_ser/tests/postudid.py @@ -1,6 +1,7 @@ -import requests import random +import requests + short = ["bgql", "wjbu", "vnfg", "bgql"] udid_lists = [