Sfoglia il codice sorgente

Merge branch 'test' of http://192.168.136.99:3000/servers/ASJPush into peng

 Conflicts:
	Controller/DetectControllerV2.py
peng 2 anni fa
parent
commit
e7bb9d15f7
2 ha cambiato i file con 212 aggiunte e 215 eliminazioni
  1. 151 152
      Controller/DetectController.py
  2. 61 63
      Controller/DetectControllerV2.py

+ 151 - 152
Controller/DetectController.py

@@ -56,166 +56,165 @@ class NotificationView(View):
         if not all([channel, n_time]):
             return JsonResponse(status=200, data={'code': 444, 'msg': 'error channel or n_time'})
         try:
-            with transaction.atomic():
-                uid = DevicePushService.decode_uid(etk, uidToken)  # 解密uid
-                if len(uid) != 20 and len(uid) != 14:
-                    return JsonResponse(status=200, data={'code': 404, 'msg': 'wrong uid'})
-                logger.info("旧移动侦测接口的uid:{}".format(uid))
-                pkey = '{uid}_{channel}_{event_type}_ptl'.format(uid=uid, event_type=event_type, channel=channel)
-                ykey = '{uid}_redis_qs'.format(uid=uid)
-                is_sys_msg = self.is_sys_msg(int(event_type))
-                if is_sys_msg is True:
-                    dkey = '{uid}_{channel}_{event_type}_flag'.format(uid=uid, event_type=event_type, channel=channel)
-                else:
-                    dkey = '{uid}_{channel}_flag'.format(uid=uid, channel=channel)
-
-                redisObj = RedisObject(db=6)
-                have_ykey = redisObj.get_data(key=ykey)  # uid_set 数据库缓存
-                have_pkey = redisObj.get_data(key=pkey)  # 一分钟限制key
-                have_dkey = redisObj.get_data(key=dkey)  # 推送类型限制
-
-                # 一分钟外,推送开启状态
-                detect_med_type = 0  # 0推送旧机制 1存库不推送,2推送存库
-                # 暂时注销
-                if have_pkey:
-                    res_data = {'code': 0, 'msg': 'Push it once a minute'}
+            uid = DevicePushService.decode_uid(etk, uidToken)  # 解密uid
+            if len(uid) != 20 and len(uid) != 14:
+                return JsonResponse(status=200, data={'code': 404, 'msg': 'wrong uid'})
+            logger.info("旧移动侦测接口的uid:{}".format(uid))
+            pkey = '{uid}_{channel}_{event_type}_ptl'.format(uid=uid, event_type=event_type, channel=channel)
+            ykey = '{uid}_redis_qs'.format(uid=uid)
+            is_sys_msg = self.is_sys_msg(int(event_type))
+            if is_sys_msg is True:
+                dkey = '{uid}_{channel}_{event_type}_flag'.format(uid=uid, event_type=event_type, channel=channel)
+            else:
+                dkey = '{uid}_{channel}_flag'.format(uid=uid, channel=channel)
+
+            redisObj = RedisObject(db=6)
+            have_ykey = redisObj.get_data(key=ykey)  # uid_set 数据库缓存
+            have_pkey = redisObj.get_data(key=pkey)  # 一分钟限制key
+            have_dkey = redisObj.get_data(key=dkey)  # 推送类型限制
+
+            # 一分钟外,推送开启状态
+            detect_med_type = 0  # 0推送旧机制 1存库不推送,2推送存库
+            # 暂时注销
+            if have_pkey:
+                res_data = {'code': 0, 'msg': 'Push it once a minute'}
+                return JsonResponse(status=200, data=res_data)
+
+            # 数据库读取数据
+            if have_ykey:
+                uid_push_list = eval(redisObj.get_data(key=ykey))
+            else:
+                # 从数据库查询出来
+                uid_push_qs = DevicePushService.query_uid_push(uid)
+                if not uid_push_qs.exists():
+                    logger.info('消息推送-uid_push 数据不存在')
+                    return JsonResponse(status=200, data={'code': 176, 'msg': 'no uid_push data'})
+                # 修改redis数据,并设置过期时间为10分钟
+                uid_push_list = DevicePushService.cache_uid_push(uid_push_qs)
+                redisObj.set_data(key=ykey, val=str(uid_push_list), expire=600)
+                if not uid_push_list:
+                    res_data = {'code': 404, 'msg': 'error !'}
                     return JsonResponse(status=200, data=res_data)
 
