Files
ewoooc/scripts/archive/check_specific_products.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

42 lines
1.2 KiB
Python

import os
import sys
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
# 設定路徑
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, BASE_DIR)
from database.models import Product
# 資料庫路徑
DB_PATH = os.path.join(BASE_DIR, 'data', 'momo_database.db')
engine = create_engine(f'sqlite:///{DB_PATH}')
Session = sessionmaker(bind=engine)
session = Session()
# 指定的商品編號
i_codes = ['14672839', '9216349', '13261678', '6676895', '13240823', '13240822', '10911080', '3876337', '8863611']
print("🔍 檢查指定商品的圖片 URL:\n")
print("=" * 100)
for i_code in i_codes:
product = session.query(Product).filter(Product.i_code == i_code).first()
if product:
print(f"\n[{i_code}] {product.name[:60]}...")
print(f" 當前圖片: {product.image_url}")
# 檢查 URL 是否包含 i_code
if product.image_url and i_code in product.image_url:
print(f" ✅ URL 包含商品編號")
elif product.image_url:
print(f" ❌ URL 不包含商品編號")
else:
print(f" ⚠️ 無圖片")
else:
print(f"\n[{i_code}] ⚠️ 找不到此商品")
print("\n" + "=" * 100)
session.close()