统一时间格式和时区
This commit is contained in:
@@ -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": "..."
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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') : '-'
|
||||
}
|
||||
Reference in New Issue
Block a user