diff --git a/fir_client/src/components/FirDownload.vue b/fir_client/src/components/FirDownload.vue index c0910b6..d5f96e2 100644 --- a/fir_client/src/components/FirDownload.vue +++ b/fir_client/src/components/FirDownload.vue @@ -709,6 +709,10 @@ export default { } getShortAppinfo(data => { if (data.code === 1000) { + if (data.redirect && data.data) { + window.location.href = data.data; + return + } if (data.ad && data.ad.ad_uri) { this.ad_info = data.ad; } diff --git a/fir_client/src/components/ShortDownload.vue b/fir_client/src/components/ShortDownload.vue index b9edfe2..2193001 100644 --- a/fir_client/src/components/ShortDownload.vue +++ b/fir_client/src/components/ShortDownload.vue @@ -671,6 +671,10 @@ export default { } getShortAppinfo(data => { if (data.code === 1000) { + if (data.redirect && data.data) { + window.location.href = data.data; + return + } if (data.ad && data.ad.ad_uri) { this.ad_info = data.ad; } @@ -804,7 +808,7 @@ export default { trident: u.indexOf('Trident') > -1, //IE内核 presto: u.indexOf('Presto') > -1, //opera内核 webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 - gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核 + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //火狐内核 mobile: !!u.match(/AppleWebKit.*Mobile/i) || !!u.match(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/), //是否为移动终端 ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器 diff --git a/fir_ser/api/migrations/0024_auto_20211108_1755.py b/fir_ser/api/migrations/0024_auto_20211108_1755.py index c64e6f8..6d95cd7 100644 --- a/fir_ser/api/migrations/0024_auto_20211108_1755.py +++ b/fir_ser/api/migrations/0024_auto_20211108_1755.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('api', '0023_remove_appudid_binary_file'), ] @@ -18,6 +17,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='order', name='order_type', - field=models.SmallIntegerField(choices=[(0, '用户下单'), (1, '后台充值'), (2, '系统赠送')], default=0, verbose_name='订单类型'), + field=models.SmallIntegerField(choices=[(0, '用户下单'), (1, '后台充值'), (2, '系统赠送')], default=0, + verbose_name='订单类型'), ), ] diff --git a/fir_ser/api/models.py b/fir_ser/api/models.py index 98d6c5e..4f0a1a5 100644 --- a/fir_ser/api/models.py +++ b/fir_ser/api/models.py @@ -92,7 +92,7 @@ class Token(models.Model): UserInfo, related_name='auth_token', on_delete=models.CASCADE, verbose_name="关联用户" ) - remote_addr = models.GenericIPAddressField(verbose_name="远程IP地址",null=True,blank=True) + remote_addr = models.GenericIPAddressField(verbose_name="远程IP地址", null=True, blank=True) created = models.DateTimeField(verbose_name="创建时间", auto_now_add=True) def __str__(self): diff --git a/fir_ser/api/utils/baseutils.py b/fir_ser/api/utils/baseutils.py index 994927e..37b7b19 100644 --- a/fir_ser/api/utils/baseutils.py +++ b/fir_ser/api/utils/baseutils.py @@ -9,10 +9,10 @@ import datetime import hashlib import logging import os +import random import re import time import uuid -import random from Crypto import Random from Crypto.Cipher import AES diff --git a/fir_ser/api/utils/utils.py b/fir_ser/api/utils/utils.py index fe3eea2..cb158d4 100644 --- a/fir_ser/api/utils/utils.py +++ b/fir_ser/api/utils/utils.py @@ -7,7 +7,6 @@ import binascii import datetime import logging import os -import random from captcha.helpers import captcha_image_url from captcha.models import CaptchaStore diff --git a/fir_ser/api/views/download.py b/fir_ser/api/views/download.py index 4d0a63c..976afbc 100644 --- a/fir_ser/api/views/download.py +++ b/fir_ser/api/views/download.py @@ -157,7 +157,9 @@ class ShortDownloadView(APIView): domain_name = get_redirect_server_domain(request, user_obj, get_app_domain_name(app_obj)) origin_domain_name = get_origin_domain_name(request) if domain_name.split('//')[-1].split('/')[0] != origin_domain_name: - res.code = 302 + res.code = 1000 + res.domain_name = domain_name + res.redirect = True res.data = format_get_uri(domain_name, short, {'release_id': release_id, 'udid': udid}) return Response(res.dict) diff --git a/fir_ser/api/views/login.py b/fir_ser/api/views/login.py index 8420e45..62e8bd4 100644 --- a/fir_ser/api/views/login.py +++ b/fir_ser/api/views/login.py @@ -1,11 +1,10 @@ import logging 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, Apps +from api.models import UserInfo, UserCertificationInfo, CertificationInfo, Apps 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