- {{ short_url(appinfo) }}
+ >{{ appinfo.preview_url }}
预览
保存本地
@@ -213,15 +213,12 @@ export default {
this.isIndeterminate = checkedCount > 0 && checkedCount < this.allQrcodeAppid.length;
},
go_download(appinfo) {
- window.open(this.short_url(appinfo), '_blank', '');
+ window.open(appinfo.preview_url, '_blank', '');
},
qrback(dataUrl, id) {
this.qrcode_img_info[id] = dataUrl;
this.allQrcodeAppid.push(id);
},
- short_url(appinfo) {
- return appinfo.preview_url + '/' + appinfo.short;
- },
save_qr(appinfo) {
let dtype = "I";
if (appinfo.master_release.release_type === 0) {
diff --git a/fir_ser/api/tasks.py b/fir_ser/api/tasks.py
index dc7affa..606e12b 100644
--- a/fir_ser/api/tasks.py
+++ b/fir_ser/api/tasks.py
@@ -22,17 +22,18 @@ from xsign.utils.ctasks import auto_delete_ios_mobile_tmp_file
logger = logging.getLogger(__name__)
+def clean_config_cache(key):
+ ConfigCacheBase().invalid_config_cache(key)
+ ConfigCacheBase(px='user').invalid_config_cache(key)
+
+
@app.task
def start_api_sever_do_clean():
# 启动服务的时候,同时执行下面操作,主要是修改配置存储的时候,需要执行清理,否则会出问题,如果不修改,则无需执行
logger.info("clean local storage cache")
get_local_storage(clean_cache=True)
check_bypass_status()
- ConfigCacheBase().invalid_config_cache()
-
-
-def clean_config_cache(key):
- return ConfigCacheBase().invalid_config_cache(key)
+ clean_config_cache('*')
@app.task
diff --git a/fir_ser/api/utils/modelutils.py b/fir_ser/api/utils/modelutils.py
index 5974320..ba13a1c 100644
--- a/fir_ser/api/utils/modelutils.py
+++ b/fir_ser/api/utils/modelutils.py
@@ -319,3 +319,7 @@ def get_user_storage_obj(user_obj, default=False):
auth = storage.get('auth', {})
storage = AppStorage(user_id=user_obj, storage_type=storage_type, **auth)
return storage
+
+
+def get_preview_short_config(user_obj, short):
+ return f"{'#/' if UserConfig(user_obj).PREVIEW_ROUTE_HASH else ''}{short}"
diff --git a/fir_ser/api/utils/serializer.py b/fir_ser/api/utils/serializer.py
index 4fbd317..04ae1df 100644
--- a/fir_ser/api/utils/serializer.py
+++ b/fir_ser/api/utils/serializer.py
@@ -7,7 +7,8 @@ from rest_framework.exceptions import ValidationError
from api import models
from api.utils.apputils import bytes2human
-from api.utils.modelutils import get_user_domain_name, get_app_domain_name, get_app_download_uri, get_user_storage_used
+from api.utils.modelutils import get_user_domain_name, get_app_domain_name, get_app_download_uri, get_user_storage_used, \
+ get_preview_short_config
from common.base.baseutils import get_choices_dict, WeixinLoginUid
from common.cache.storage import AdPicShowCache
from common.core.sysconfig import Config, UserConfig
@@ -153,19 +154,7 @@ class AppsSerializer(serializers.ModelSerializer):
preview_url = serializers.SerializerMethodField()
def get_preview_url(self, obj):
- return get_app_download_uri(None, obj.user_id, obj)
-
- # private_developer_number = serializers.IntegerField(default=0)
- # count = serializers.IntegerField(default=0)
- #
- # def get_private_developer_number(self, obj):
- # return models.AppleDeveloperToAppUse.objects.filter(app_id=obj).count()
- #
- # private_developer_used_number = serializers.IntegerField(default=0)
- #
- # def get_private_developer_used_number(self, obj):
- # return models.DeveloperDevicesID.objects.filter(app_id=obj,
- # developerid__appledevelopertoappuse__app_id=obj).distinct().count()
+ return f"{get_app_download_uri(None, obj.user_id, obj)}/{get_preview_short_config(obj.user_id, obj.short)}"
domain_name = serializers.SerializerMethodField()
diff --git a/fir_ser/api/views/download.py b/fir_ser/api/views/download.py
index fc3e3c5..10b2179 100644
--- a/fir_ser/api/views/download.py
+++ b/fir_ser/api/views/download.py
@@ -13,12 +13,12 @@ from rest_framework.views import APIView
from api.models import Apps, AppReleaseInfo
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, get_preview_short_config
from api.utils.response import BaseResponse
from api.utils.serializer import AppsShortSerializer, AppAdInfoSerializer
from api.utils.signalutils import run_get_xsign_binary_file
from common.base.baseutils import get_origin_domain_name, format_get_uri, make_random_uuid, make_resigned
-from common.core.decorators import cache_response # 本来使用的是 drf-extensions==0.7.0 但是还未支持该版本Django
+from common.core.decorators import cache_response
from common.core.response import mobileprovision_file_response, file_response, ApiResponse
from common.core.sysconfig import Config
from common.core.throttle import VisitShortThrottle, InstallShortThrottle, InstallThrottle1, InstallThrottle2
@@ -124,7 +124,8 @@ class ShortDownloadView(APIView):
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})
+ res.data = format_get_uri(domain_name, get_preview_short_config(user_obj, short),
+ {'release_id': release_id, 'udid': udid})
return Response(res.dict)
if udid:
if not app_obj.issupersign:
diff --git a/fir_ser/common/core/sysconfig.py b/fir_ser/common/core/sysconfig.py
index cef6181..242e1fd 100644
--- a/fir_ser/common/core/sysconfig.py
+++ b/fir_ser/common/core/sysconfig.py
@@ -445,6 +445,10 @@ class UserPersonalConfKeyCache(ConfigCacheBase):
def DEVELOPER_STATUS_CONFIG(self):
return super().get_value('DEVELOPER_STATUS_CONFIG', USERPERSONALCONFIGKEY.DEVELOPER_STATUS_CONFIG)
+ @property
+ def PREVIEW_ROUTE_HASH(self):
+ return super().get_value('PREVIEW_ROUTE_HASH', USERPERSONALCONFIGKEY.PREVIEW_ROUTE_HASH)
+
class ConfigDescriptionCache(ConfigCacheBase):
def __init__(self, *args, **kwargs):
diff --git a/fir_ser/config.py b/fir_ser/config.py
index df58643..eb60f8e 100644
--- a/fir_ser/config.py
+++ b/fir_ser/config.py
@@ -468,6 +468,7 @@ class CONFIGDESCRIPTION(object):
class USERPERSONALCONFIGKEY(object):
DEVELOPER_STATUS_CONFIG = ['DEVELOPER_WAIT_ABNORMAL_STATE', 'DEVELOPER_WAIT_ABNORMAL_DEVICE',
'DEVELOPER_ABNORMAL_DEVICE_WRITE']
+ PREVIEW_ROUTE_HASH = False # 预览路由模式是否是hash, 如果使用hash模式,url中就会存在“#“符号,这个符号后面的是路径。
class OSSSTORAGECONF(object):