feat(performance): 카페24 대조에 원본 금액 필드 합계 진단 + 이상 주문 목록

품목 상품추가할인(additional_discount_price)을 빼도록 바꿨는데도 일별 비교
결과가 그대로(+62, +260 …)라, 카페24 상품구매금액과의 차이가 어느 원본 필드에
있는지 추측하지 않고 찾기 위해:

- reconcile 결과에 diag: 그날 결제 주문 전체의 금액성 숫자 필드 합계
  (initial_order_amount / actual_order_amount / items / 주문 최상위). 이름에
  price·amount·discount·point·fee 등이 들어간 필드만 — 계좌·연락처 제외
- odd_orders: 상품금액이 100원 단위가 아니거나 판매가×수량 합과 다른 주문(최대 60건)
  + 품목의 0 아닌 금액 필드
- 화면: 판매가 합계 − 카페24 상품구매금액 = 찾는 금액, 같은 값 필드 강조
- performance.js 캐시 버전 올림(이전 커밋에서 빠짐)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-29 21:49:12 +09:00
parent 6f43f8066a
commit 20d19792dd
5 changed files with 104 additions and 2 deletions
+31
View File
@@ -658,6 +658,37 @@
}).join("");
})() + "</tbody></table>"
: "") +
(r.diag
? (function () {
// 판매가 합계 − 카페24 상품구매금액 = 찾는 금액(예: 9/23 → 62). 같은 값인 필드를 강조.
const gap = shopCols ? (s.order_price_amount + m.order_price_amount) - shopCols[2] : null;
const PART = { initial: "주문 금액(결제 당시 initial_order_amount)", actual: "주문 금액(현재 actual_order_amount)",
item: "품목(items) 합계", order: "주문 최상위 필드" };
const cells = ["initial", "actual", "item", "order"].map(function (p) {
const f = r.diag[p] || {};
const keys = Object.keys(f).filter(function (k) { return f[k]; });
return '<div><h5 class="perf-h" style="margin:6px 0">' + esc(PART[p]) + "</h5>" +
(keys.length ? '<table class="perf-table"><tbody>' + keys.map(function (k) {
return "<tr" + (gap && f[k] === gap ? ' class="perf-row-match"' : "") + '><td class="perf-td-label">' + esc(k) +
'</td><td class="perf-num">' + fmt(f[k]) + "</td></tr>";
}).join("") + "</tbody></table>" : '<p class="perf-muted">0 아닌 값 없음</p>') + "</div>";
}).join("");
const odd = (r.odd_orders || []).map(function (o) {
return '<tr><td class="perf-td-label">' + esc(o.order_id) + "</td><td>" + esc(o.channel || "–") + '</td><td class="perf-num">' +
fmt(o.items_gross) + '</td><td class="perf-num">' + fmt(o.order_price_amount) + '</td><td class="perf-num">' + fmt(o.total) +
'</td><td style="white-space:normal;font-size:11.5px">' + o.items.map(function (i) {
return esc(i.code + " " + i.status + " ×" + i.quantity + " — " +
Object.keys(i.fields).map(function (k) { return k + "=" + fmt(i.fields[k]); }).join(", "));
}).join("<br>") + "</td></tr>";
}).join("");
return '<h4 class="perf-h" style="margin:14px 0 6px">원본 금액 필드 합계 (진단 — 그날 결제 주문 전체)' +
(gap ? ' · 판매가 합계 − 카페24 상품구매금액 = <b>' + fmt(gap) + "</b> (같은 값 강조)" : "") + "</h4>" +
'<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:10px">' + cells + "</div>" +
(odd ? '<h4 class="perf-h" style="margin:14px 0 6px">상품금액이 100원 단위가 아니거나 판매가×수량 합과 다른 주문</h4>' +
'<table class="perf-table"><thead><tr><th class="perf-th-label">주문번호</th><th class="perf-th-label">채널</th><th>판매가×수량</th>' +
'<th>주문 상품금액</th><th>결제합계(계산)</th><th class="perf-th-label">품목 금액 필드(0 제외)</th></tr></thead><tbody>' + odd + "</tbody></table>" : "");
})()
: "") +
'<p class="perf-foot perf-muted">' + esc(r.formula) + ". 미결제 주문 " + fmt(r.unpaid_orders) +
"건 제외. \"알 수 없는 채널\"은 카페24 열에 넣습니다 — 외부 마켓이면 어느 쇼핑몰인지 알려 주세요.</p>";
const target = document.getElementById("perf-recon-target");