-                # 数据库读取数据
-                if have_ykey:
-                    uid_push_list = eval(redisObj.get_data(key=ykey))
-                else:
-                    # 从数据库查询出来
-                    uid_push_qs = DevicePushService.query_uid_push(uid)
-                    if not uid_push_qs.exists():
-                        logger.info('消息推送-uid_push 数据不存在')
-                        return JsonResponse(status=200, data={'code': 176, 'msg': 'no uid_push data'})
-                    # 修改redis数据,并设置过期时间为10分钟
-                    uid_push_list = DevicePushService.cache_uid_push(uid_push_qs)
-                    redisObj.set_data(key=ykey, val=str(uid_push_list), expire=600)
-                    if not uid_push_list:
-                        res_data = {'code': 404, 'msg': 'error !'}
-                        return JsonResponse(status=200, data=res_data)
+            if not uid_push_list:
+                res_data = {'code': 0, 'msg': 'uid_push_list not exist'}
+                return JsonResponse(status=200, data=res_data)
 
-                if not uid_push_list:
-                    res_data = {'code': 0, 'msg': 'uid_push_list not exist'}
-                    return JsonResponse(status=200, data=res_data)
+            nickname = uid_push_list[0]['uid_set__nickname']
+            detect_interval = uid_push_list[0]['uid_set__detect_interval']
+            detect_group = uid_push_list[0]['uid_set__detect_group']
+            if not nickname:
+                nickname = uid
 
-                nickname = uid_push_list[0]['uid_set__nickname']
-                detect_interval = uid_push_list[0]['uid_set__detect_interval']
-                detect_group = uid_push_list[0]['uid_set__detect_group']
-                if not nickname:
-                    nickname = uid
-
-                if detect_group is not None:
-                    if have_dkey:
-                        detect_med_type = 1  # 1为存库不推送
-                    else:
-                        detect_med_type = 2  # 为2的话,既推送,又存库
-                        if SERVER_TYPE != 'Ansjer.cn_config.cn_formal_settings':
-                            new_detect_interval = uid_push_list[0]['uid_set__new_detect_interval']
-                            detect_interval = new_detect_interval if new_detect_interval > 0 else detect_interval
-                            detect_interval = 60 if detect_interval < 60 else detect_interval
-                        redisObj.set_data(key=dkey, val=1, expire=detect_interval - 5)
-                        redisObj.set_data(key=pkey, val=1, expire=60)
-                logger.info('APP消息推送V1接口,是否进行APP推送:{},1为不推送,间隔:{}'.format(detect_med_type, detect_interval))
-                # 旧模式并且没有pkey,重新创建一个
-                if not detect_group and not have_pkey:
-                    redisObj.set_data(key=pkey, val=1, expire=60)
-                auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
-                bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'apg')
-                kwag_args = {
-                    'uid': uid,
-                    'channel': channel,
-                    'event_type': event_type,
-                    'n_time': n_time,
-                }
-                params = {'nickname': nickname, 'uid': uid, 'kwag_args': kwag_args, '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': ''}
-                #  推送以及报警消息存库
-                result = DevicePushService.save_msg_push(uid_set_push_list=uid_push_list, **params)
-                if result['code_date'] is None:
-                    result['code_date'] = {'do_apns_code': '', 'do_fcm_code': '', 'do_jpush_code': ''}
-                if detect_med_type == 1:
-                    result['code_date']['do_apns_code'] = '只存库不推送'
-                    result['code_date']['do_fcm_code'] = '只存库不推送'
-                    result['code_date']['do_jpush_code'] = '只存库不推送'
-                if is_sys_msg:
-                    SysMsgModel.objects.bulk_create(result['sys_msg_list'])
+            if detect_group is not None:
+                if have_dkey:
+                    detect_med_type = 1  # 1为存库不推送
                 else:
