Преглед изворни кода

根据mac地址分配情况邮件提醒功能,当分配使用完时返回175(2)

lhq пре 4 година
родитељ
комит
e9b87eee13
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      Controller/FileController.py

+ 3 - 0
Controller/FileController.py

@@ -103,7 +103,10 @@ class UploadUIDFileView(View):
         elif current_mac[-8:] == '0F:90:60':  # 一组一共1048576个,此mac是第102w个时
             sys_msg_text = "当前旧UID管理系统mac地址已分配到" + current_mac + ",此mac地址是当前组的第102w个,还剩下28576个可分配,mac地址即将用完。"
             S3Email().faEmail(sys_msg_text, username)
+        elif not mac['is_active']:
+            return response.json(175)
         elif current_mac[-8:] == '0F:FF:FF':
+            MacModel.objects.filter().update(is_active=False)  # 更改mac可使用的状态,当再此调用接口时使用上面条件进行阻止
             sys_msg_text = "当前旧UID管理系统mac地址已分配到" + current_mac + ",mac地址已分配使用完,请更换分组。"
             S3Email().faEmail(sys_msg_text, username)
             return response.json(175)