|
@@ -146,13 +146,14 @@ class DevicePushService:
|
|
|
"""
|
|
|
sys_msg_list = []
|
|
|
saved_user_id_list = []
|
|
|
+ uid = params['uid']
|
|
|
push_kwargs = params['push_kwargs']
|
|
|
now_time = int(time.time())
|
|
|
try:
|
|
|
params['event_tag'] = cls.get_event_tag(params['ai_type'], params['event_type'], params['detection'])
|
|
|
is_app_push = True if params['event_type'] in [606, 607] else \
|
|
|
- cls.is_send_app_push(params['event_type'], params['event_tag'], params['app_push_config'],
|
|
|
- params['app_push'], params['uid'])
|
|
|
+ cls.is_send_app_push(
|
|
|
+ params['event_type'], params['event_tag'], params['app_push_config'], params['app_push'], uid)
|
|
|
|
|
|
for up in params['uid_set_push_list']:
|
|
|
lang = up['lang']
|
|
@@ -168,15 +169,14 @@ class DevicePushService:
|
|
|
sys_msg_text = cls.get_msg_text(channel=params['channel'], n_time=params['n_time'], lang=lang,
|
|
|
tz=tz, is_sys=1, device_type=params['device_type'],
|
|
|
event_type=params['event_type'],
|
|
|
- electricity=params['electricity'],
|
|
|
- )
|
|
|
+ electricity=params['electricity'])
|
|
|
sys_msg_list.append(SysMsgModel(userID_id=user_id, msg=sys_msg_text, addTime=now_time,
|
|
|
- updTime=now_time, uid=params['uid'],
|
|
|
- eventType=params['event_type']))
|
|
|
- # 推送消息
|
|
|
+ updTime=now_time, uid=uid, eventType=params['event_type']))
|
|
|
+ # 保存推送消息
|
|
|
else:
|
|
|
params['userID_id'] = user_id
|
|
|
cls.save_equipment_info(**params)
|
|
|
+
|
|
|
saved_user_id_list.append(user_id)
|
|
|
|
|
|
# 推送
|
|
@@ -210,7 +210,8 @@ class DevicePushService:
|
|
|
params['lang'] = lang
|
|
|
params['tz'] = tz
|
|
|
|
|
|
- cls.send_app_msg_push(push_type, **params)
|
|
|
+ push_result = cls.send_app_msg_push(push_type, **params)
|
|
|
+ LOGGING.info('{}推送类型:{},推送结果:{}'.format(uid, push_type, push_result))
|
|
|
|
|
|
# 写入系统消息
|
|
|
if sys_msg_list:
|
|
@@ -287,8 +288,6 @@ class DevicePushService:
|
|
|
push_kwargs = param['push_kwargs']
|
|
|
push_result = False
|
|
|
|
|
|
- LOGGING.info('{}开始推送'.format(param['uid']))
|
|
|
-
|
|
|
# is_st为1或3,且推送类型为apns,gcm,华为,异步推送图片
|
|
|
if (param['is_st'] == 1 or param['is_st'] == 3) and \
|
|
|
(push_type == 0 or push_type == 1 or push_type == 3):
|
|
@@ -636,17 +635,20 @@ class DevicePushService:
|
|
|
try:
|
|
|
image_url = aws_s3_client.generate_presigned_url(
|
|
|
'get_object', Params={'Bucket': bucket, 'Key': key}, ExpiresIn=3600)
|
|
|
+ push_result = False
|
|
|
if push_type == 0:
|
|
|
- PushObject.ios_apns_push(
|
|
|
+ push_result = PushObject.ios_apns_push(
|
|
|
uid, appBundleId, token_val, n_time, event_type, msg_title, msg_text, uid, channel, image_url)
|
|
|
elif push_type == 1:
|
|
|
- PushObject.android_fcm_push(
|
|
|
+ push_result = PushObject.android_fcm_push(
|
|
|
uid, appBundleId, token_val, n_time, event_type, msg_title, msg_text, uid, channel, image_url)
|
|
|
elif push_type == 3:
|
|
|
huawei_push_object = HuaweiPushObject()
|
|
|
- huawei_push_object.send_push_notify_message(
|
|
|
+ push_result = huawei_push_object.send_push_notify_message(
|
|
|
token_val=token_val, msg_title=msg_title, msg_text=msg_text, uid=uid, event_type=event_type,
|
|
|
n_time=n_time, image_url=image_url)
|
|
|
+
|
|
|
+ LOGGING.info('{}推送图片,push_type:{},推送结果:{}'.format(uid, push_type, push_result))
|
|
|
except Exception as e:
|
|
|
LOGGING.info('异步推送图片异常,error_line:{},error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
|