|
@@ -192,10 +192,11 @@ class DevicePushService:
|
|
|
params['token_val'] = token_val
|
|
|
params['lang'] = lang
|
|
|
params['tz'] = tz
|
|
|
+ params['push_type'] = push_type
|
|
|
|
|
|
push_thread = threading.Thread(
|
|
|
target=cls.send_app_msg_push,
|
|
|
- args=(push_type, params)
|
|
|
+ kwargs=params
|
|
|
)
|
|
|
push_thread.start()
|
|
|
|
|
@@ -353,28 +354,29 @@ class DevicePushService:
|
|
|
return result
|
|
|
|
|
|
@classmethod
|
|
|
- def send_app_msg_push(cls, push_type, **param):
|
|
|
+ def send_app_msg_push(cls, **kwargs):
|
|
|
"""
|
|
|
发送推送
|
|
|
- @param push_type: 推送类型
|
|
|
+ @kwargs :
|
|
|
@return push_result: bool
|
|
|
"""
|
|
|
try:
|
|
|
- push_kwargs = param['push_kwargs']
|
|
|
+ push_type = kwargs['push_type']
|
|
|
+ push_kwargs = kwargs['push_kwargs']
|
|
|
push_result = False
|
|
|
|
|
|
# is_st为1或3,且推送类型为apns,gcm,华为,异步推送图片
|
|
|
- if (param['is_st'] == 1 or param['is_st'] == 3) and \
|
|
|
+ if (kwargs['is_st'] == 1 or kwargs['is_st'] == 3) and \
|
|
|
(push_type == 0 or push_type == 1 or push_type == 3):
|
|
|
- if param['is_st'] == 1:
|
|
|
- key = '{}/{}/{}.jpeg'.format(param['uid'], param['channel'], param['n_time'])
|
|
|
+ if kwargs['is_st'] == 1:
|
|
|
+ key = '{}/{}/{}.jpeg'.format(kwargs['uid'], kwargs['channel'], kwargs['n_time'])
|
|
|
else:
|
|
|
- key = '{}/{}/{}_0.jpeg'.format(param['uid'], param['channel'], param['n_time'])
|
|
|
+ key = '{}/{}/{}_0.jpeg'.format(kwargs['uid'], kwargs['channel'], kwargs['n_time'])
|
|
|
# 开始异步推送图片
|
|
|
push_thread = threading.Thread(target=cls.async_send_picture_push, args=(
|
|
|
- push_type, param['aws_s3_client'], param['bucket'], key,
|
|
|
- param['uid'], param['appBundleId'], param['token_val'], param['event_type'], param['n_time'],
|
|
|
- push_kwargs['msg_title'], push_kwargs['msg_text'], param['channel']))
|
|
|
+ push_type, kwargs['aws_s3_client'], kwargs['bucket'], key,
|
|
|
+ kwargs['uid'], kwargs['appBundleId'], kwargs['token_val'], kwargs['event_type'], kwargs['n_time'],
|
|
|
+ push_kwargs['msg_title'], push_kwargs['msg_text'], kwargs['channel']))
|
|
|
push_thread.start()
|
|
|
push_result = True
|
|
|
|
|
@@ -382,15 +384,15 @@ class DevicePushService:
|
|
|
else:
|
|
|
if push_type in [0, 1, 2]:
|
|
|
kwargs = {
|
|
|
- 'nickname': param['uid'],
|
|
|
- 'app_bundle_id': param['appBundleId'],
|
|
|
- 'token_val': param['token_val'],
|
|
|
- 'n_time': param['n_time'],
|
|
|
- 'event_type': param['event_type'],
|
|
|
+ 'nickname': kwargs['uid'],
|
|
|
+ 'app_bundle_id': kwargs['appBundleId'],
|
|
|
+ 'token_val': kwargs['token_val'],
|
|
|
+ 'n_time': kwargs['n_time'],
|
|
|
+ 'event_type': kwargs['event_type'],
|
|
|
'msg_title': push_kwargs['msg_title'],
|
|
|
'msg_text': push_kwargs['msg_text'],
|
|
|
- 'uid': param['uid'],
|
|
|
- 'channel': param['channel']
|
|
|
+ 'uid': kwargs['uid'],
|
|
|
+ 'channel': kwargs['channel']
|
|
|
}
|
|
|
|
|
|
if push_type == 0: # ios apns
|
|
@@ -405,7 +407,7 @@ class DevicePushService:
|
|
|
huawei_push_object = HuaweiPushObject()
|
|
|
huawei_push_object.send_push_notify_message(**push_kwargs)
|
|
|
elif push_type == 4: # android xmpush
|
|
|
- if param['event_type'] in [606, 607]:
|
|
|
+ if kwargs['event_type'] in [606, 607]:
|
|
|
push_channel = 'push_to_talk'
|
|
|
else:
|
|
|
push_channel = 'device_reminder'
|