From 0df8cf68beb47b24b4700776b139db9a1dace6a8 Mon Sep 17 00:00:00 2001 From: youngS Date: Fri, 28 May 2021 16:27:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B6=85=E7=BA=A7=E7=AD=BE?= =?UTF-8?q?=E5=90=8D=E4=BD=BF=E7=94=A8=E4=BB=BB=E5=8A=A1=E9=98=9F=E5=88=97?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_client/src/components/FirDownload.vue | 212 ++++++++++++-------- fir_client/src/components/ShortDownload.vue | 190 +++++++++++------- fir_client/src/restful/download.js | 11 + fir_client/src/restful/index.js | 15 ++ fir_ser/api/base_views.py | 11 +- fir_ser/api/tasks.py | 43 ++++ fir_ser/api/urls.py | 3 +- fir_ser/api/utils/app/supersignutils.py | 59 ++++-- fir_ser/api/utils/pay/__init__.py | 5 + fir_ser/api/utils/storage/caches.py | 34 +++- fir_ser/api/utils/utils.py | 2 +- fir_ser/api/views/apps.py | 48 +---- fir_ser/api/views/download.py | 22 +- fir_ser/api/views/receiveudids.py | 76 ++++--- fir_ser/api/views/uploads.py | 8 +- fir_ser/fir_ser/__init__.py | 3 + fir_ser/fir_ser/celery.py | 43 ++++ fir_ser/fir_ser/settings.py | 41 +++- 18 files changed, 545 insertions(+), 281 deletions(-) create mode 100644 fir_ser/api/tasks.py create mode 100644 fir_ser/api/utils/pay/__init__.py create mode 100644 fir_ser/fir_ser/celery.py diff --git a/fir_client/src/components/FirDownload.vue b/fir_client/src/components/FirDownload.vue index 6333084..769803d 100644 --- a/fir_client/src/components/FirDownload.vue +++ b/fir_client/src/components/FirDownload.vue @@ -70,8 +70,8 @@ -
-
+
+
-
+
import QRCode from 'qrcodejs2' - import {getdownloadurl, getShortAppinfo} from '@/restful' + import {getdownloadurl, getShortAppinfo, gettask} from '@/restful' export default { name: "FirDownload", @@ -301,6 +301,46 @@ clearTimeout(this.timer); }, methods: { + show_err_msg(msg) { + this.msg = msg; + this.$message({ + message: msg, + type: 'error', + duration: 0 + }); + }, + loop_check_task() { + let c_count = 1; + // eslint-disable-next-line no-unused-vars + const loop_t = window.setInterval(res => { + gettask(data => { + c_count += 1; + if (c_count > 120) { + window.clearInterval(loop_t); + } + if (data.code === 1000) { + window.clearInterval(loop_t); + if (data.msg) { + this.show_err_msg(data.msg); + } else { + this.$message.success('签名完成,请点击下载安装'); + this.wrong = false; + } + } else { + if (data.code === 1002) { + window.clearInterval(loop_t); + data.msg = '应用不存在' + } + if (data.msg) { + this.msg = data.msg + ' ○ ' + c_count; + } + } + }, { + "short": this.$route.params.short, + data: {"task_id": this.$route.query.task_id} + }) + }, 3000) + }, jiaocheng(act) { let signhelp = this.$refs.signhelp; let bg = this.$refs.signhelp; @@ -316,104 +356,99 @@ gomobileaction() { window.location.href = this.mobileprovision; }, - check_msg(callback) { - if (this.$route.query.msg && this.$route.query.udid) { - this.wrong = true; - this.msg = this.$route.query.msg; - this.$message({ - message: this.msg, - type: 'error', - duration: 0 - }); - } else ( - callback() - ) + check_msg() { + if (this.$route.query.udid) { + if (this.$route.query.task_id) { + this.wrong = true; + this.msg = '签名处理中,请耐心等待'; + this.loop_check_task() + } else if (this.$route.query.msg) { + this.wrong = true; + this.show_err_msg(this.$route.query.msg); + } + } }, - download() { if (this.currentappinfo.app_id) { - // eslint-disable-next-line no-unused-vars - this.check_msg(_ => { - this.isdownload = true; - getdownloadurl(res => { - if (res.code === 1000) { - if (res.data.download_url === "") { - window.location.href = this.full_url.split("?")[0]; - return - } - if (this.currentappinfo.type === 1) { - if (this.currentappinfo.issupersign) { - if (this.$route.query.udid && this.udid === this.$route.query.udid) { - if (this.agent !== '') { - let download_url = res.data.download_url; - this.downloadurl = "itms-services://?action=download-manifest&url=" + encodeURIComponent(download_url); - // eslint-disable-next-line no-unused-vars - this.timmer = setTimeout(data => { - this.gomobile = false; - }, 5000); - } - } else { - if (this.agent !== '') { - this.downloadurl = res.data.download_url; - window.location.href = this.downloadurl; - if (res.data.extra_url !== "") { - // eslint-disable-next-line no-unused-vars - this.timmer = setTimeout(data => { - window.location.href = res.data.extra_url; - }, 3000); - } - - return; - } - } - } else { - let download_url = res.data.download_url; - this.downloadurl = "itms-services://?action=download-manifest&url=" + encodeURIComponent(download_url); - if (res.data.extra_url !== "") { - this.mobileprovision = res.data.extra_url; + this.isdownload = true; + getdownloadurl(res => { + if (res.code === 1000) { + if (res.data.download_url === "") { + window.location.href = this.full_url.split("?")[0]; + return + } + if (this.currentappinfo.type === 1) { + if (this.currentappinfo.issupersign) { + if (this.$route.query.udid && this.udid === this.$route.query.udid) { + if (this.agent !== '') { + let download_url = res.data.download_url; + this.downloadurl = "itms-services://?action=download-manifest&url=" + encodeURIComponent(download_url); // eslint-disable-next-line no-unused-vars this.timmer = setTimeout(data => { this.gomobile = false; }, 5000); } + } else { + if (this.agent !== '') { + this.downloadurl = res.data.download_url; + window.location.href = this.downloadurl; + if (res.data.extra_url !== "") { + // eslint-disable-next-line no-unused-vars + this.timmer = setTimeout(data => { + window.location.href = res.data.extra_url; + }, 3000); + } + + return; + } } } else { - if (this.agent !== '') { - this.downloadurl = res.data.download_url; + let download_url = res.data.download_url; + this.downloadurl = "itms-services://?action=download-manifest&url=" + encodeURIComponent(download_url); + if (res.data.extra_url !== "") { + this.mobileprovision = res.data.extra_url; + // eslint-disable-next-line no-unused-vars + this.timmer = setTimeout(data => { + this.gomobile = false; + }, 5000); } } - - window.location.href = this.downloadurl; - } else if (res.code === 1009) { - this.isdownload = false; - document.title = res.msg; - this.wrong = true; - this.msg = res.msg; - this.$message({ - message: res.msg, - type: 'error', - }); } else { - this.isdownload = false; - this.$message({ - message: "密码错误,或者下载链接失效", - type: 'error', - }); - if (!this.password) { - window.location.reload(); + if (this.agent !== '') { + this.downloadurl = res.data.download_url; } - this.password = ''; } - }, { - 'data': { - 'token': this.mcurrentappinfo.download_token, - 'short': this.currentappinfo.short, - 'release_id': this.mcurrentappinfo.release_id, - 'password': this.password, - 'udid': this.udid, - }, - 'app_id': this.currentappinfo.app_id - }) + + window.location.href = this.downloadurl; + } else if (res.code === 1009) { + this.isdownload = false; + document.title = res.msg; + this.wrong = true; + this.msg = res.msg; + this.$message({ + message: res.msg, + type: 'error', + }); + } else { + this.isdownload = false; + this.$message({ + message: "密码错误,或者下载链接失效", + type: 'error', + }); + if (!this.password) { + window.location.reload(); + } + this.password = ''; + } + }, { + 'data': { + 'token': this.mcurrentappinfo.download_token, + 'short': this.currentappinfo.short, + 'release_id': this.mcurrentappinfo.release_id, + 'password': this.password, + 'udid': this.udid, + }, + 'app_id': this.currentappinfo.app_id }) } }, @@ -626,6 +661,9 @@ this.getDownloadTokenFun(); this.full_url = location.href; this.qrcode(); + if (this.agent !== '') { + this.check_msg(); + } }, filters: { formatName: function (name) { if (name) { diff --git a/fir_client/src/components/ShortDownload.vue b/fir_client/src/components/ShortDownload.vue index daa2775..dc151e1 100644 --- a/fir_client/src/components/ShortDownload.vue +++ b/fir_client/src/components/ShortDownload.vue @@ -91,8 +91,8 @@ -
-
+
+
-
+
-
+
@@ -247,7 +247,7 @@