|
@@ -6,12 +6,11 @@ import threading
|
|
|
import time
|
|
|
from concurrent.futures import ThreadPoolExecutor
|
|
|
|
|
|
-from Model.models import DeviceTypeModel, Device_Info, GatewayPush, CountryModel, SysMsgModel, CustomizedPush, \
|
|
|
- UserEmailSubscriptions
|
|
|
+from AnsjerPush.config import CONFIG_INFO, CONFIG_TEST, CONFIG_CN, XM_PUSH_CHANNEL_ID
|
|
|
+from Model.models import DeviceTypeModel, Device_Info, GatewayPush, CountryModel, SysMsgModel, UserEmailSubscriptions
|
|
|
from Service.CommonService import CommonService
|
|
|
from Service.HuaweiPushService.HuaweiPushService import HuaweiPushObject
|
|
|
from Service.PushService import PushObject
|
|
|
-from AnsjerPush.config import XM_PUSH_CHANNEL_ID
|
|
|
|
|
|
CUSTOMIZED_PUSH_LOGGER = logging.getLogger('customized_push')
|
|
|
|
|
@@ -30,10 +29,15 @@ class CustomizedPushObject:
|
|
|
# 设备型号和国家
|
|
|
device_name_list = device_name.split(',')
|
|
|
device_type_list = DeviceTypeModel.objects.filter(name__in=device_name_list).values_list('type', flat=True)
|
|
|
- country_name_list = country.split(',')
|
|
|
- country_id_list = CountryModel.objects.filter(country_name__in=country_name_list).values_list('id', flat=True)
|
|
|
- device_info_qs = Device_Info.objects.filter(Type__in=device_type_list,
|
|
|
- userID__region_country__in=country_id_list)
|
|
|
+ # 测试和国内服推给所有用户
|
|
|
+ if CONFIG_INFO in [CONFIG_TEST, CONFIG_CN]:
|
|
|
+ device_info_qs = Device_Info.objects.filter(Type__in=device_type_list)
|
|
|
+ else:
|
|
|
+ country_name_list = country.split(',')
|
|
|
+ country_id_list = CountryModel.objects.filter(country_name__in=country_name_list).\
|
|
|
+ values_list('id', flat=True)
|
|
|
+ device_info_qs = Device_Info.objects.filter(Type__in=device_type_list,
|
|
|
+ userID__region_country__in=country_id_list)
|
|
|
# 获取时间范围
|
|
|
now_time = int(time.time())
|
|
|
|