|
@@ -248,23 +248,21 @@ class SerialNumberView(View):
|
|
# 测试服不处理
|
|
# 测试服不处理
|
|
if CONFIG_INFO != CONFIG_TEST:
|
|
if CONFIG_INFO != CONFIG_TEST:
|
|
redis_obj.rpush(USED_SERIAL_REDIS_LIST, serial)
|
|
redis_obj.rpush(USED_SERIAL_REDIS_LIST, serial)
|
|
- vpg_qs = VPGModel.objects.filter()
|
|
|
|
- if vpg_qs.exists():
|
|
|
|
- p2p_type = int(p2p_type)
|
|
|
|
|
|
+
|
|
|
|
+ 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'
|
|
platform = '尚云' if p2p_type == 1 else 'tutk'
|
|
- vpg_id = 1
|
|
|
|
- if CONFIG_INFO == 'us':
|
|
|
|
- vpg_id = 3
|
|
|
|
- elif CONFIG_INFO == 'eur':
|
|
|
|
- vpg_id = 4
|
|
|
|
-
|
|
|
|
- for vpg in vpg_qs:
|
|
|
|
- unused_uid_count = UIDModel.objects.filter(vpg_id=vpg_id, status=0, p2p_type=p2p_type).count()
|
|
|
|
- # 判断剩余uid数量
|
|
|
|
- warning_count = 2000
|
|
|
|
- if unused_uid_count < warning_count:
|
|
|
|
- email_content = '{}服{]的uid数量少于{}个,请及时处理'.format(CONFIG_INFO, platform, warning_count)
|
|
|
|
- S3Email().faEmail(email_content, 'servers@ansjer.com')
|
|
|
|
|
|
+ email_content = '{}服{]的uid数量少于{}个,请及时处理'.format(CONFIG_INFO, platform, warning_count)
|
|
|
|
+ S3Email().faEmail(email_content, 'servers@ansjer.com')
|
|
|
|
|
|
def do_get_uid(self, request_dict, response):
|
|
def do_get_uid(self, request_dict, response):
|
|
serial_number = request_dict.get('serial_number', None)
|
|
serial_number = request_dict.get('serial_number', None)
|