feat: yakkok.com 제품 이미지 크롤러 + 어드민 페이지
크롤러 (utils/yakkok_crawler.py): - yakkok.com에서 제품 검색 및 이미지 추출 - MSSQL 오늘 판매 품목 자동 조회 - base64 변환 후 SQLite 저장 - CLI 지원 (--today, --product) DB (product_images.db): - 바코드, 제품명, 이미지(base64), 상태 저장 - 크롤링 로그 테이블 어드민 페이지 (/admin/product-images): - 이미지 목록/검색/필터 - 통계 (성공/실패/대기) - 상세 보기/삭제 - 오늘 판매 제품 일괄 크롤링 API: - GET /api/admin/product-images - GET /api/admin/product-images/<barcode> - POST /api/admin/product-images/crawl-today - DELETE /api/admin/product-images/<barcode>
This commit is contained in:
38
backend/db/product_images_schema.sql
Normal file
38
backend/db/product_images_schema.sql
Normal file
@@ -0,0 +1,38 @@
|
||||
-- product_images.db 스키마
|
||||
-- yakkok.com에서 크롤링한 제품 이미지 저장
|
||||
|
||||
CREATE TABLE IF NOT EXISTS product_images (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
barcode TEXT UNIQUE NOT NULL, -- 바코드 (고유키)
|
||||
drug_code TEXT, -- PIT3000 DrugCode
|
||||
product_name TEXT NOT NULL, -- 제품명
|
||||
search_name TEXT, -- 검색에 사용한 이름
|
||||
image_base64 TEXT, -- 이미지 (base64)
|
||||
image_url TEXT, -- 원본 URL
|
||||
thumbnail_base64 TEXT, -- 썸네일 (base64, 작은 사이즈)
|
||||
source TEXT DEFAULT 'yakkok', -- 출처
|
||||
status TEXT DEFAULT 'pending', -- pending/success/failed/manual/no_result
|
||||
error_message TEXT, -- 실패 시 에러 메시지
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- 인덱스
|
||||
CREATE INDEX IF NOT EXISTS idx_barcode ON product_images(barcode);
|
||||
CREATE INDEX IF NOT EXISTS idx_status ON product_images(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_drug_code ON product_images(drug_code);
|
||||
CREATE INDEX IF NOT EXISTS idx_created_at ON product_images(created_at);
|
||||
|
||||
-- 크롤링 로그 테이블
|
||||
CREATE TABLE IF NOT EXISTS crawl_logs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
batch_id TEXT, -- 배치 ID
|
||||
total_count INTEGER DEFAULT 0, -- 전체 개수
|
||||
success_count INTEGER DEFAULT 0, -- 성공 개수
|
||||
failed_count INTEGER DEFAULT 0, -- 실패 개수
|
||||
skipped_count INTEGER DEFAULT 0, -- 스킵 개수 (이미 있음)
|
||||
started_at DATETIME,
|
||||
finished_at DATETIME,
|
||||
status TEXT DEFAULT 'running', -- running/completed/failed
|
||||
error_message TEXT
|
||||
);
|
||||
Reference in New Issue
Block a user