import { defineComponent, ref, computed, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrRenderList, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrInterpolate, ssrRenderStyle, ssrRenderClass } from 'vue/server-renderer'; import { u as useApi } from './useApi-B-E5eLsI.mjs'; import { u as useToast } from './useToast-CS21XT61.mjs'; import { _ as _export_sfc } from './server.mjs'; import './useLoading-D4zrSa2m.mjs'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'pinia'; import 'perfect-debounce'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "statlog", __ssrInlineRender: true, setup(__props) { useApi(); useToast(); const REGION_NAMES = { cn: "中国", us: "美国", ea: "东亚", sea: "东南亚", sa: "南亚", me: "中东", eu: "欧洲", ru: "俄罗斯", af: "非洲", sam: "南美", nam: "北美", oc: "大洋洲", br: "巴西", in: "印度" }; function regionName(c) { return c ? REGION_NAMES[c] || c : "-"; } const all = ref([]); const loading = ref(false); const loadError = ref(""); const statTotal = ref("-"); const statLast = ref("-"); const statTip = ref(""); const fDay = ref(0); const fLevel = ref(""); const fKw = ref(""); const fAuto = ref(false); function shYmd(offsetDays = 0) { const d = new Date(Date.now() + offsetDays * 864e5); const s = new Intl.DateTimeFormat("en-CA", { timeZone: "Asia/Shanghai", year: "numeric", month: "2-digit", day: "2-digit" }).format(d); return parseInt(s.replace(/-/g, ""), 10); } function fmtDay(yyyymmdd) { const s = "" + yyyymmdd; return s.length === 8 ? s.slice(0, 4) + "-" + s.slice(4, 6) + "-" + s.slice(6, 8) : s; } function fmtTime(ts) { if (!ts) return "--"; const d = new Date(ts * 1e3); const p = (n) => n < 10 ? "0" + n : "" + n; return p(d.getHours()) + ":" + p(d.getMinutes()) + ":" + p(d.getSeconds()); } function fmtProduct(pid) { return pid ? "0x" + (pid >>> 0).toString(16).toUpperCase() : "全部"; } const dayOptions = computed(() => [ { value: shYmd(0), label: "今天 " + fmtDay(shYmd(0)) }, { value: shYmd(-1), label: "昨天 " + fmtDay(shYmd(-1)) } ]); function levelInfo(level) { if (level === "error") return { cls: "lv-error", txt: "解析失败" }; if (level === "warn") return { cls: "lv-warn", txt: "未落库" }; return { cls: "lv-info", txt: "已落库" }; } function isLate(e) { return !!(e.snap_ts && e.ts && e.ts - e.snap_ts > 120); } const filteredRows = computed(() => { const level = fLevel.value; const kw = fKw.value.trim().toLowerCase(); return all.value.filter((e) => { if (level && e.level !== level) return false; if (kw) { const hay = ((e.app || "") + " " + (e.region || "") + " " + regionName(e.region) + " " + (e.product_id || "") + " " + fmtProduct(e.product_id) + " " + (e.stat_day || "")).toLowerCase(); if (hay.indexOf(kw) < 0) return false; } return true; }); }); return (_ctx, _push, _parent, _attrs) => { _push(`
console 从 NATS 收到的「当日统计快照」接收流水(最新在前,按接收时间分天存 Redis)。各业务部署每个同步周期/启动时/0点 推送一次当日绝对快照,console 收到后覆盖落库。用于核对每个部署是否在正常汇报;带 未注册 的应用快照已收到但不会落库(应用名需与 console 注册表完全一致)。