-                    if result['new_device_info_list'] and len(result['new_device_info_list']) > 0:
-                        # 根据日期获得星期几
-                        week = LocalDateTimeUtil.date_to_week(result['local_date_time'])
-                        EquipmentInfoService.equipment_info_bulk_create(week, result['new_device_info_list'])
-                        logger.info('----《旧接口》设备信息分表批量保存end')
-                if is_st == '0' or is_st == '2':
-                    print("is_st=0or2")
-                    for up in uid_push_list:
-                        if up['push_type'] == 0:  # ios apns
-                            up['do_apns_code'] = result['code_date']['do_apns_code']
-                        elif up['push_type'] == 1:  # android gcm
-                            up['do_fcm_code'] = result['code_date']['do_fcm_code']
-                        elif up['push_type'] == 2:  # android jpush
-                            up['do_jpush_code'] = result['code_date']['do_jpush_code']
-                        del up['push_type']
-                        del up['userID_id']
-                        del up['userID__NickName']
-                        del up['lang']
-                        del up['tz']
-                        del up['uid_set__nickname']
-                        del up['uid_set__detect_interval']
-                        del up['uid_set__detect_group']
-                    return JsonResponse(status=200, data={'code': 0, 'msg': 'success 0 or 2'})
-
-                elif is_st == '1':
-                    print("is_st=1")
-                    # Endpoint以杭州为例,其它Region请按实际情况填写。
-                    obj = '{uid}/{channel}/{filename}.jpeg'.format(uid=uid, channel=channel, filename=n_time)
-                    # 设置此签名URL在60秒内有效。
-                    url = bucket.sign_url('PUT', obj, 7200)
-                    for up in uid_push_list:
-                        up['do_apns_code'] = result['code_date']['do_apns_code']
-                        up['do_fcm_code'] = result['code_date']['do_fcm_code']
-                        up['do_jpush_code'] = result['code_date']['do_jpush_code']
-                        del up['push_type']
-                        del up['userID_id']
-                        del up['userID__NickName']
-                        del up['lang']
-                        del up['tz']
-                        del up['uid_set__nickname']
-                        del up['uid_set__detect_interval']
-                        del up['uid_set__detect_group']
-                    res_data = {'code': 0, 'img_push': url, 'msg': 'success'}
-                    return JsonResponse(status=200, data=res_data)
-
-                elif is_st == '3':
-                    print("is_st=3")
-                    # 人形检测带动图
-                    # Endpoint以杭州为例,其它Region请按实际情况填写。
-                    img_url_list = []
-                    for i in range(int(is_st)):
-                        obj = '{uid}/{channel}/{filename}_{st}.jpeg'. \
-                            format(uid=uid, channel=channel, filename=n_time, st=i)
-                        # 设置此签名URL在60秒内有效。
-                        url = bucket.sign_url('PUT', obj, 7200)
-                        img_url_list.append(url)
-
-                    for up in uid_push_list:
+                    detect_med_type = 2  # 为2的话,既推送,又存库
+                    if SERVER_TYPE != 'Ansjer.cn_config.cn_formal_settings':
+                        new_detect_interval = uid_push_list[0]['uid_set__new_detect_interval']
+                        detect_interval = new_detect_interval if new_detect_interval > 0 else detect_interval
+                        detect_interval = 60 if detect_interval < 60 else detect_interval
+                    redisObj.set_data(key=dkey, val=1, expire=detect_interval - 5)
+                    redisObj.set_data(key=pkey, val=1, expire=60)
+            logger.info('APP消息推送V1接口,是否进行APP推送:{},1为不推送,间隔:{}'.format(detect_med_type, detect_interval))
+            # 旧模式并且没有pkey,重新创建一个
+            if not detect_group and not have_pkey:
+                redisObj.set_data(key=pkey, val=1, expire=60)
+            auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
+            bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'apg')
+            kwag_args = {
+                'uid': uid,
+                'channel': channel,
+                'event_type': event_type,
+                'n_time': n_time,
+            }
+            params = {'nickname': nickname, 'uid': uid, 'kwag_args': kwag_args, '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': ''}
+            #  推送以及报警消息存库
+            result = DevicePushService.save_msg_push(uid_set_push_list=uid_push_list, **params)
+            if result['code_date'] is None:
+                result['code_date'] = {'do_apns_code': '', 'do_fcm_code': '', 'do_jpush_code': ''}
+            if detect_med_type == 1:
+                result['code_date']['do_apns_code'] = '只存库不推送'
+                result['code_date']['do_fcm_code'] = '只存库不推送'
+                result['code_date']['do_jpush_code'] = '只存库不推送'
+            if is_sys_msg:
+                SysMsgModel.objects.bulk_create(result['sys_msg_list'])
+            else:
+                if result['new_device_info_list'] and len(result['new_device_info_list']) > 0:
+                    # 根据日期获得星期几
+                    week = LocalDateTimeUtil.date_to_week(result['local_date_time'])
+                    EquipmentInfoService.equipment_info_bulk_create(week, result['new_device_info_list'])
+                    logger.info('----《旧接口》设备信息分表批量保存end')
+            if is_st == '0' or is_st == '2':
+                print("is_st=0or2")
+                for up in uid_push_list:
+                    if up['push_type'] == 0:  # ios apns
                         up['do_apns_code'] = result['code_date']['do_apns_code']
