|
@@ -7,7 +7,7 @@ import requests
|
|
from django.db import transaction
|
|
from django.db import transaction
|
|
from django.views import View
|
|
from django.views import View
|
|
|
|
|
|
-from Ansjer.config import CRCKey, CONFIG_INFO, CONFIG_TEST, CONFIG_US, \
|
|
|
|
|
|
+from Ansjer.config import CRCKey, CONFIG_INFO, CONFIG_US, \
|
|
CONFIG_CN, USED_SERIAL_REDIS_LIST, UNUSED_SERIAL_REDIS_LIST, SERVER_DOMAIN_US, REGION_ID_LIST, SERVER_DOMAIN_TEST, \
|
|
CONFIG_CN, USED_SERIAL_REDIS_LIST, UNUSED_SERIAL_REDIS_LIST, SERVER_DOMAIN_US, REGION_ID_LIST, SERVER_DOMAIN_TEST, \
|
|
SERVER_DOMAIN_LIST, SERVER_DOMAIN_CN, SERVER_DOMAIN_EUR, RESET_REGION_ID_SERIAL_REDIS_LIST
|
|
SERVER_DOMAIN_LIST, SERVER_DOMAIN_CN, SERVER_DOMAIN_EUR, RESET_REGION_ID_SERIAL_REDIS_LIST
|
|
from Model.models import SerialNumberModel, CompanySerialModel, UIDCompanySerialModel, UIDModel, Device_Info, \
|
|
from Model.models import SerialNumberModel, CompanySerialModel, UIDCompanySerialModel, UIDModel, Device_Info, \
|
|
@@ -321,24 +321,23 @@ class SerialNumberView(View):
|
|
@param redis_obj: redis对象
|
|
@param redis_obj: redis对象
|
|
@return:
|
|
@return:
|
|
"""
|
|
"""
|
|
- # 测试服不处理
|
|
|
|
- if CONFIG_INFO != CONFIG_TEST:
|
|
|
|
- redis_obj.rpush(USED_SERIAL_REDIS_LIST, serial)
|
|
|
|
-
|
|
|
|
- vpg_id = 1
|
|
|
|
- if CONFIG_INFO == 'us':
|
|
|
|
- vpg_id = 3
|
|
|
|
- elif CONFIG_INFO == 'eur':
|
|
|
|
- vpg_id = 4
|
|
|
|
- p2p_type = int(p2p_type)
|
|
|
|
-
|
|
|
|
- # 剩余uid数量少于2000邮件提醒
|
|
|
|
- unused_uid_count = UIDModel.objects.filter(vpg_id=vpg_id, p2p_type=p2p_type, status=0).count()
|
|
|
|
- warning_count = 2000
|
|
|
|
- if unused_uid_count < warning_count:
|
|
|
|
- platform = '尚云' if p2p_type == 1 else 'tutk'
|
|
|
|
- email_content = '{}服{]的uid数量少于{}个,请及时处理'.format(CONFIG_INFO, platform, warning_count)
|
|
|
|
- S3Email().faEmail(email_content, 'servers@ansjer.com')
|
|
|
|
|
|
+ # 写入已使用序列号redis列表
|
|
|
|
+ redis_obj.rpush(USED_SERIAL_REDIS_LIST, serial)
|
|
|
|
+
|
|
|
|
+ vpg_id = 1
|
|
|
|
+ if CONFIG_INFO == 'us':
|
|
|
|
+ vpg_id = 3
|
|
|
|
+ elif CONFIG_INFO == 'eur':
|
|
|
|
+ vpg_id = 4
|
|
|
|
+ p2p_type = int(p2p_type)
|
|
|
|
+
|
|
|
|
+ # 剩余uid数量少于2000邮件提醒
|
|
|
|
+ unused_uid_count = UIDModel.objects.filter(vpg_id=vpg_id, p2p_type=p2p_type, status=0).count()
|
|
|
|
+ warning_count = 2000
|
|
|
|
+ if unused_uid_count < warning_count:
|
|
|
|
+ platform = '尚云' if p2p_type == 1 else 'tutk'
|
|
|
|
+ email_content = '{}服{]的uid数量少于{}个,请及时处理'.format(CONFIG_INFO, platform, warning_count)
|
|
|
|
+ S3Email().faEmail(email_content, 'servers@ansjer.com')
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
def log_and_send_email(request, company_serial_id, serial, now_time):
|
|
def log_and_send_email(request, company_serial_id, serial, now_time):
|
|
@@ -515,9 +514,8 @@ class SerialNumberView(View):
|
|
ExperienceAiModel.objects.filter(uid=uid).delete()
|
|
ExperienceAiModel.objects.filter(uid=uid).delete()
|
|
AiService.objects.filter(uid=uid).delete()
|
|
AiService.objects.filter(uid=uid).delete()
|
|
|
|
|
|
- # 不为测试服,则写入redis列表
|
|
|
|
- if CONFIG_INFO != CONFIG_TEST:
|
|
|
|
- redisObj.rpush(UNUSED_SERIAL_REDIS_LIST, serial)
|
|
|
|
|
|
+ # 写入未使用序列号redis列表
|
|
|
|
+ redisObj.rpush(UNUSED_SERIAL_REDIS_LIST, serial)
|
|
|
|
|
|
# 重置region_id,不为美洲服,则写入redis列表
|
|
# 重置region_id,不为美洲服,则写入redis列表
|
|
if CONFIG_INFO == CONFIG_US:
|
|
if CONFIG_INFO == CONFIG_US:
|