|
@@ -11,8 +11,8 @@ from Object.TokenObject import TokenObject
|
|
|
from Service.CommonService import CommonService
|
|
|
from Service.ModelService import ModelService
|
|
|
from django.conf import settings
|
|
|
-OSS_STS_ACCESS_KEY = settings.OSS_STS_ACCESS_KEY
|
|
|
-OSS_STS_ACCESS_SECRET = settings.OSS_STS_ACCESS_SECRET
|
|
|
+ALICLOUD_AK = settings.ALICLOUD_AK
|
|
|
+ALICLOUD_SK = settings.ALICLOUD_SK
|
|
|
|
|
|
|
|
|
class VoicePromptView(View):
|
|
@@ -75,7 +75,7 @@ class VoicePromptView(View):
|
|
|
if count >= 3:
|
|
|
return response.json(201)
|
|
|
|
|
|
- auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
|
+ auth = oss2.Auth(ALICLOUD_AK, ALICLOUD_SK)
|
|
|
bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'ansjer-static-resources')
|
|
|
name = CommonService.createOrderID()
|
|
|
filename = str(name) + '.' + upload_type
|
|
@@ -115,7 +115,7 @@ class VoicePromptView(View):
|
|
|
'title': title,
|
|
|
'type': type,
|
|
|
}
|
|
|
- auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
|
+ auth = oss2.Auth(ALICLOUD_AK, ALICLOUD_SK)
|
|
|
bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'ansjer-static-resources')
|
|
|
filename = res['filename']
|
|
|
obj = 'voice_prompt/{uid}/{channel}/'.format(uid=uid, channel=channel) + filename
|
|
@@ -163,7 +163,7 @@ class VoicePromptView(View):
|
|
|
channel = voice.channel
|
|
|
filename = voice.filename
|
|
|
voice_qs.delete()
|
|
|
- auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
|
+ auth = oss2.Auth(ALICLOUD_AK, ALICLOUD_SK)
|
|
|
bucket = oss2.Bucket(auth, 'http://oss-cn-shenzhen.aliyuncs.com', 'ansjer-static-resources')
|
|
|
obj = 'voice_prompt/{uid}/{channel}/'.format(uid=uid, channel=channel) + filename
|
|
|
bucket.delete_object(obj)
|
|
@@ -234,7 +234,7 @@ class VoicePromptView(View):
|
|
|
|
|
|
res['system'] = {}
|
|
|
res['custom'] = {}
|
|
|
- auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
|
+ auth = oss2.Auth(ALICLOUD_AK, ALICLOUD_SK)
|
|
|
bucket = oss2.Bucket(auth, 'https://oss-cn-shenzhen.aliyuncs.com', 'ansjer-static-resources')
|
|
|
if system_qs.exists():
|
|
|
system_qs = system_qs.values('id', 'title', 'filename', 'type')
|
|
@@ -290,7 +290,7 @@ class VoicePromptView(View):
|
|
|
upload_type = request_dict.get('upload_type', None)
|
|
|
|
|
|
if upload_type:
|
|
|
- auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
|
+ auth = oss2.Auth(ALICLOUD_AK, ALICLOUD_SK)
|
|
|
bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'ansjer-static-resources')
|
|
|
name = CommonService.createOrderID()
|
|
|
filename = str(name) + '.' + upload_type
|
|
@@ -355,7 +355,7 @@ class VoicePromptView(View):
|
|
|
|
|
|
voice_qs = voice_qs.values('id', 'title', 'type', 'language', 'status', 'filename')[start:end]
|
|
|
|
|
|
- auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
|
+ auth = oss2.Auth(ALICLOUD_AK, ALICLOUD_SK)
|
|
|
bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'ansjer-static-resources')
|
|
|
|
|
|
for item in voice_qs:
|