Browse Source

Merge branch 'dev' into lang

lang 4 years ago
parent
commit
04018ec515
2 changed files with 8 additions and 3 deletions
  1. 5 0
      Controller/DeviceTypeController.py
  2. 3 3
      Controller/VoicePromptController.py

+ 5 - 0
Controller/DeviceTypeController.py

@@ -1,5 +1,7 @@
 #!/usr/bin/env python3
 # -*- coding: utf-8 -*-
+import time
+
 import oss2
 from django.views import View
 
@@ -54,12 +56,15 @@ class DeviceTypeView(View):
         icon = request_dict.get('icon', None)
 
         if name and model and type and ptz_type and icon:
+            now_time = int(time.time())
             device_type = DeviceTypeModel()
             device_type.name = name
             device_type.model = model
             device_type.type = type
             device_type.ptz_type = ptz_type
             device_type.icon = icon
+            device_type.add_time = now_time
+            device_type.update_time = now_time
             device_type.save()
             return response.json(0)
         else:

+ 3 - 3
Controller/VoicePromptController.py

@@ -60,7 +60,7 @@ class VoicePromptView(View):
                 return response.json(201)
 
             auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
-            bucket = oss2.Bucket(auth, 'oss-cn-hongkong.aliyuncs.com', 'statres')
+            bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'ansjer-static-resources')
             name = CommonService.createOrderID()
             filename = str(name) + '.' + upload_type
             obj = 'voice_prompt/{uid}/{channel}/'.format(uid=uid, channel=channel) + filename
@@ -103,7 +103,7 @@ class VoicePromptView(View):
                 if device_qs.exists():
                     voice_qs.delete()
                     auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
-                    bucket = oss2.Bucket(auth, 'oss-cn-hongkong.aliyuncs.com', 'statres')
+                    bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'ansjer-static-resources')
                     obj = 'voice_prompt/{uid}/{channel}/'.format(uid=uid, channel=voice_qs[0].channel) + voice_qs[0].filename
                     bucket.delete_object(obj)
                     return response.json(0)
@@ -152,7 +152,7 @@ class VoicePromptView(View):
             res['system'] = {}
             res['custom'] = {}
             auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
-            bucket = oss2.Bucket(auth, 'oss-cn-hongkong.aliyuncs.com', 'statres')
+            bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'ansjer-static-resources')
             if system_qs.exists():
                 system_qs = system_qs.values('id', 'title', 'filename', 'type')
                 for system in system_qs: