|
@@ -6,6 +6,7 @@ import threading
|
|
|
import time
|
|
|
|
|
|
from Model.models import DeviceTypeModel, Device_Info, GatewayPush, CountryModel, SysMsgModel
|
|
|
+from Object.RedisObject import RedisObject
|
|
|
from Service.CommonService import CommonService
|
|
|
from Service.HuaweiPushService.HuaweiPushService import HuaweiPushObject
|
|
|
from Service.PushService import PushObject
|
|
@@ -128,10 +129,19 @@ class CustomizedPushObject:
|
|
|
|
|
|
# 推送成功,写入系统消息
|
|
|
if push_succeed:
|
|
|
- SysMsgModel.objects.create(
|
|
|
- userID_id=user_id, title=title, msg=msg, jumpLink=link, addTime=n_time, updTime=n_time
|
|
|
- )
|
|
|
- CUSTOMIZED_PUSH_LOGGER.info('用户{}推送成功'.format(user_id))
|
|
|
+ info = '{}推送成功'
|
|
|
+
|
|
|
+ # 已存表用户保存到redis,推送成功不再保存数据,避免重复保存
|
|
|
+ redis_obj = RedisObject()
|
|
|
+ key = 'customized_pushed_user_list'
|
|
|
+ saved = redis_obj.lindex(key)
|
|
|
+ if saved is None:
|
|
|
+ redis_obj.rpush(key, user_id)
|
|
|
+ SysMsgModel.objects.create(
|
|
|
+ userID_id=user_id, title=title, msg=msg, jumpLink=link, addTime=n_time, updTime=n_time
|
|
|
+ )
|
|
|
+ info += ',存表成功'
|
|
|
+ CUSTOMIZED_PUSH_LOGGER.info('info'.format(user_id))
|
|
|
else:
|
|
|
CUSTOMIZED_PUSH_LOGGER.info('用户{}推送失败,push_type:{}'.format(user_id, push_type))
|
|
|
|