replace screenshot pipeline and update admin
This commit is contained in:
@@ -229,6 +229,33 @@ class RiskScorer:
|
||||
self._update_scores(cursor, "", user_id_int, delta, now_str)
|
||||
conn.commit()
|
||||
|
||||
def reset_ip_score(self, ip: str) -> bool:
|
||||
"""清零指定IP的风险分"""
|
||||
ip_text = str(ip or "").strip()[:64]
|
||||
if not ip_text:
|
||||
return False
|
||||
|
||||
now_str = get_cst_now_str()
|
||||
with db_pool.get_db() as conn:
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("SELECT ip FROM ip_risk_scores WHERE ip = ?", (ip_text,))
|
||||
row = cursor.fetchone()
|
||||
if row:
|
||||
cursor.execute(
|
||||
"UPDATE ip_risk_scores SET risk_score = 0, last_seen = ?, updated_at = ? WHERE ip = ?",
|
||||
(now_str, now_str, ip_text),
|
||||
)
|
||||
else:
|
||||
cursor.execute(
|
||||
"""
|
||||
INSERT INTO ip_risk_scores (ip, risk_score, last_seen, created_at, updated_at)
|
||||
VALUES (?, 0, ?, ?, ?)
|
||||
""",
|
||||
(ip_text, now_str, now_str, now_str),
|
||||
)
|
||||
conn.commit()
|
||||
return True
|
||||
|
||||
def _update_scores(
|
||||
self,
|
||||
cursor,
|
||||
|
||||
Reference in New Issue
Block a user