+                    elif up['push_type'] == 1:  # android gcm
                         up['do_fcm_code'] = result['code_date']['do_fcm_code']
+                    elif up['push_type'] == 2:  # android jpush
                         up['do_jpush_code'] = result['code_date']['do_jpush_code']
-                        del up['push_type']
-                        del up['userID_id']
-                        del up['userID__NickName']
-                        del up['lang']
-                        del up['tz']
-                        del up['uid_set__nickname']
-                        del up['uid_set__detect_interval']
-                        del up['uid_set__detect_group']
-
-                    res_data = {'code': 0, 'img_url_list': img_url_list, 'msg': 'success 3'}
-                    return JsonResponse(status=200, data=res_data)
+                    del up['push_type']
+                    del up['userID_id']
+                    del up['userID__NickName']
+                    del up['lang']
+                    del up['tz']
+                    del up['uid_set__nickname']
+                    del up['uid_set__detect_interval']
+                    del up['uid_set__detect_group']
+                return JsonResponse(status=200, data={'code': 0, 'msg': 'success 0 or 2'})
+
+            elif is_st == '1':
+                print("is_st=1")
+                # Endpoint以杭州为例,其它Region请按实际情况填写。
+                obj = '{uid}/{channel}/{filename}.jpeg'.format(uid=uid, channel=channel, filename=n_time)
+                # 设置此签名URL在60秒内有效。
+                url = bucket.sign_url('PUT', obj, 7200)
+                for up in uid_push_list:
+                    up['do_apns_code'] = result['code_date']['do_apns_code']
+                    up['do_fcm_code'] = result['code_date']['do_fcm_code']
+                    up['do_jpush_code'] = result['code_date']['do_jpush_code']
+                    del up['push_type']
+                    del up['userID_id']
+                    del up['userID__NickName']
+                    del up['lang']
+                    del up['tz']
+                    del up['uid_set__nickname']
+                    del up['uid_set__detect_interval']
+                    del up['uid_set__detect_group']
+                res_data = {'code': 0, 'img_push': url, 'msg': 'success'}
+                return JsonResponse(status=200, data=res_data)
+
+            elif is_st == '3':
+                print("is_st=3")
+                # 人形检测带动图
+                # Endpoint以杭州为例,其它Region请按实际情况填写。
+                img_url_list = []
+                for i in range(int(is_st)):
+                    obj = '{uid}/{channel}/{filename}_{st}.jpeg'. \
+                        format(uid=uid, channel=channel, filename=n_time, st=i)
+                    # 设置此签名URL在60秒内有效。
+                    url = bucket.sign_url('PUT', obj, 7200)
+                    img_url_list.append(url)
+
+                for up in uid_push_list:
+                    up['do_apns_code'] = result['code_date']['do_apns_code']
+                    up['do_fcm_code'] = result['code_date']['do_fcm_code']
+                    up['do_jpush_code'] = result['code_date']['do_jpush_code']
+                    del up['push_type']
+                    del up['userID_id']
+                    del up['userID__NickName']
+                    del up['lang']
+                    del up['tz']
+                    del up['uid_set__nickname']
+                    del up['uid_set__detect_interval']
+                    del up['uid_set__detect_group']
+
+                res_data = {'code': 0, 'img_url_list': img_url_list, 'msg': 'success 3'}
+                return JsonResponse(status=200, data=res_data)
         except Exception as e:
             logger.info('消息推送-异常详情,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
             data = {

+ 61 - 63
Controller/DetectControllerV2.py

@@ -70,70 +70,68 @@ class NotificationV2View(View):
             if not CommonService.check_time_stamp_token(time_token, time_stamp):
                 return JsonResponse(status=200, data={'code': 13, 'msg': 'Timestamp token verification failed'})
         try:
-            with transaction.atomic():
-                is_st = int(is_st)
-                region = int(region)
-                if not uid:
-                    uid = DevicePushService.decode_uid(etk, uidToken)  # 解密uid
-                if len(uid) != 20 and len(uid) != 14:
-                    return JsonResponse(status=200, data={'code': 404, 'msg': 'wrong uid'})
-                req_limiting = '{uid}_{channel}_{event_type}_ptl' \
+            is_st = int(is_st)
+            region = int(region)
+            uid = DevicePushService.decode_uid(etk, uidToken)  # 解密uid
+            if len(uid) != 20 and len(uid) != 14:
+                return JsonResponse(status=200, data={'code': 404, 'msg': 'wrong uid'})
+            req_limiting = '{uid}_{channel}_{event_type}_ptl' \
+                .format(uid=uid, channel=channel, event_type=event_type)
+            is_sys_msg = self.is_sys_msg(int(event_type))  # 判断事件类型是否是系统消息
+            if is_sys_msg:
+                push_interval = '{uid}_{channel}_{event_type}_flag' \
                     .format(uid=uid, channel=channel, event_type=event_type)
-                is_sys_msg = self.is_sys_msg(int(event_type))  # 判断事件类型是否是系统消息
-                if is_sys_msg:
-                    push_interval = '{uid}_{channel}_{event_type}_flag' \
-                        .format(uid=uid, channel=channel, event_type=event_type)
-                else:
-                    push_interval = '{uid}_{channel}_flag'.format(uid=uid, channel=channel)
-                redisObj = RedisObject(db=6)
-                cache_req_limiting = redisObj.get_data(key=req_limiting)  # 获取请求限流缓存数据
-                cache_app_push = redisObj.get_data(key=push_interval)  # 获取APP推送消息时间间隔缓存数据
-                logger.info('消息推送- 限流key: {}, 推送间隔key: {}'.
-                            format(cache_req_limiting, cache_app_push))
-                if cache_req_limiting:  # 限流存在则直接返回
-                    return JsonResponse(status=200, data={'code': 0, 'msg': 'Push again in one minute'})
-                redisObj.set_data(key=req_limiting, val=1, expire=60)  # 当缓存不存在限流数据 重新设置一分钟请求一次
-                uid_push_qs = DevicePushService.query_uid_push(uid)  # 查询uid_set与push数据列表
-                if not uid_push_qs.exists():
-                    logger.info('消息推送-uid_push 数据不存在')
-                    return JsonResponse(status=200, data={'code': 176, 'msg': 'no uid_push data'})
-                ai_type = uid_push_qs.first()['uid_set__ai_type']
-                event_type = self.get_combo_msg_type(ai_type, int(event_type))  # 解析消息事件类型看是否多类型组合
-                # 将uid_set以及uid_push 转数组列表
-                uid_set_push_list = DevicePushService.cache_uid_push(uid_push_qs)
-                nickname = uid_set_push_list[0]['uid_set__nickname']
-                nickname = uid if not nickname else nickname
-                # APP消息提醒推送间隔
-                detect_interval = uid_set_push_list[0]['uid_set__detect_interval']
-                if not cache_app_push:
-                    # 缓存APP提醒推送间隔 默认1分钟提醒一次
-                    DevicePushService.cache_push_detect_interval(redisObj, push_interval, detect_interval,
-                                                                 uid_set_push_list[0]['uid_set__new_detect_interval'])
-                bucket = ''
-                aws_s3_client = ''
-                if is_st == 1 or is_st == 3:  # 使用aws s3
-                    aws_s3_client = s3_client(region=region)
-                    bucket = 'foreignpush' if region == 1 else 'push'
-                kwag_args = {
-                    'uid': uid,
-                    'channel': channel,
-                    'event_type': event_type,
-                    'n_time': n_time,
-                }
-                params = {'nickname': nickname, 'uid': uid, 'kwag_args': kwag_args, 'is_st': is_st, 'region': region,
-                          '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}
-                # APP消息推送与获取报警消息数据列表
-                result = DevicePushService.save_msg_push(uid_set_push_list, **params)
-                # 批量系统消息&报警消息数据存库
-                DevicePushService.save_sys_msg(is_sys_msg, result['local_date_time'],
-                                               result['sys_msg_list'], result['new_device_info_list'])
-                params['aws_s3_client'] = aws_s3_client
-                params['uid_set_push_list'] = uid_set_push_list
-                params['code_dict'] = result
-                result_dict = DevicePushService.get_push_url(**params)  # 获取S3对象上传链接
-                return JsonResponse(status=200, data=result_dict)
+            else:
+                push_interval = '{uid}_{channel}_flag'.format(uid=uid, channel=channel)
+            redisObj = RedisObject(db=6)
+            cache_req_limiting = redisObj.get_data(key=req_limiting)  # 获取请求限流缓存数据
+            cache_app_push = redisObj.get_data(key=push_interval)  # 获取APP推送消息时间间隔缓存数据
+            logger.info('消息推送- 限流key: {}, 推送间隔key: {}'.
+                        format(cache_req_limiting, cache_app_push))
+            if cache_req_limiting:  # 限流存在则直接返回
+                return JsonResponse(status=200, data={'code': 0, 'msg': 'Push again in one minute'})
+            redisObj.set_data(key=req_limiting, val=1, expire=60)  # 当缓存不存在限流数据 重新设置一分钟请求一次
+            uid_push_qs = DevicePushService.query_uid_push(uid)  # 查询uid_set与push数据列表
+            if not uid_push_qs.exists():
+                logger.info('消息推送-uid_push 数据不存在')
+                return JsonResponse(status=200, data={'code': 176, 'msg': 'no uid_push data'})
+            ai_type = uid_push_qs.first()['uid_set__ai_type']
+            event_type = self.get_combo_msg_type(ai_type, int(event_type))  # 解析消息事件类型看是否多类型组合
+            # 将uid_set以及uid_push 转数组列表
+            uid_set_push_list = DevicePushService.cache_uid_push(uid_push_qs)
+            nickname = uid_set_push_list[0]['uid_set__nickname']
+            nickname = uid if not nickname else nickname
+            # APP消息提醒推送间隔
+            detect_interval = uid_set_push_list[0]['uid_set__detect_interval']
+            if not cache_app_push:
+                # 缓存APP提醒推送间隔 默认1分钟提醒一次
+                DevicePushService.cache_push_detect_interval(redisObj, push_interval, detect_interval,
+                                                             uid_set_push_list[0]['uid_set__new_detect_interval'])
+            bucket = ''
+            aws_s3_client = ''
+            if is_st == 1 or is_st == 3:  # 使用aws s3
+                aws_s3_client = s3_client(region=region)
+                bucket = 'foreignpush' if region == 1 else 'push'
+            kwag_args = {
+                'uid': uid,
+                'channel': channel,
+                'event_type': event_type,
+                'n_time': n_time,
+            }
+            params = {'nickname': nickname, 'uid': uid, 'kwag_args': kwag_args, 'is_st': is_st, 'region': region,
+                      '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}
+            # APP消息推送与获取报警消息数据列表
+            result = DevicePushService.save_msg_push(uid_set_push_list, **params)
+            # 批量系统消息&报警消息数据存库
+            DevicePushService.save_sys_msg(is_sys_msg, result['local_date_time'],
+                                           result['sys_msg_list'], result['new_device_info_list'])
+            params['aws_s3_client'] = aws_s3_client
+            params['uid_set_push_list'] = uid_set_push_list
+            params['code_dict'] = result
+            result_dict = DevicePushService.get_push_url(**params)  # 获取S3对象上传链接
+            return JsonResponse(status=200, data=result_dict)
         except Exception as e:
             logger.info('消息推送-异常详情,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
             data = {