Merge branch 'feat/performance' into feat/project — 네이버 스마트스토어 매출 수집
This commit is contained in:
@@ -826,17 +826,20 @@
|
||||
}
|
||||
});
|
||||
|
||||
// ── 11번가 원본 데이터 확인 — 후보 조회 주소별 동작 여부·항목 합계 ──
|
||||
// ── 쇼핑몰 원본 데이터 확인(네이버·11번가) — 조회 주소별 동작 여부·항목 합계, 네이버는 날짜별 현재 규칙 매출 ──
|
||||
const probe = document.getElementById("perf-probe");
|
||||
if (probe) probe.addEventListener("click", async function () {
|
||||
const day = document.getElementById("perf-probe-date").value;
|
||||
const out = document.getElementById("perf-probe-result");
|
||||
if (!day) return;
|
||||
probe.disabled = true;
|
||||
out.innerHTML = '<p class="perf-muted">11번가에서 불러오는 중… (주소 10개 × 7일 단위, 기간이 길면 1분 이상)</p>';
|
||||
const codeSel = document.getElementById("perf-probe-code");
|
||||
const code = codeSel ? codeSel.value : "elevenst";
|
||||
out.innerHTML = '<p class="perf-muted">' + (code === "naver" ? "네이버에서 불러오는 중… (하루씩, 기간이 길면 수십 초)"
|
||||
: "11번가에서 불러오는 중… (주소 10개 × 7일 단위, 기간이 길면 1분 이상)") + "</p>";
|
||||
try {
|
||||
const to = document.getElementById("perf-probe-to").value || day;
|
||||
const r = await api("GET", "/performance/api/marketplaces/" + probe.dataset.code + "/reconcile?date=" + encodeURIComponent(day) +
|
||||
const r = await api("GET", "/performance/api/marketplaces/" + code + "/reconcile?date=" + encodeURIComponent(day) +
|
||||
"&to=" + encodeURIComponent(to));
|
||||
if (!r.ok) { out.innerHTML = '<p class="perf-notice is-warn">' + esc((r.label ? r.label + " — " : "") + r.message) + "</p>"; return; }
|
||||
const summary = '<table class="perf-table" style="margin-top:8px"><thead><tr><th class="perf-th-label">조회</th>' +
|
||||
@@ -855,7 +858,17 @@
|
||||
(f.sum == null ? "" : fmt(f.sum)) + "</td><td>" + (f.personal ? '<span class="perf-muted">개인정보(숨김)</span>' : esc(f.sample)) + "</td></tr>";
|
||||
}).join("") + "</tbody></table>";
|
||||
}).join("");
|
||||
out.innerHTML = summary + (details || '<p class="perf-muted" style="margin-top:8px">그날 조회된 주문이 없습니다. 셀러오피스에서 매출이 있던 날로 다시 해 보세요.</p>');
|
||||
// 날짜별 현재 규칙 매출(네이버) — 쇼핑몰 관리자 화면 매출과 나란히 비교
|
||||
const days = (r.days || []).length ? '<h4 class="perf-h" style="margin:14px 0 6px">날짜별 현재 규칙 매출</h4>' +
|
||||
(r.rule ? '<p class="perf-muted">규칙: ' + esc(r.rule) + "</p>" : "") +
|
||||
'<table class="perf-table"><thead><tr><th class="perf-th-label">결제일</th><th>주문 수</th><th>매출</th></tr></thead><tbody>' +
|
||||
r.days.map(function (d) {
|
||||
return '<tr><td class="perf-td-label">' + esc(d.date) + '</td><td class="perf-num">' + fmt(d.orders) +
|
||||
'</td><td class="perf-num">' + fmt(d.amount) + "</td></tr>";
|
||||
}).join("") + '<tr><td class="perf-td-label"><b>합계</b></td><td class="perf-num"><b>' +
|
||||
fmt(r.days.reduce(function (a, d) { return a + d.orders; }, 0)) + '</b></td><td class="perf-num"><b>' +
|
||||
fmt(r.days.reduce(function (a, d) { return a + d.amount; }, 0)) + "</b></td></tr></tbody></table>" : "";
|
||||
out.innerHTML = summary + days + (details || '<p class="perf-muted" style="margin-top:8px">그 기간에 조회된 주문이 없습니다. 쇼핑몰 관리자 화면에서 매출이 있던 날로 다시 해 보세요.</p>');
|
||||
} catch (err) {
|
||||
out.innerHTML = '<p class="perf-notice is-warn">' + esc(err.message) + "</p>";
|
||||
} finally { probe.disabled = false; }
|
||||
|
||||
Reference in New Issue
Block a user