chore: remove obsolete wangwang888 endpoint script
This commit is contained in:
@@ -1,52 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""更新 wangwang888 网站的 groups_endpoint 为 /groups/all
|
|
||||||
|
|
||||||
使用方法:
|
|
||||||
python backend/update_wangwang888_groups_endpoint.py
|
|
||||||
"""
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
sys.path.insert(0, str(Path(__file__).parent))
|
|
||||||
|
|
||||||
from app.database import SessionLocal
|
|
||||||
from app.models.website import Website
|
|
||||||
|
|
||||||
|
|
||||||
def update_wangwang888_endpoint():
|
|
||||||
db = SessionLocal()
|
|
||||||
try:
|
|
||||||
# 查找 wangwang888 网站(通过名称或 base_url 匹配)
|
|
||||||
websites = db.query(Website).filter(
|
|
||||||
(Website.name.like('%wangwang888%')) |
|
|
||||||
(Website.name.like('%旺旺888%')) |
|
|
||||||
(Website.base_url.like('%wangwang888%'))
|
|
||||||
).all()
|
|
||||||
|
|
||||||
if not websites:
|
|
||||||
print("未找到 wangwang888 网站配置")
|
|
||||||
return
|
|
||||||
|
|
||||||
for website in websites:
|
|
||||||
old_endpoint = website.groups_endpoint
|
|
||||||
if old_endpoint == "/groups/all":
|
|
||||||
print(f"网站 {website.name} (ID={website.id}) 已配置为 /groups/all,无需更新")
|
|
||||||
continue
|
|
||||||
|
|
||||||
website.groups_endpoint = "/groups/all"
|
|
||||||
print(f"更新网站 {website.name} (ID={website.id}):")
|
|
||||||
print(f" groups_endpoint: {old_endpoint} -> /groups/all")
|
|
||||||
|
|
||||||
db.commit()
|
|
||||||
print("\n更新完成")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
db.rollback()
|
|
||||||
print(f"更新失败: {e}")
|
|
||||||
raise
|
|
||||||
finally:
|
|
||||||
db.close()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
update_wangwang888_endpoint()
|
|
||||||
Reference in New Issue
Block a user