|
@@ -116,6 +116,18 @@ class NotificationView(View):
|
|
|
auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
|
bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'apg')
|
|
|
|
|
|
+ # 对象存储区域
|
|
|
+ # region: 国外(1), 国内(2)
|
|
|
+ # 测试/国内: 阿里云(1), 美洲: oci凤凰城(3), 欧洲: oci伦敦(4)
|
|
|
+ region = 1
|
|
|
+ if CONFIG_INFO == CONFIG_US or CONFIG_INFO == CONFIG_TEST:
|
|
|
+ storage_location = 3
|
|
|
+ elif CONFIG_INFO == CONFIG_EUR:
|
|
|
+ storage_location = 4
|
|
|
+ else:
|
|
|
+ region = 2
|
|
|
+ storage_location = 1
|
|
|
+
|
|
|
# 推送相关参数
|
|
|
push_kwargs = {
|
|
|
'uid': uid,
|
|
@@ -123,11 +135,13 @@ class NotificationView(View):
|
|
|
'event_type': event_type,
|
|
|
'n_time': n_time,
|
|
|
}
|
|
|
- params = {'nickname': nickname, 'uid': uid, 'push_kwargs': push_kwargs, 'is_st': is_st,
|
|
|
- 'is_sys_msg': is_sys_msg, 'channel': channel, 'event_type': event_type, 'n_time': n_time,
|
|
|
- 'electricity': '', 'bucket': bucket, 'app_push': have_dkey, 'storage_location': 1, 'ai_type': 0,
|
|
|
- 'dealings_type': 0, 'detection': 0, 'device_type': 1, 'app_push_config': '',
|
|
|
- 'uid_set_push_list': uid_push_list, 'redis_obj': redis_obj}
|
|
|
+ params = {
|
|
|
+ 'nickname': nickname, 'uid': uid, 'push_kwargs': push_kwargs, 'is_st': is_st, 'is_sys_msg': is_sys_msg,
|
|
|
+ 'channel': channel, 'event_type': event_type, 'n_time': n_time, 'electricity': '', 'bucket': bucket,
|
|
|
+ 'app_push': have_dkey, 'storage_location': storage_location, 'ai_type': 0, 'dealings_type': 0,
|
|
|
+ 'detection': 0, 'device_type': 1, 'app_push_config': '', 'uid_set_push_list': uid_push_list,
|
|
|
+ 'redis_obj': redis_obj
|
|
|
+ }
|
|
|
|
|
|
# 异步推送消息和保存数据
|
|
|
push_thread = threading.Thread(
|
|
@@ -135,21 +149,6 @@ class NotificationView(View):
|
|
|
kwargs=params)
|
|
|
push_thread.start()
|
|
|
|
|
|
- # 对象存储区域
|
|
|
- # region: 国外(1), 国内(2)
|
|
|
- # 测试/国内: 阿里云(1), 美洲: oci凤凰城(3), 欧洲: oci伦敦(4)
|
|
|
- region = 1
|
|
|
- if CONFIG_INFO == CONFIG_US:
|
|
|
- storage_location = 3
|
|
|
- elif CONFIG_INFO == CONFIG_EUR:
|
|
|
- storage_location = 4
|
|
|
- else:
|
|
|
- region = 2
|
|
|
- storage_location = 1
|
|
|
- # 测试
|
|
|
- if CONFIG_INFO == CONFIG_TEST:
|
|
|
- storage_location = 3
|
|
|
-
|
|
|
# 获取图片上传链接
|
|
|
kwargs = {
|
|
|
'is_st': is_st,
|