super_signature
nineven 5 years ago
parent f588a860df
commit 0c61cd4398
  1. 19
      fir_client/src/components/FirDownload.vue
  2. 18
      fir_download/src/components/FirDownload.vue
  3. 3
      fir_ser/api/utils/storage/localApi.py
  4. 6
      fir_ser/api/views/download.py
  5. 22
      fir_ser/fir_ser/settings.py
  6. 6
      fir_ser/uwsgi.conf

@ -13,8 +13,8 @@
</div> </div>
<div v-else> <div v-else>
<span class="pattern left"><img src="../assets/download_pattern_left.png"></span> <!-- <span class="pattern left"><img src="../assets/download_pattern_left.png"></span>-->
<span class="pattern right"><img src="../assets/download_pattern_right.png"></span> <!-- <span class="pattern right"><img src="../assets/download_pattern_right.png"></span>-->
</div> </div>
<el-container class="out-container"> <el-container class="out-container">
@ -265,7 +265,7 @@
return return
} }
if (this.agent === "android") { if (this.agent === "android" || this.agent === "wxandroid") {
// iOS // iOS
if (data.data.type === 1) { if (data.data.type === 1) {
if (data.data.has_combo) { if (data.data.has_combo) {
@ -288,7 +288,7 @@
} else { } else {
this.dchoice = true; this.dchoice = true;
} }
} else if (this.agent === "apple") { } else if (this.agent === "apple" || this.agent === "wxapple") {
if (data.data.type === 0) { if (data.data.type === 0) {
if (data.data.has_combo) { if (data.data.has_combo) {
if (!params.release_id) { if (!params.release_id) {
@ -341,6 +341,8 @@
}, params) }, params)
}, },
getAgent() { getAgent() {
const ua = navigator.userAgent.toLowerCase();
const browser = { const browser = {
versions: function () { versions: function () {
const u = navigator.userAgent; const u = navigator.userAgent;
@ -361,14 +363,15 @@
}; };
if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {// if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {//
if (ua.match(/MicroMessenger/i) == "micromessenger") {
//is_weixn();// this.agent = 'wxapple';
// alert(''); //
} else {
this.agent = 'apple'; this.agent = 'apple';
}
} }
if (browser.versions.android) {// if (browser.versions.android) {//
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") { if (ua.match(/MicroMessenger/i) == "micromessenger") {
// alert(''); // alert('');
this.agent = 'wxandroid'; this.agent = 'wxandroid';

@ -11,8 +11,8 @@
</div> </div>
<div v-else> <div v-else>
<span class="pattern left"><img src="../assets/download_pattern_left.png"></span> <!-- <span class="pattern left"><img src="../assets/download_pattern_left.png"></span>-->
<span class="pattern right"><img src="../assets/download_pattern_right.png"></span> <!-- <span class="pattern right"><img src="../assets/download_pattern_right.png"></span>-->
</div> </div>
<div class="out-container container"> <div class="out-container container">
@ -251,7 +251,7 @@
return false return false
} }
if(this.agent === "android"){ if(this.agent === "android" || this.agent === "wxandroid"){
// iOS // iOS
if(data.data.type === 1){ if(data.data.type === 1){
if(data.data.has_combo){ if(data.data.has_combo){
@ -274,7 +274,7 @@
}else { }else {
this.dchoice=true; this.dchoice=true;
} }
}else if(this.agent === "apple"){ }else if(this.agent === "apple"|| this.agent === "wxapple"){
if(data.data.type === 0){ if(data.data.type === 0){
if(data.data.has_combo){ if(data.data.has_combo){
if(!params.release_id){ if(!params.release_id){
@ -325,6 +325,7 @@
}, params) }, params)
}, },
getAgent() { getAgent() {
const ua = navigator.userAgent.toLowerCase();
const browser = { const browser = {
versions: function () { versions: function () {
const u = navigator.userAgent; const u = navigator.userAgent;
@ -345,14 +346,15 @@
}; };
if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {// if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {//
if (ua.match(/MicroMessenger/i) == "micromessenger") {
//is_weixn();// this.agent = 'wxapple';
// alert(''); //
} else {
this.agent = 'apple'; this.agent = 'apple';
}
} }
if (browser.versions.android) {// if (browser.versions.android) {//
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") { if (ua.match(/MicroMessenger/i) == "micromessenger") {
// alert(''); // alert('');
this.agent = 'wxandroid'; this.agent = 'wxandroid';

@ -26,8 +26,11 @@ class LocalStorage(object):
uri = 'http://' uri = 'http://'
if self.is_https: if self.is_https:
uri = 'https://' uri = 'https://'
if settings.DATA_DOWNLOAD_KEY_OPEN:
download_url = "%s%s?%s=%s" % ( download_url = "%s%s?%s=%s" % (
uri, base_url, settings.DATA_DOWNLOAD_KEY, dtoken.make_token(name, expires, force_new=force_new)) 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 return download_url
def del_file(self, name): def del_file(self, name):

@ -33,13 +33,17 @@ class DownloadView(APIView):
res = BaseResponse() res = BaseResponse()
downtoken = request.query_params.get(settings.DATA_DOWNLOAD_KEY, None) downtoken = request.query_params.get(settings.DATA_DOWNLOAD_KEY, None)
ftype = filename.split(".")[-1] ftype = filename.split(".")[-1]
flag=True
if settings.DATA_DOWNLOAD_KEY_OPEN:
if not downtoken: if not downtoken:
res.code = 1004 res.code = 1004
res.msg = "缺失token" res.msg = "缺失token"
return Response(res.dict) return Response(res.dict)
dtoken = DownloadToken() dtoken = DownloadToken()
if dtoken.verify_token(downtoken, filename): flag=dtoken.verify_token(downtoken, filename)
if flag:
if ftype == 'plist': if ftype == 'plist':
release_id = filename.split('.')[0] release_id = filename.split('.')[0]
apptodev_obj = APPToDeveloper.objects.filter(binary_file=release_id).first() apptodev_obj = APPToDeveloper.objects.filter(binary_file=release_id).first()

@ -88,7 +88,8 @@ DATABASES = {
'HOST': '127.0.0.1', 'HOST': '127.0.0.1',
'PORT': '3306', 'PORT': '3306',
# 设置MySQL的驱动 # 设置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', 'name': 'aliyun',
'type': 2, 'type': 2,
'auth': { 'auth': {
'access_key': 'LTAI4FkbTRqejBAzB1yQZpjR', 'access_key': 'LTAI4FkbTR',
'secret_key': '2WzCsKjYXxOvU4wPtTmrrXnxiLIxy9', 'secret_key': '2iLIxy9',
'bucket_name': 'fly-app-storage', 'bucket_name': 'fge',
'sts_role_arn': 'acs:ram::1886562303345632:role/fly-app-storage', 'sts_role_arn': 'ap-sage',
'endpoint': 'oss-cn-beijing.aliyuncs.com', 'endpoint': 'oss-cn-beijing.aliyuncs.com',
'is_https': True, 'is_https': True,
'domain_name': 'ali.storage.dvcloud.xin' 'domain_name': 'aoud.xin'
}, },
'active': False 'active': False
}, },
@ -213,11 +214,11 @@ THIRD_PART_CONFIG = {
'name': 'qiniuyun', 'name': 'qiniuyun',
'type': 1, 'type': 1,
'auth': { 'auth': {
'access_key': 'mTqfvkLVSTVb2_1ERjDlFS_WAHLSkpDxYr4e4fiJ', 'access_key': 'mT4fiJ',
'secret_key': '0G9fXfgmi8h1-bmEsABYkE6apf8IuwKpj3hYLynv', 'secret_key': '0G9fXfhYLynv',
'bucket_name': 'fir-storage', 'bucket_name': 'fge',
'is_https': False, 'is_https': False,
'domain_name': 'fly-cdn.dvcloud.xin' 'domain_name': 'foud.xin'
}, },
'active': False 'active': False
} }
@ -237,6 +238,7 @@ CACHE_KEY_TEMPLATE = {
} }
DATA_DOWNLOAD_KEY="d_token" DATA_DOWNLOAD_KEY="d_token"
DATA_DOWNLOAD_KEY_OPEN=True #是否开启图片和应用下载token,只本地存储支持该操作
SYNC_CACHE_TO_DATABASE = { SYNC_CACHE_TO_DATABASE = {
'download_times': 10 # 下载次数同步时间 'download_times': 10 # 下载次数同步时间

@ -6,7 +6,7 @@
socket = 127.0.0.1:8899 socket = 127.0.0.1:8899
# the base directory (full path) django 程序的主目录 # the base directory (full path) django 程序的主目录
chdir = /www/fir_ser chdir = ./
# Django's wsgi file # Django's wsgi file
wsgi-file = fir_ser/wsgi.py wsgi-file = fir_ser/wsgi.py
@ -23,6 +23,8 @@ threads = 4
#monitor uwsgi status 通过该端口可以监控 uwsgi 的负载情况 #monitor uwsgi status 通过该端口可以监控 uwsgi 的负载情况
stats = 127.0.0.1:9191 stats = 127.0.0.1:9191
uid=nginx
gid=nginx
# clear environment on exit # clear environment on exit
vacuum = true vacuum = true
@ -30,4 +32,4 @@ vacuum = true
enable-threads = true enable-threads = true
# 后台运行,并输出日志 # 后台运行,并输出日志
daemonize = /var/log/uwsgi.log daemonize = ./flyapp.log

Loading…
Cancel
Save