统一时间格式和时区

This commit is contained in:
yml2213
2026-07-31 12:57:17 +08:00
parent 667bfbde06
commit 949a0eb8f7
24 changed files with 342 additions and 49 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ const deliveryLinkResponseExample = `{
"data": {
"order_no": "FO20260730000123",
"delivery_url": "https://shop.example/delivery/dlc/FO20260730000123?exp=1753934400&sign=...",
"expires_at": "2026-07-31T12:00:00Z",
"expires_at": "2026-07-31T12:00:00+08:00",
"exp": 1753934400,
"sign": "..."
}
+2 -6
View File
@@ -21,9 +21,9 @@ import {
QrcodeOutlined,
SendOutlined,
} from '@ant-design/icons'
import dayjs from 'dayjs'
import { deliveryApi } from '../api'
import type { DeliveryBindResult, DeliveryOrderInfo, DeliverySubmitResult } from '../types'
import { formatDateTime } from '../utils/time'
const statusMap: Record<string, { color: string; text: string }> = {
paid: { color: 'orange', text: '待发货' },
@@ -150,7 +150,7 @@ export default function Delivery() {
<Descriptions column={{ xs: 1, sm: 2 }} size="small" bordered>
<Descriptions.Item label="买家">{order.buyer_name || '-'}</Descriptions.Item>
<Descriptions.Item label="金额">{order.amount} </Descriptions.Item>
<Descriptions.Item label="创建时间">{formatTime(order.created_at)}</Descriptions.Item>
<Descriptions.Item label="创建时间">{formatDateTime(order.created_at)}</Descriptions.Item>
<Descriptions.Item label="渠道">{order.product?.game || channel.toUpperCase()}</Descriptions.Item>
</Descriptions>
@@ -253,10 +253,6 @@ function CenteredShell({ children }: { children: ReactNode }) {
)
}
function formatTime(value?: string | null) {
return value ? dayjs(value).format('YYYY-MM-DD HH:mm') : '-'
}
const panelStyle: CSSProperties = {
background: '#fff',
border: '1px solid #e5e7eb',
+7 -11
View File
@@ -23,8 +23,8 @@ import {
WalletOutlined,
} from '@ant-design/icons'
import type { ColumnsType } from 'antd/es/table'
import dayjs from 'dayjs'
import { merchantApi } from '../api'
import { formatDateTime } from '../utils/time'
import type {
ApiClient,
ApiCredential,
@@ -473,9 +473,9 @@ export default function MerchantCenter() {
title: '链接有效期',
dataIndex: 'delivery_link_expires_at',
width: 160,
render: (_, record) => record.delivery_link_revoked_at ? <Tag color="red"></Tag> : formatTime(record.delivery_link_expires_at),
render: (_, record) => record.delivery_link_revoked_at ? <Tag color="red"></Tag> : formatDateTime(record.delivery_link_expires_at),
},
{ title: '时间', dataIndex: 'created_at', width: 160, render: formatTime },
{ title: '时间', dataIndex: 'created_at', width: 180, render: formatDateTime },
{
title: '发货链接',
key: 'delivery_link',
@@ -499,7 +499,7 @@ export default function MerchantCenter() {
{ title: '余额', dataIndex: 'balance_after', width: 110, render: money },
{ title: '关联单号', dataIndex: 'reference_no', ellipsis: true },
{ title: '备注', dataIndex: 'note', ellipsis: true, render: (v) => v || '-' },
{ title: '时间', dataIndex: 'created_at', width: 160, render: formatTime },
{ title: '时间', dataIndex: 'created_at', width: 180, render: formatDateTime },
]
const apiClientColumns: ColumnsType<ApiClient> = [
@@ -508,7 +508,7 @@ export default function MerchantCenter() {
{ title: '签名', dataIndex: 'signature_version', width: 110, render: (v) => <Tag>{v}</Tag> },
{ title: '权限', dataIndex: 'scopes', ellipsis: true },
{ title: '状态', dataIndex: 'status', width: 90, render: activeStatusTag },
{ title: '最后使用', dataIndex: 'last_used_at', width: 160, render: formatTime },
{ title: '最后使用', dataIndex: 'last_used_at', width: 180, render: formatDateTime },
{
title: '操作',
key: 'action',
@@ -526,7 +526,7 @@ export default function MerchantCenter() {
{ title: 'URL', dataIndex: 'url', ellipsis: true },
{ title: '事件', dataIndex: 'events', width: 260, ellipsis: true },
{ title: '状态', dataIndex: 'status', width: 90, render: activeStatusTag },
{ title: '创建时间', dataIndex: 'created_at', width: 160, render: formatTime },
{ title: '创建时间', dataIndex: 'created_at', width: 180, render: formatDateTime },
{
title: '操作',
key: 'action',
@@ -824,7 +824,7 @@ export default function MerchantCenter() {
</Tag>
</Descriptions.Item>
<Descriptions.Item label="链接有效期">
{testOrderResult.order.delivery_link_revoked_at ? <Tag color="red"></Tag> : formatTime(testOrderResult.order.delivery_link_expires_at)}
{testOrderResult.order.delivery_link_revoked_at ? <Tag color="red"></Tag> : formatDateTime(testOrderResult.order.delivery_link_expires_at)}
</Descriptions.Item>
<Descriptions.Item label="链接状态">
<Typography.Text type="secondary"></Typography.Text>
@@ -969,10 +969,6 @@ function moneyWithSign(value?: number | null) {
return `${prefix}${money(amount)}`
}
function formatTime(value?: string | null) {
return value ? dayjs(value).format('YYYY-MM-DD HH:mm') : '-'
}
function productStatusTag(value: string) {
return value === 'active' ? <Tag color="green"></Tag> : <Tag></Tag>
}
+3
View File
@@ -134,6 +134,9 @@ function OverviewTab() {
<Text code>X-App-Key</Text><Text code>X-Timestamp</Text><Text code>X-Nonce</Text><Text code>X-Sign</Text>
</Descriptions.Item>
<Descriptions.Item label="时间偏差"> ±300 </Descriptions.Item>
<Descriptions.Item label="时间格式">
RFC3339 <Text code>2026-07-30T17:53:58+08:00</Text>
</Descriptions.Item>
<Descriptions.Item label="请求体">POST 使 <Text code>application/json</Text></Descriptions.Item>
</Descriptions>
</Card>
+2 -2
View File
@@ -16,10 +16,10 @@ import {
} from 'antd'
import { GiftOutlined, PlusOutlined, ReloadOutlined, TeamOutlined } from '@ant-design/icons'
import type { ColumnsType } from 'antd/es/table'
import dayjs from 'dayjs'
import { useNavigate } from 'react-router-dom'
import { platformApi } from '../api'
import type { Merchant, MerchantMember, PageResult, ProductCatalogItem } from '../types'
import { formatDateTime } from '../utils/time'
const memberRoleOptions = [
{ value: 'owner', label: '负责人' },
@@ -195,7 +195,7 @@ export default function PlatformMerchants() {
),
},
{ title: '状态', dataIndex: 'status', width: 90, render: (v) => v === 'active' ? <Tag color="green"></Tag> : <Tag></Tag> },
{ title: '创建时间', dataIndex: 'created_at', width: 160, render: (v) => dayjs(v).format('YYYY-MM-DD HH:mm') },
{ title: '创建时间', dataIndex: 'created_at', width: 180, render: formatDateTime },
{
title: '操作',
key: 'action',
+5
View File
@@ -0,0 +1,5 @@
import dayjs from 'dayjs'
export function formatDateTime(value?: string | null) {
return value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '-'
}