diff --git a/fir_client/src/components/FirDownload.vue b/fir_client/src/components/FirDownload.vue index 43214bc..9da040d 100644 --- a/fir_client/src/components/FirDownload.vue +++ b/fir_client/src/components/FirDownload.vue @@ -13,8 +13,8 @@
- - + +
@@ -265,7 +265,7 @@ return } - if (this.agent === "android") { + if (this.agent === "android" || this.agent === "wxandroid") { // 请求的数据iOS if (data.data.type === 1) { if (data.data.has_combo) { @@ -288,7 +288,7 @@ } else { this.dchoice = true; } - } else if (this.agent === "apple") { + } else if (this.agent === "apple" || this.agent === "wxapple") { if (data.data.type === 0) { if (data.data.has_combo) { if (!params.release_id) { @@ -341,6 +341,8 @@ }, params) }, getAgent() { + const ua = navigator.userAgent.toLowerCase(); + const browser = { versions: function () { const u = navigator.userAgent; @@ -361,14 +363,15 @@ }; if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {//苹果版 - - //is_weixn();//苹果微信不自动跳转浏览器 - // alert('苹果'); - this.agent = 'apple'; + if (ua.match(/MicroMessenger/i) == "micromessenger") { + this.agent = 'wxapple'; + //微信 + } else { + this.agent = 'apple'; + } } if (browser.versions.android) {//安卓 - var ua = navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == "micromessenger") { // alert('安卓微信'); this.agent = 'wxandroid'; diff --git a/fir_download/src/components/FirDownload.vue b/fir_download/src/components/FirDownload.vue index 1c3951f..1d1a41f 100644 --- a/fir_download/src/components/FirDownload.vue +++ b/fir_download/src/components/FirDownload.vue @@ -11,8 +11,8 @@
- - + +
@@ -251,7 +251,7 @@ return false } - if(this.agent === "android"){ + if(this.agent === "android" || this.agent === "wxandroid"){ // 请求的数据iOS if(data.data.type === 1){ if(data.data.has_combo){ @@ -274,7 +274,7 @@ }else { this.dchoice=true; } - }else if(this.agent === "apple"){ + }else if(this.agent === "apple"|| this.agent === "wxapple"){ if(data.data.type === 0){ if(data.data.has_combo){ if(!params.release_id){ @@ -325,6 +325,7 @@ }, params) }, getAgent() { + const ua = navigator.userAgent.toLowerCase(); const browser = { versions: function () { const u = navigator.userAgent; @@ -345,14 +346,15 @@ }; if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {//苹果版 - - //is_weixn();//苹果微信不自动跳转浏览器 - // alert('苹果'); - this.agent = 'apple'; + if (ua.match(/MicroMessenger/i) == "micromessenger") { + this.agent = 'wxapple'; + //微信 + } else { + this.agent = 'apple'; + } } if (browser.versions.android) {//安卓 - var ua = navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == "micromessenger") { // alert('安卓微信'); this.agent = 'wxandroid'; diff --git a/fir_ser/api/utils/storage/localApi.py b/fir_ser/api/utils/storage/localApi.py index 2c3211b..2236600 100644 --- a/fir_ser/api/utils/storage/localApi.py +++ b/fir_ser/api/utils/storage/localApi.py @@ -26,8 +26,11 @@ class LocalStorage(object): uri = 'http://' if self.is_https: uri = 'https://' - download_url = "%s%s?%s=%s" % ( - uri, base_url, settings.DATA_DOWNLOAD_KEY, dtoken.make_token(name, expires, force_new=force_new)) + if settings.DATA_DOWNLOAD_KEY_OPEN: + download_url = "%s%s?%s=%s" % ( + uri, base_url, settings.DATA_DOWNLOAD_KEY, dtoken.make_token(name, expires, force_new=force_new)) + else: + download_url = "%s%s" % (uri, base_url) return download_url def del_file(self, name): diff --git a/fir_ser/api/views/download.py b/fir_ser/api/views/download.py index 683d2a6..5676082 100644 --- a/fir_ser/api/views/download.py +++ b/fir_ser/api/views/download.py @@ -33,13 +33,17 @@ class DownloadView(APIView): res = BaseResponse() downtoken = request.query_params.get(settings.DATA_DOWNLOAD_KEY, None) ftype = filename.split(".")[-1] - if not downtoken: - res.code = 1004 - res.msg = "缺失token" - return Response(res.dict) + flag=True + if settings.DATA_DOWNLOAD_KEY_OPEN: + if not downtoken: + res.code = 1004 + res.msg = "缺失token" + return Response(res.dict) - dtoken = DownloadToken() - if dtoken.verify_token(downtoken, filename): + dtoken = DownloadToken() + flag=dtoken.verify_token(downtoken, filename) + + if flag: if ftype == 'plist': release_id = filename.split('.')[0] apptodev_obj = APPToDeveloper.objects.filter(binary_file=release_id).first() diff --git a/fir_ser/fir_ser/settings.py b/fir_ser/fir_ser/settings.py index b3f2830..33cbc72 100644 --- a/fir_ser/fir_ser/settings.py +++ b/fir_ser/fir_ser/settings.py @@ -88,7 +88,8 @@ DATABASES = { 'HOST': '127.0.0.1', 'PORT': '3306', # 设置MySQL的驱动 - 'OPTIONS': {'init_command': 'SET storage_engine=INNODB'} + # 'OPTIONS': {'init_command': 'SET storage_engine=INNODB'}, + 'OPTIONS': {'init_command': 'SET sql_mode="STRICT_TRANS_TABLES"','charset': 'utf8mb4'} } } @@ -199,13 +200,13 @@ THIRD_PART_CONFIG = { 'name': 'aliyun', 'type': 2, 'auth': { - 'access_key': 'LTAI4FkbTRqejBAzB1yQZpjR', - 'secret_key': '2WzCsKjYXxOvU4wPtTmrrXnxiLIxy9', - 'bucket_name': 'fly-app-storage', - 'sts_role_arn': 'acs:ram::1886562303345632:role/fly-app-storage', + 'access_key': 'LTAI4FkbTR', + 'secret_key': '2iLIxy9', + 'bucket_name': 'fge', + 'sts_role_arn': 'ap-sage', 'endpoint': 'oss-cn-beijing.aliyuncs.com', 'is_https': True, - 'domain_name': 'ali.storage.dvcloud.xin' + 'domain_name': 'aoud.xin' }, 'active': False }, @@ -213,11 +214,11 @@ THIRD_PART_CONFIG = { 'name': 'qiniuyun', 'type': 1, 'auth': { - 'access_key': 'mTqfvkLVSTVb2_1ERjDlFS_WAHLSkpDxYr4e4fiJ', - 'secret_key': '0G9fXfgmi8h1-bmEsABYkE6apf8IuwKpj3hYLynv', - 'bucket_name': 'fir-storage', + 'access_key': 'mT4fiJ', + 'secret_key': '0G9fXfhYLynv', + 'bucket_name': 'fge', 'is_https': False, - 'domain_name': 'fly-cdn.dvcloud.xin' + 'domain_name': 'foud.xin' }, 'active': False } @@ -237,6 +238,7 @@ CACHE_KEY_TEMPLATE = { } DATA_DOWNLOAD_KEY="d_token" +DATA_DOWNLOAD_KEY_OPEN=True #是否开启图片和应用下载token,只本地存储支持该操作 SYNC_CACHE_TO_DATABASE = { 'download_times': 10 # 下载次数同步时间 diff --git a/fir_ser/uwsgi.conf b/fir_ser/uwsgi.conf index 46a7673..d6d3849 100644 --- a/fir_ser/uwsgi.conf +++ b/fir_ser/uwsgi.conf @@ -6,7 +6,7 @@ socket = 127.0.0.1:8899 # the base directory (full path) django 程序的主目录 -chdir = /www/fir_ser +chdir = ./ # Django's wsgi file wsgi-file = fir_ser/wsgi.py @@ -23,6 +23,8 @@ threads = 4 #monitor uwsgi status 通过该端口可以监控 uwsgi 的负载情况 stats = 127.0.0.1:9191 +uid=nginx +gid=nginx # clear environment on exit vacuum = true @@ -30,4 +32,4 @@ vacuum = true enable-threads = true # 后台运行,并输出日志 -daemonize = /var/log/uwsgi.log +daemonize = ./flyapp.log