feat: 제품 이미지 크롤링에 날짜 선택 기능 추가 - 달력으로 날짜 선택 가능 - 해당 날짜 판매 제품 크롤링
This commit is contained in:
@@ -325,8 +325,9 @@
|
||||
<header>
|
||||
<h1>🖼️ 제품 이미지 관리</h1>
|
||||
<div class="actions">
|
||||
<button class="btn btn-primary" onclick="crawlToday()">
|
||||
🔄 오늘 판매 제품 크롤링
|
||||
<input type="date" id="crawlDate" class="filter-select" style="padding: 8px 12px;">
|
||||
<button class="btn btn-primary" onclick="crawlByDate()">
|
||||
🔄 해당일 판매 제품 크롤링
|
||||
</button>
|
||||
<button class="btn btn-secondary" onclick="openManualCrawl()">
|
||||
➕ 수동 크롤링
|
||||
@@ -453,6 +454,10 @@
|
||||
|
||||
// 초기 로드
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// 오늘 날짜로 기본값 설정
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
document.getElementById('crawlDate').value = today;
|
||||
|
||||
loadStats();
|
||||
loadImages();
|
||||
});
|
||||
@@ -542,14 +547,25 @@
|
||||
debounceTimer = setTimeout(loadImages, 300);
|
||||
}
|
||||
|
||||
async function crawlToday() {
|
||||
if (!confirm('오늘 판매된 제품 이미지를 크롤링합니다. 진행할까요?')) return;
|
||||
async function crawlByDate() {
|
||||
const dateInput = document.getElementById('crawlDate').value;
|
||||
if (!dateInput) {
|
||||
showToast('날짜를 선택하세요', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
showToast('크롤링 시작... 잠시 기다려주세요', 'info');
|
||||
const dateStr = dateInput.replace(/-/g, '');
|
||||
const displayDate = `${dateStr.slice(4,6)}/${dateStr.slice(6,8)}`;
|
||||
|
||||
if (!confirm(`${displayDate} 판매 제품 이미지를 크롤링합니다. 진행할까요?`)) return;
|
||||
|
||||
showToast(`${displayDate} 크롤링 시작... 잠시 기다려주세요`, 'info');
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/admin/product-images/crawl-today', {
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ date: dateInput })
|
||||
});
|
||||
const data = await res.json();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user