From 98b3dc4b16db3e9c692cdefa960a619af8da04f1 Mon Sep 17 00:00:00 2001 From: yml Date: Fri, 20 Nov 2026 00:48:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E6=B1=A0=E4=B8=8E=E6=8A=A2=E8=B4=AD=E9=93=BE=E8=B7=AF=EF=BC=8C?= =?UTF-8?q?=E5=8F=91=E5=B8=83=200.5.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/account/AccountTable.vue | 24 +- .../src/components/console/ControlStrip.vue | 6 +- .../components/exchange/ExchangeRecords.vue | 12 +- .../src/components/layout/RightConsole.vue | 105 +++- .../src/components/modal/SettingsModal.vue | 203 ++++++- frontend/src/composables/useSettings.ts | 6 + frontend/src/utils/formatTime.ts | 36 ++ internal/app/app.go | 127 ++++- internal/app/app_activity.go | 6 + internal/app/app_products.go | 16 +- internal/app/app_proxy.go | 89 ++- internal/app/app_proxy_test.go | 79 +++ internal/app/app_seckill.go | 17 +- internal/app/app_startup_test.go | 16 + internal/client/client.go | 98 +++- internal/client/client_test.go | 56 ++ internal/client/proxy_health.go | 81 +++ internal/client/proxy_health_test.go | 52 ++ internal/config/config.go | 31 +- internal/config/config_test.go | 27 + internal/constants/constants.go | 26 +- internal/seckill/attempt.go | 12 +- internal/seckill/proxy_groups.go | 517 ++++++++++++++++-- internal/seckill/proxy_groups_test.go | 57 +- internal/seckill/scheduler.go | 13 +- internal/seckill/scheduler_test.go | 8 +- internal/types/types.go | 2 + wails.json | 4 +- 28 files changed, 1522 insertions(+), 204 deletions(-) create mode 100644 frontend/src/utils/formatTime.ts create mode 100644 internal/app/app_proxy_test.go create mode 100644 internal/app/app_startup_test.go create mode 100644 internal/client/proxy_health.go create mode 100644 internal/client/proxy_health_test.go diff --git a/frontend/src/components/account/AccountTable.vue b/frontend/src/components/account/AccountTable.vue index 23b96c3..bcaeace 100644 --- a/frontend/src/components/account/AccountTable.vue +++ b/frontend/src/components/account/AccountTable.vue @@ -6,6 +6,7 @@ import { useProducts } from '@/composables/useProducts' import type { Product } from '@/composables/useProducts' import { useActivity } from '@/composables/useActivity' import { useToast } from '@/composables/useToast' +import { formatExchangeTime, formatShortExchangeTime } from '@/utils/formatTime' import { ExportLatestXiaodianReport, QueryExchangeRecords, @@ -242,23 +243,10 @@ const recordSummary = (accountName: string) => { if (!records.length) return '' const latest = records[0] const name = latest.commodityName || latest.commodityId || '-' - const time = formatShortTime(latest.time || latest.buyTime || '') + const time = formatShortExchangeTime(latest.time || latest.buyTime || '') return time ? `${name} · ${time}` : name } -const formatShortTime = (value: string) => { - if (!value) return '' - const text = String(value) - const match = text.match(/(\d{2})[-/](\d{2})\s+(\d{2}:\d{2})/) - if (match) return `${match[1]}-${match[2]} ${match[3]}` - const numeric = Number(text) - if (Number.isFinite(numeric) && numeric > 0) { - const date = new Date(numeric < 10_000_000_000 ? numeric * 1000 : numeric) - return `${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}` - } - return text.replace('T', ' ').slice(0, 16) -} - const getLookupResult = (accountName: string) => exchangeLookup.value?.results[accountName] const getMatchedRecord = (accountName: string) => { @@ -304,8 +292,6 @@ const getResultMessage = (name: string) => { return msg.length > 46 ? msg.slice(0, 46) + '...' : msg } -const formatTime = (value: string) => value ? value.replace('T', ' ') : '-' - const orderStatus = (status: string) => { const labels: Record = { '0': { text: '待支付', cls: 'order-pending' }, @@ -619,7 +605,7 @@ const closeExchangeRecords = () => { ×{{ record.exchangeNum || 1 }} - {{ formatTime(record.time) }} + {{ formatExchangeTime(record.time) }} {{ record.score || '-' }} {{ record.nickName || '-' }} @@ -632,8 +618,8 @@ const closeExchangeRecords = () => {
{{ record.commodityName || record.commodityId }}
- {{ formatTime(record.buyTime) }} - {{ formatTime(record.payTime) }} + {{ formatExchangeTime(record.buyTime) }} + {{ formatExchangeTime(record.payTime) }} {{ record.price }} {{ orderStatus(record.status).text }} {{ record.roleName || '-' }} diff --git a/frontend/src/components/console/ControlStrip.vue b/frontend/src/components/console/ControlStrip.vue index f5ab22e..e276b42 100644 --- a/frontend/src/components/console/ControlStrip.vue +++ b/frontend/src/components/console/ControlStrip.vue @@ -400,7 +400,7 @@ onUnmounted(() => { -
+
@@ -469,8 +469,8 @@ onUnmounted(() => {
- -
+ +
{ } } -const formatTime = (value: string) => { - if (!value) return '-' - const numeric = Number(value) - if (Number.isFinite(numeric) && numeric > 0) { - return new Date(numeric < 10_000_000_000 ? numeric * 1000 : numeric).toLocaleString('zh-CN') - } - return value.replace('T', ' ') -} - watch(selectedProductId, () => { queryResult.value = null }) @@ -133,7 +125,7 @@ watch(selectedProductId, () => {
{{ record.commodityName || record.commodityId }} ×{{ record.quantity || 1 }} - {{ formatTime(record.buyTime) }} + {{ formatExchangeTime(record.buyTime) }} 状态 {{ record.status || '-' }}
diff --git a/frontend/src/components/layout/RightConsole.vue b/frontend/src/components/layout/RightConsole.vue index 217e6ed..dd3d127 100644 --- a/frontend/src/components/layout/RightConsole.vue +++ b/frontend/src/components/layout/RightConsole.vue @@ -1,7 +1,8 @@