feat(web): 请求时间改为 ISO8601+08:00 偏移,响应仍为 Unix 秒
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
||||
type RangeValue,
|
||||
} from "@/composables/use-live-time-range.ts";
|
||||
import { useAdminOverview, useEngine, usePayments } from "@/queries/admin.ts";
|
||||
import { formatMinute } from "@/utils/time.ts";
|
||||
import { formatMinute, toRequestIso } from "@/utils/time.ts";
|
||||
import { formatInt } from "@/utils/format.ts";
|
||||
|
||||
const router = useRouter();
|
||||
@@ -40,10 +40,10 @@ const extraPresets = computed(() => {
|
||||
.filter((p) => p.kind === "subscription" && p.period_start != null)
|
||||
.map((p) => ({
|
||||
label: `订阅 #${p.subscription_id ?? p.id} 期间`,
|
||||
from: new Date((p.period_start ?? 0) * 1000).toISOString(),
|
||||
to: new Date(
|
||||
(p.period_end ?? Math.floor(Date.now() / 1000)) * 1000,
|
||||
).toISOString(),
|
||||
from: toRequestIso(new Date((p.period_start ?? 0) * 1000)),
|
||||
to: toRequestIso(
|
||||
new Date((p.period_end ?? Math.floor(Date.now() / 1000)) * 1000),
|
||||
),
|
||||
}))
|
||||
.slice(0, 4);
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ import PageHeader from "@/components/common/page-header.vue";
|
||||
import PaymentFormModal from "@/components/admin/payment-form-modal.vue";
|
||||
import QuotaText from "@/components/common/quota-text.vue";
|
||||
import { useDeletePayment, usePayments } from "@/queries/admin.ts";
|
||||
import { formatDate, formatDateTime } from "@/utils/time.ts";
|
||||
import { formatDateTime, toRequestIso } from "@/utils/time.ts";
|
||||
import { formatPaidAmount } from "@/utils/format.ts";
|
||||
|
||||
const paymentsQuery = usePayments();
|
||||
@@ -40,8 +40,8 @@ const columns = [
|
||||
|
||||
function timeText(p: PaymentItem): string {
|
||||
if (p.kind === "topup") return formatDateTime(p.paid_at);
|
||||
const start = formatDate(p.period_start);
|
||||
const end = p.period_end == null ? "进行中" : formatDate(p.period_end);
|
||||
const start = formatDateTime(p.period_start);
|
||||
const end = p.period_end == null ? "进行中" : formatDateTime(p.period_end);
|
||||
return `${start} ~ ${end}`;
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ async function reconcile(pays: PaymentItem[]) {
|
||||
pays.map((p) => p.subscription_id).filter((v): v is number => v != null),
|
||||
);
|
||||
const earliest = Math.min(...pays.map((p) => p.paid_at ?? 0), Date.now() / 1000);
|
||||
const from = new Date((earliest - 30 * 86400) * 1000).toISOString();
|
||||
const to = new Date().toISOString();
|
||||
const from = toRequestIso(new Date((earliest - 30 * 86400) * 1000));
|
||||
const to = toRequestIso(new Date());
|
||||
const observed = new Set<number>();
|
||||
let page = 1;
|
||||
for (;;) {
|
||||
|
||||
Reference in New Issue
Block a user