优化代码下载

publicsignpoll
youngS 3 years ago
parent dd5d0ed0ed
commit b772d2921e
  1. 9
      fir_client/src/components/FirDownload.vue
  2. 10
      fir_client/src/components/ShortDownload.vue
  3. 8
      fir_ser/api/utils/serializer.py
  4. 2
      fir_ser/api/views/download.py

@ -225,6 +225,9 @@
<div v-if="agent!==''">
<div v-if="ad_info.ad_uri" style="margin-bottom: 80px"/>
<div class="app_bottom_fixed" v-if="ad_info.ad_uri">
<div class="signhelp-title">
<span><a class="closead" @click="ad_info.ad_uri=undefined">关闭</a></span>
</div>
<a :href="ad_info.ad_uri" target="_blank">
<img :src="ad_info.ad_pic" alt="welcome" style="object-fit: cover">
</a>
@ -245,7 +248,7 @@
<div ref="signhelp" class="signhelp screenshots-section">
<div class="signhelp-title">
iOS安装教程
<span><a id="closeBtn" @click="jiaocheng('close')">关闭</a></span>
<span><a @click="jiaocheng('close')">关闭</a></span>
</div>
<div class="list-wrapper" style="width: 300px;">
@ -1574,4 +1577,8 @@
right: -20px;
}
.signhelp-title .closead {
top: 38px;
right: -6px;
}
</style>

@ -5,7 +5,7 @@
<div ref="signhelp" class="signhelp screenshots-section">
<div class="signhelp-title">
iOS安装教程
<span><a id="closeBtn" @click="jiaocheng('close')">关闭</a></span>
<span><a @click="jiaocheng('close')">关闭</a></span>
</div>
<div class="list-wrapper" style="width: 300px;">
@ -239,6 +239,9 @@
<div v-if="agent!==''">
<div v-if="ad_info.ad_uri" style="margin-bottom: 80px"/>
<div class="app_bottom_fixed" v-if="ad_info.ad_uri">
<div class="signhelp-title">
<span><a class="closead" @click="ad_info.ad_uri=undefined">关闭</a></span>
</div>
<a :href="ad_info.ad_uri" target="_blank">
<img :src="ad_info.ad_pic" alt="welcome" style="object-fit: cover">
</a>
@ -1578,4 +1581,9 @@
top: -20px;
right: -20px;
}
.signhelp-title .closead {
top: 38px;
right: -6px;
}
</style>

@ -48,8 +48,7 @@ def get_app_master_obj_from_context(self, obj):
def get_screenshots_from_self(self, obj, force_new=False):
screenshots_list = []
for screenshot_obj in models.AppScreenShot.objects.filter(app_id=obj).all():
key = ''
icon_url = get_download_url_from_context(self, obj, key, screenshot_obj.screenshot_url, force_new)
icon_url = get_download_url_from_context(self, obj, '', screenshot_obj.screenshot_url, force_new)
screenshots_list.append({'id': screenshot_obj.pk, 'url': icon_url})
return screenshots_list
@ -671,3 +670,8 @@ class AppAdInfoSerializer(UserAdInfoSerializer):
class Meta:
model = models.UserAdDisplayInfo
fields = ["ad_uri", "ad_pic"]
ad_pic = serializers.SerializerMethodField()
def get_ad_pic(self, obj):
return get_download_url_from_context(self, obj, '', obj.ad_pic, True)

@ -174,7 +174,7 @@ class ShortDownloadView(APIView):
res.udid = udid
res.domain_name = domain_name
if user_obj and user_obj.role and user_obj.role > 1:
res.ad = AppAdInfoSerializer(ad_random_weight(user_obj)).data
res.ad = AppAdInfoSerializer(ad_random_weight(user_obj), context={"key": "ShortDownloadView"}).data
return Response(res.dict)
# key的设置

Loading…
Cancel
Save