Files
ewoooc/scripts/archive/fix_edm_status.py
ogt 1b4f3a7bbe
Some checks failed
CD Pipeline / deploy (push) Failing after 59s
feat: EwoooC 初始化 — 完整專案推版至 Gitea
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml)
- 部署模式: rsync Python 檔案至 188 → docker restart (volume mount)
- Dockerfile/requirements 變動時自動重建 Docker image
- 部署通知: Telegram (開始/成功/失敗)
- 健康檢查: https://mo.wooo.work/health (最多 5 次重試)
- 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 01:21:13 +08:00

21 lines
807 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from database.manager import DatabaseManager
from database.edm_models import PromoProduct
def fix_edm_status():
db = DatabaseManager()
session = db.get_session()
try:
print("🛠️ 正在修正 EDM 商品狀態...")
# 將所有目前標記為 DELISTED 的舊資料改為 SLOT_END讓它們從儀表板消失
# 這樣下一次爬蟲會重新建立正確的狀態
session.query(PromoProduct).filter(PromoProduct.status_change == 'DELISTED').update({PromoProduct.status_change: 'SLOT_END'})
session.commit()
print("✅ 修正完成!請重新執行一次 EDM 爬蟲任務以獲取最新狀態。")
except Exception as e:
print(f"❌ 錯誤: {e}")
finally:
session.close()
if __name__ == "__main__":
fix_edm_status()