فهرست منبع

Merge remote-tracking branch 'origin/master'

locky 2 سال پیش
والد
کامیت
7bbd68d720
4فایلهای تغییر یافته به همراه24 افزوده شده و 15 حذف شده
  1. 3 0
      Controller/DetectControllerV2.py
  2. 3 4
      Service/DevicePushService.py
  3. 1 1
      Service/EquipmentInfoService.py
  4. 17 10
      Service/PushService.py

+ 3 - 0
Controller/DetectControllerV2.py

@@ -108,6 +108,8 @@ class NotificationV2View(View):
                     # 缓存APP提醒推送间隔 默认1分钟提醒一次
                     DevicePushService.cache_push_detect_interval(redisObj, push_interval, detect_interval,
                                                                  uid_set_push_list[0]['uid_set__new_detect_interval'])
+            else:
+                cache_app_push = ''
             bucket = ''
             aws_s3_client = ''
             if is_st == 1 or is_st == 3:  # 使用aws s3
@@ -123,6 +125,7 @@ class NotificationV2View(View):
                       'is_sys_msg': is_sys_msg, 'channel': channel, 'event_type': event_type, 'n_time': n_time,
                       'electricity': electricity, 'bucket': bucket, 'aws_s3_client': aws_s3_client,
                       'app_push': cache_app_push, 'storage_location': 2}
+            logger.info('已创建s3对象,推送数据为:{}'.format(params))
             # APP消息推送与获取报警消息数据列表
             result = DevicePushService.save_msg_push(uid_set_push_list, **params)
             # 批量系统消息&报警消息数据存库

+ 3 - 4
Service/DevicePushService.py

@@ -149,10 +149,9 @@ class DevicePushService:
                     else:
                         LOGGING.info('分表存数据start------')
                         params['userID_id'] = userID_id
-                        push_permission = DevicePushService.check_share_permission(userID_id, params['channel'],
-                                                                                   params['uid'])
-                        if push_permission:
-                            new_device_info_list.append(cls.created_device_vo(local_date_time, **params))
+                        # push_permission = DevicePushService.check_share_permission(userID_id,
+                        # params['channel'],params['uid'])
+                        new_device_info_list.append(cls.created_device_vo(local_date_time, **params))
                     userID_ids.append(userID_id)
                 params['appBundleId'] = appBundleId
                 params['token_val'] = token_val

+ 1 - 1
Service/EquipmentInfoService.py

@@ -44,7 +44,7 @@ class EquipmentInfoService:
         elif week == 7:
             equipment_info = EquipmentInfoSunday(**kwargs)
         logger.info(type(equipment_info))
-        logger.info(equipment_info)
+        logger.info('model数据为:'.format(equipment_info))
         return equipment_info
 
     @staticmethod

+ 17 - 10
Service/PushService.py

@@ -303,19 +303,21 @@ class PushObject:
             # 推送 push_mode: 推送模式 (0:正式推送;1:测试推送,默认为0)
             # 推送 event_type: 消息类型 (0:运营类消息,1:系统类消息。默认为 0)
             # 推送 skip_type: 跳转类型(1:打开 APP 首页 2:打开链接 3:自定义 4:打开 app 内指定页面)
+            activity = 'vpushscheme://com.vivo.pushvideo/detail'
             message = PushMessage() \
                 .reg_id(token_val) \
                 .title(msg_title) \
                 .content(msg_text) \
                 .push_mode(0) \
                 .notify_type(3) \
-                .skip_type(1) \
+                .skip_type(4) \
+                .skip_content(activity) \
                 .request_id(m_code) \
                 .classification(1) \
                 .client_custom_map(**push_data) \
                 .message_dict()
             rec = sender_send.send(message)
-            logger.info('vivo推送结果:{}, regId{}, 设备uid:{}, 用户昵称:{}'.format(rec, token_val, uid, nickname))
+            logger.info('vivo推送结果:{}, 设备uid:{}'.format(rec, uid))
             return rec
         except Exception as e:
             logger.info('vivo推送异常:{}'.format(e))
@@ -366,9 +368,9 @@ class PushObject:
             # 发送推送
             push_url = url + 'server/v1/message/notification/unicast'
             extra_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
-                         'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
-                         'uid': uid, 'channel': channel
-                         }
+                          'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
+                          'uid': uid, 'channel': channel
+                          }
             message = {
                 "target_type": 2,
                 "target_value": token_val,
@@ -418,15 +420,20 @@ class PushObject:
             appSecret = MEIZUPUSH_CONFIG[app_bundle_id]['AppSecret']
             url = 'https://server-api-push.meizu.com/garcia/api/server/push/varnished/pushByPushId'
             extra_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
-                         'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
-                         'uid': uid, 'channel': channel
-                         }
+                          'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
+                          'uid': uid, 'channel': channel
+                          }
+            # 转换为json格式
+            extra_data = json.dumps(extra_data)
             if msg_title == '':
                 msg_title = APP_BUNDLE_DICT[app_bundle_id]
             # 拼接发送内容
-            messageJson = '{"clickTypeInfo":{"activity":"","clickType":0,"customAttribute":""},"extra":{},'
+            activity = "com.ansjer.zccloud_a.AJ_MainView.AJ_Home.AJMainActivity"  # 应用页面地址
+            # clickType点击动作, 0打开应用, 1打开应用页面, 2打开url页面, 3应用客户端自定义
+            messageJson = '{"clickTypeInfo": {"activity": "%s",' \
+                          '"clickType": 1, "parameters": %s },"extra": {},' % (activity, extra_data)
             noticeBarInfo = ('"noticeBarInfo": {"title": "%s", "content":  "%s"},' % (msg_title, msg_text))
-            noticeExpandInfo = '"noticeExpandInfo":{"noticeExpandType":0},"pushTimeInfo":{"validTime":24}}'
+            noticeExpandInfo = '"noticeExpandInfo": {"noticeExpandType": 0}, "pushTimeInfo": {"validTime": 24}}'
             messageJson += noticeBarInfo
             messageJson += noticeExpandInfo
             data_meizu = {