|
@@ -84,8 +84,7 @@ class NotificationV2View(View):
|
|
|
have_ykey = redisObj.get_data(key=ykey) # uid_set 数据库缓存
|
|
|
have_pkey = redisObj.get_data(key=pkey) # 一分钟限制key
|
|
|
have_dkey = redisObj.get_data(key=dkey) # 推送消息时间间隔
|
|
|
- logger.info('ykey:{}, pkey: {}, dkey: {},'.format(have_ykey, have_pkey, have_dkey))
|
|
|
-
|
|
|
+ logger.info('ykey:{}, pkey: {}, dkey: {}'.format(have_ykey, have_pkey, have_dkey))
|
|
|
# 一分钟内不推送
|
|
|
if have_pkey:
|
|
|
return JsonResponse(status=200, data={'code': 0, 'msg': 'Push again in one minute'})
|
|
@@ -109,22 +108,15 @@ class NotificationV2View(View):
|
|
|
|
|
|
nickname = redis_list[0]['uid_set__nickname']
|
|
|
detect_interval = redis_list[0]['uid_set__detect_interval']
|
|
|
- detect_group = redis_list[0]['uid_set__detect_group']
|
|
|
-
|
|
|
if not nickname:
|
|
|
nickname = uid
|
|
|
-
|
|
|
if not have_dkey:
|
|
|
# 设置推送消息的时间间隔
|
|
|
new_detect_interval = redis_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
|
|
|
- if detect_group == '0' or detect_group == '':
|
|
|
- redisObj.set_data(key=dkey, val=1, expire=detect_interval)
|
|
|
- else:
|
|
|
- detect_group_list = detect_group.split(',')
|
|
|
- if event_type in detect_group_list:
|
|
|
- redisObj.set_data(key=dkey, val=1, expire=detect_interval)
|
|
|
+ redisObj.set_data(key=dkey, val=1, expire=detect_interval-5)
|
|
|
+ logger.info('APP消息推送间隔:{}s'.format(detect_interval))
|
|
|
|
|
|
if is_st == 1 or is_st == 3: # 使用aws s3
|
|
|
aws_s3_client = s3_client(region=region)
|
|
@@ -204,7 +196,7 @@ class NotificationV2View(View):
|
|
|
try:
|
|
|
# 推送消息
|
|
|
if not have_dkey:
|
|
|
- logger.info('准备推送:{}, {}'.format(uid, request_dict))
|
|
|
+ logger.info('APP准备推送:{}, {}'.format(uid, request_dict))
|
|
|
if (is_st == 1 or is_st == 3) and (push_type == 0 or push_type == 1): # 推送显示图片
|
|
|
if is_st == 1:
|
|
|
key = '{}/{}/{}.jpeg'.format(uid, channel, n_time)
|