v0.1.0: 新增CK管理功能
功能: - 新增CK管理页面,支持复验抢购结果和整理账号文件 - 复验功能:查询斗鱼真实兑换记录,统计已抢到/未抢到的账号 - 整理CK功能:分离已抢到的账号到新文件,原文件只保留未抢到的 - 导出文件名优化:使用中文商品名+日期时间格式(如:user_已抢到_雪国2号_20260626_150405.txt) - 复用左侧商品选择,统一数据源 接口: - VerifyAndExport: 复验并统计 - ExportAccountsWithProduct: 导出账号(自动命名) - OrganizeAccounts: 整理账号文件 版本: 0.1.0
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -286,6 +290,247 @@ func (a *App) VerifyAllExchange() map[string]any {
|
||||
return results
|
||||
}
|
||||
|
||||
// VerifyAndExport 复验并导出结果。
|
||||
func (a *App) VerifyAndExport(commodityID string) map[string]any {
|
||||
accounts := a.scheduler.AccountSnapshot()
|
||||
results := make(map[string]any)
|
||||
hitAccounts := make([]string, 0)
|
||||
missAccounts := make([]string, 0)
|
||||
|
||||
for i, account := range accounts {
|
||||
if i > 0 {
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
}
|
||||
|
||||
if account.Cookie == "" {
|
||||
missAccounts = append(missAccounts, account.Name)
|
||||
results[account.Name] = map[string]any{
|
||||
"success": false,
|
||||
"error": "Cookie 为空",
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
records, err := a.client.ExchangeList(account.Cookie)
|
||||
if err != nil {
|
||||
missAccounts = append(missAccounts, account.Name)
|
||||
results[account.Name] = map[string]any{
|
||||
"success": false,
|
||||
"error": "查询失败: " + err.Error(),
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// 检查是否抢到了指定商品
|
||||
hit := false
|
||||
for _, r := range records {
|
||||
if r.CommodityID == commodityID {
|
||||
hit = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if hit {
|
||||
hitAccounts = append(hitAccounts, account.Name)
|
||||
results[account.Name] = map[string]any{
|
||||
"success": true,
|
||||
"hit": true,
|
||||
}
|
||||
} else {
|
||||
missAccounts = append(missAccounts, account.Name)
|
||||
results[account.Name] = map[string]any{
|
||||
"success": true,
|
||||
"hit": false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"success": true,
|
||||
"hitCount": len(hitAccounts),
|
||||
"missCount": len(missAccounts),
|
||||
"hitAccounts": hitAccounts,
|
||||
"missAccounts": missAccounts,
|
||||
"details": results,
|
||||
}
|
||||
}
|
||||
|
||||
// ExportAccounts 导出指定账号到文件。
|
||||
func (a *App) ExportAccounts(accountNames []string, filename string) map[string]any {
|
||||
if len(accountNames) == 0 {
|
||||
return map[string]any{"success": false, "error": "没有要导出的账号"}
|
||||
}
|
||||
|
||||
// 读取原账号文件
|
||||
accountFile := a.scheduler.AccountFilePath()
|
||||
lines, err := os.ReadFile(accountFile)
|
||||
if err != nil {
|
||||
return map[string]any{"success": false, "error": "读取账号文件失败: " + err.Error()}
|
||||
}
|
||||
|
||||
// 解析账号行
|
||||
nameSet := make(map[string]bool)
|
||||
for _, name := range accountNames {
|
||||
nameSet[name] = true
|
||||
}
|
||||
|
||||
var matchedLines []string
|
||||
scanner := bufio.NewScanner(strings.NewReader(string(lines)))
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
trimmed := strings.TrimSpace(line)
|
||||
if trimmed == "" || strings.HasPrefix(trimmed, "#") {
|
||||
continue
|
||||
}
|
||||
parts := strings.SplitN(trimmed, "----", 3)
|
||||
if len(parts) >= 1 {
|
||||
name := strings.TrimSpace(parts[0])
|
||||
if nameSet[name] {
|
||||
matchedLines = append(matchedLines, line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(matchedLines) == 0 {
|
||||
return map[string]any{"success": false, "error": "没有找到匹配的账号行"}
|
||||
}
|
||||
|
||||
// 生成导出文件路径
|
||||
exportPath := filepath.Join(filepath.Dir(accountFile), filename)
|
||||
content := strings.Join(matchedLines, "\n") + "\n"
|
||||
|
||||
if err := os.WriteFile(exportPath, []byte(content), 0644); err != nil {
|
||||
return map[string]any{"success": false, "error": "写入文件失败: " + err.Error()}
|
||||
}
|
||||
|
||||
logger.LogEvent("导出", "success", "已导出 %d 个账号到: %s", len(matchedLines), exportPath)
|
||||
|
||||
return map[string]any{
|
||||
"success": true,
|
||||
"count": len(matchedLines),
|
||||
"filePath": exportPath,
|
||||
}
|
||||
}
|
||||
|
||||
// ExportAccountsWithProduct 导出指定账号到文件,自动使用中文商品名和时间戳命名。
|
||||
func (a *App) ExportAccountsWithProduct(accountNames []string, commodityID, commodityName string) map[string]any {
|
||||
// 生成文件名: user_已抢到_商品中文名_20260626_150405.txt
|
||||
now := time.Now()
|
||||
timestamp := now.Format("20060102_150405")
|
||||
// 清理商品名中的特殊字符
|
||||
safeName := strings.ReplaceAll(commodityName, "/", "_")
|
||||
safeName = strings.ReplaceAll(safeName, "\\", "_")
|
||||
safeName = strings.ReplaceAll(safeName, ":", "_")
|
||||
safeName = strings.ReplaceAll(safeName, "*", "_")
|
||||
safeName = strings.ReplaceAll(safeName, "?", "_")
|
||||
safeName = strings.ReplaceAll(safeName, "\"", "_")
|
||||
safeName = strings.ReplaceAll(safeName, "<", "_")
|
||||
safeName = strings.ReplaceAll(safeName, ">", "_")
|
||||
safeName = strings.ReplaceAll(safeName, "|", "_")
|
||||
filename := fmt.Sprintf("user_已抢到_%s_%s.txt", safeName, timestamp)
|
||||
|
||||
return a.ExportAccounts(accountNames, filename)
|
||||
}
|
||||
|
||||
// OrganizeAccounts 整理账号,把已抢到指定商品的账号分离出来。
|
||||
func (a *App) OrganizeAccounts(commodityID, commodityName string, startTime, endTime int64) map[string]any {
|
||||
accounts := a.scheduler.AccountSnapshot()
|
||||
hitAccounts := make([]string, 0)
|
||||
missAccounts := make([]string, 0)
|
||||
|
||||
for i, account := range accounts {
|
||||
if i > 0 {
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
}
|
||||
|
||||
if account.Cookie == "" {
|
||||
missAccounts = append(missAccounts, account.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
records, err := a.client.ExchangeList(account.Cookie)
|
||||
if err != nil {
|
||||
missAccounts = append(missAccounts, account.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
// 检查是否在指定时间段内抢到了指定商品
|
||||
hit := false
|
||||
for _, r := range records {
|
||||
if r.CommodityID == commodityID {
|
||||
// 检查时间范围
|
||||
recordTime, _ := strconv.ParseInt(r.Time, 10, 64)
|
||||
if startTime == 0 || (recordTime >= startTime && recordTime <= endTime) {
|
||||
hit = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if hit {
|
||||
hitAccounts = append(hitAccounts, account.Name)
|
||||
} else {
|
||||
missAccounts = append(missAccounts, account.Name)
|
||||
}
|
||||
}
|
||||
|
||||
// 导出已抢到的账号
|
||||
var exportResult map[string]any
|
||||
if len(hitAccounts) > 0 {
|
||||
exportResult = a.ExportAccountsWithProduct(hitAccounts, commodityID, commodityName)
|
||||
}
|
||||
|
||||
// 更新原文件,只保留未抢到的
|
||||
accountFile := a.scheduler.AccountFilePath()
|
||||
lines, err := os.ReadFile(accountFile)
|
||||
if err != nil {
|
||||
return map[string]any{"success": false, "error": "读取账号文件失败: " + err.Error()}
|
||||
}
|
||||
|
||||
missSet := make(map[string]bool)
|
||||
for _, name := range missAccounts {
|
||||
missSet[name] = true
|
||||
}
|
||||
|
||||
var keepLines []string
|
||||
scanner := bufio.NewScanner(strings.NewReader(string(lines)))
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
trimmed := strings.TrimSpace(line)
|
||||
if trimmed == "" || strings.HasPrefix(trimmed, "#") {
|
||||
keepLines = append(keepLines, line)
|
||||
continue
|
||||
}
|
||||
parts := strings.SplitN(trimmed, "----", 3)
|
||||
if len(parts) >= 1 {
|
||||
name := strings.TrimSpace(parts[0])
|
||||
if missSet[name] {
|
||||
keepLines = append(keepLines, line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 写回原文件
|
||||
newContent := strings.Join(keepLines, "\n") + "\n"
|
||||
if err := os.WriteFile(accountFile, []byte(newContent), 0644); err != nil {
|
||||
return map[string]any{"success": false, "error": "更新账号文件失败: " + err.Error()}
|
||||
}
|
||||
|
||||
// 重新加载账号
|
||||
a.scheduler.LoadAccounts()
|
||||
|
||||
logger.LogEvent("整理", "success", "整理完成: 已抢到=%d, 未抢到=%d", len(hitAccounts), len(missAccounts))
|
||||
|
||||
return map[string]any{
|
||||
"success": true,
|
||||
"hitCount": len(hitAccounts),
|
||||
"missCount": len(missAccounts),
|
||||
"hitAccounts": hitAccounts,
|
||||
"missAccounts": missAccounts,
|
||||
"exportResult": exportResult,
|
||||
}
|
||||
}
|
||||
|
||||
// GetVersion 返回应用版本号。
|
||||
func (a *App) GetVersion() string {
|
||||
return constants.Version
|
||||
|
||||
@@ -0,0 +1,523 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { useProducts } from '@/composables/useProducts'
|
||||
import { useToast } from '@/composables/useToast'
|
||||
|
||||
const { selectedProductId, selectedProductName, selectedProduct } = useProducts()
|
||||
const { showToast } = useToast()
|
||||
|
||||
const App = window.go.main.App
|
||||
|
||||
// 状态
|
||||
const loading = ref(false)
|
||||
const verifyResult = ref<any>(null)
|
||||
const organizeResult = ref<any>(null)
|
||||
|
||||
// 时间范围(默认一年)
|
||||
const timeRange = ref<'year' | 'custom'>('year')
|
||||
const customStart = ref('')
|
||||
const customEnd = ref('')
|
||||
|
||||
// 计算时间戳
|
||||
const timeRangeMs = computed(() => {
|
||||
const now = Date.now()
|
||||
if (timeRange.value === 'year') {
|
||||
return {
|
||||
start: Math.floor((now - 365 * 24 * 60 * 60 * 1000) / 1000),
|
||||
end: Math.floor(now / 1000)
|
||||
}
|
||||
}
|
||||
return {
|
||||
start: customStart.value ? Math.floor(new Date(customStart.value).getTime() / 1000) : 0,
|
||||
end: customEnd.value ? Math.floor(new Date(customEnd.value).getTime() / 1000) : Math.floor(now / 1000)
|
||||
}
|
||||
})
|
||||
|
||||
// 复验
|
||||
const handleVerify = async () => {
|
||||
if (!selectedProductId.value) {
|
||||
showToast('提示', '请先在左侧选择商品', 'warn')
|
||||
return
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
const result = await App.VerifyAndExport(selectedProductId.value)
|
||||
verifyResult.value = result
|
||||
organizeResult.value = null
|
||||
|
||||
if (result.success) {
|
||||
showToast('复验完成', `已抢到: ${result.hitCount}, 未抢到: ${result.missCount}`, 'success')
|
||||
} else {
|
||||
showToast('复验失败', result.error, 'error')
|
||||
}
|
||||
} catch (e: any) {
|
||||
showToast('复验失败', e.message, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 导出已抢到的CK
|
||||
const exportHitAccounts = async () => {
|
||||
if (!verifyResult.value?.hitAccounts?.length || !selectedProductId.value) {
|
||||
showToast('提示', '没有可导出的账号', 'warn')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await App.ExportAccountsWithProduct(
|
||||
verifyResult.value.hitAccounts,
|
||||
selectedProductId.value,
|
||||
selectedProductName.value || ''
|
||||
)
|
||||
if (result.success) {
|
||||
showToast('导出成功', `已导出 ${result.count} 个账号到 ${result.filePath}`, 'success')
|
||||
} else {
|
||||
showToast('导出失败', result.error, 'error')
|
||||
}
|
||||
} catch (e: any) {
|
||||
showToast('导出失败', e.message, 'error')
|
||||
}
|
||||
}
|
||||
|
||||
// 整理CK
|
||||
const handleOrganize = async () => {
|
||||
if (!selectedProductId.value) {
|
||||
showToast('提示', '请先在左侧选择商品', 'warn')
|
||||
return
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
const { start, end } = timeRangeMs.value
|
||||
const result = await App.OrganizeAccounts(selectedProductId.value, selectedProductName.value, start, end)
|
||||
organizeResult.value = result
|
||||
verifyResult.value = null
|
||||
|
||||
if (result.success) {
|
||||
showToast('整理完成', `已抢到: ${result.hitCount}, 未抢到: ${result.missCount}`, 'success')
|
||||
} else {
|
||||
showToast('整理失败', result.error, 'error')
|
||||
}
|
||||
} catch (e: any) {
|
||||
showToast('整理失败', e.message, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="ck-manager">
|
||||
<div class="ck-header">
|
||||
<h2>CK 管理</h2>
|
||||
<p class="ck-desc">复验抢购结果、整理账号文件</p>
|
||||
</div>
|
||||
|
||||
<!-- 当前选中商品 -->
|
||||
<div class="ck-section">
|
||||
<div class="section-title">当前商品</div>
|
||||
<div class="selected-product">
|
||||
<template v-if="selectedProductId">
|
||||
<span class="product-name">{{ selectedProductName }}</span>
|
||||
<span class="product-meta">{{ selectedProduct?.score }}积分</span>
|
||||
</template>
|
||||
<span v-else class="product-empty">请在左侧商品列表中选择商品</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<div class="ck-actions">
|
||||
<button
|
||||
class="btn btn-primary"
|
||||
:disabled="loading || !selectedProductId"
|
||||
@click="handleVerify"
|
||||
>
|
||||
{{ loading ? '查询中...' : '🔍 复验抢购结果' }}
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-success"
|
||||
:disabled="loading || !selectedProductId"
|
||||
@click="handleOrganize"
|
||||
>
|
||||
{{ loading ? '整理中...' : '📋 整理CK' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 时间范围(整理CK时使用) -->
|
||||
<div class="ck-section">
|
||||
<div class="section-title">时间范围</div>
|
||||
<div class="time-range">
|
||||
<label class="radio-label">
|
||||
<input v-model="timeRange" type="radio" value="year">
|
||||
<span>最近一年(默认)</span>
|
||||
</label>
|
||||
<label class="radio-label">
|
||||
<input v-model="timeRange" type="radio" value="custom">
|
||||
<span>自定义</span>
|
||||
</label>
|
||||
</div>
|
||||
<div v-if="timeRange === 'custom'" class="custom-time">
|
||||
<input v-model="customStart" type="date" class="form-input" placeholder="开始日期">
|
||||
<span class="time-sep">至</span>
|
||||
<input v-model="customEnd" type="date" class="form-input" placeholder="结束日期">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 复验结果 -->
|
||||
<div v-if="verifyResult" class="ck-result">
|
||||
<div class="result-header">
|
||||
<span class="result-title">复验结果</span>
|
||||
<button
|
||||
v-if="verifyResult.hitAccounts?.length"
|
||||
class="btn btn-compact btn-export"
|
||||
@click="exportHitAccounts"
|
||||
>
|
||||
📥 导出已抢到CK
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="result-stats">
|
||||
<div class="stat-item stat-success">
|
||||
<span class="stat-label">已抢到</span>
|
||||
<span class="stat-value">{{ verifyResult.hitCount }}</span>
|
||||
</div>
|
||||
<div class="stat-item stat-fail">
|
||||
<span class="stat-label">未抢到</span>
|
||||
<span class="stat-value">{{ verifyResult.missCount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="verifyResult.hitAccounts?.length" class="account-list">
|
||||
<div class="list-title">已抢到的账号:</div>
|
||||
<div class="list-items">
|
||||
<span
|
||||
v-for="name in verifyResult.hitAccounts"
|
||||
:key="name"
|
||||
class="account-tag hit"
|
||||
>
|
||||
{{ name }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 整理结果 -->
|
||||
<div v-if="organizeResult" class="ck-result">
|
||||
<div class="result-header">
|
||||
<span class="result-title">整理结果</span>
|
||||
</div>
|
||||
|
||||
<div class="result-stats">
|
||||
<div class="stat-item stat-success">
|
||||
<span class="stat-label">已抢到</span>
|
||||
<span class="stat-value">{{ organizeResult.hitCount }}</span>
|
||||
</div>
|
||||
<div class="stat-item stat-fail">
|
||||
<span class="stat-label">未抢到</span>
|
||||
<span class="stat-value">{{ organizeResult.missCount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="result-info">
|
||||
<div v-if="organizeResult.hitCount > 0" class="info-item success">
|
||||
✅ 已抢到的账号已导出到新文件
|
||||
</div>
|
||||
<div class="info-item">
|
||||
📄 原文件已更新,只保留未抢到的账号
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.ck-manager {
|
||||
padding: 20px;
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
.ck-header {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.ck-header h2 {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: var(--text-strong);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.ck-desc {
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.ck-section {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--text-strong);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.selected-product {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 14px;
|
||||
background: var(--field);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-sm);
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
.selected-product.has-product {
|
||||
border-color: var(--accent-border);
|
||||
background: var(--accent-soft);
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-weight: 600;
|
||||
color: var(--text-strong);
|
||||
}
|
||||
|
||||
.product-meta {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.product-empty {
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
width: 100%;
|
||||
height: 36px;
|
||||
padding: 0 12px;
|
||||
background: var(--field);
|
||||
color: var(--text-strong);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.form-input:focus {
|
||||
outline: 0;
|
||||
border-color: var(--accent);
|
||||
box-shadow: var(--focus);
|
||||
}
|
||||
|
||||
.ck-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
height: 36px;
|
||||
padding: 0 16px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--surface-2);
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
transition: .12s;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
background: var(--surface-3);
|
||||
border-color: var(--line-strong);
|
||||
}
|
||||
|
||||
.btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
filter: brightness(1.08);
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
background: var(--success);
|
||||
border-color: var(--success);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-success:hover {
|
||||
filter: brightness(1.08);
|
||||
}
|
||||
|
||||
.btn-compact {
|
||||
height: 28px;
|
||||
font-size: 12px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.btn-export {
|
||||
background: var(--accent-soft);
|
||||
color: var(--accent);
|
||||
border-color: var(--accent-border);
|
||||
}
|
||||
|
||||
.btn-export:hover {
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.time-range {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.radio-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.radio-label input {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.custom-time {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.custom-time .form-input {
|
||||
width: auto;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.time-sep {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.ck-result {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
padding: 16px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.result-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.result-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text-strong);
|
||||
}
|
||||
|
||||
.result-stats {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 12px 20px;
|
||||
background: var(--field);
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--line);
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.stat-success .stat-value {
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
.stat-fail .stat-value {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.account-list {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.list-title {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.list-items {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.account-tag {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
background: var(--surface-2);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.account-tag.hit {
|
||||
background: var(--success-soft);
|
||||
color: var(--success);
|
||||
border-color: var(--success);
|
||||
}
|
||||
|
||||
.result-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
font-size: 13px;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.info-item.success {
|
||||
color: var(--success);
|
||||
}
|
||||
</style>
|
||||
@@ -7,6 +7,7 @@ import ControlStrip from '@/components/console/ControlStrip.vue'
|
||||
import AccountTable from '@/components/account/AccountTable.vue'
|
||||
import LogPanel from '@/components/log/LogPanel.vue'
|
||||
import SettingsModal from '@/components/modal/SettingsModal.vue'
|
||||
import CKManager from '@/components/ck/CKManager.vue'
|
||||
|
||||
defineProps<{
|
||||
serverTime: string
|
||||
@@ -16,6 +17,7 @@ const { theme, toggleTheme } = useTheme()
|
||||
const { runState, countdownSeconds, formatRemain } = useScheduler()
|
||||
|
||||
const settingsModalRef = ref<InstanceType<typeof SettingsModal> | null>(null)
|
||||
const currentPage = ref<'console' | 'ck'>('console')
|
||||
|
||||
const openSettings = () => {
|
||||
settingsModalRef.value?.open()
|
||||
@@ -27,11 +29,23 @@ const openSettings = () => {
|
||||
<!-- 顶部控制台头 -->
|
||||
<header class="console-head">
|
||||
<div class="headline">
|
||||
<div>
|
||||
<div class="headline-title">抢购控制台</div>
|
||||
<div class="headline-meta">{{ runState }}</div>
|
||||
<div class="nav-tabs">
|
||||
<button
|
||||
class="nav-tab"
|
||||
:class="{ active: currentPage === 'console' }"
|
||||
@click="currentPage = 'console'"
|
||||
>
|
||||
抢购控制台
|
||||
</button>
|
||||
<button
|
||||
class="nav-tab"
|
||||
:class="{ active: currentPage === 'ck' }"
|
||||
@click="currentPage = 'ck'"
|
||||
>
|
||||
CK 管理
|
||||
</button>
|
||||
</div>
|
||||
<span v-if="countdownSeconds > 0" class="countdown-badge">
|
||||
<span v-if="countdownSeconds > 0 && currentPage === 'console'" class="countdown-badge">
|
||||
{{ formatRemain(countdownSeconds) }}
|
||||
</span>
|
||||
</div>
|
||||
@@ -48,19 +62,29 @@ const openSettings = () => {
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 状态指标 -->
|
||||
<StatusGrid :server-time="serverTime" />
|
||||
<!-- 抢购控制台页面 -->
|
||||
<template v-if="currentPage === 'console'">
|
||||
<!-- 状态指标 -->
|
||||
<StatusGrid :server-time="serverTime" />
|
||||
|
||||
<!-- 操作条 -->
|
||||
<ControlStrip />
|
||||
<!-- 操作条 -->
|
||||
<ControlStrip />
|
||||
|
||||
<!-- 工作区 -->
|
||||
<section class="workspace">
|
||||
<AccountTable />
|
||||
<aside class="side-stack">
|
||||
<LogPanel />
|
||||
</aside>
|
||||
</section>
|
||||
<!-- 工作区 -->
|
||||
<section class="workspace">
|
||||
<AccountTable />
|
||||
<aside class="side-stack">
|
||||
<LogPanel />
|
||||
</aside>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<!-- CK管理页面 -->
|
||||
<template v-else-if="currentPage === 'ck'">
|
||||
<section class="ck-page">
|
||||
<CKManager />
|
||||
</section>
|
||||
</template>
|
||||
</main>
|
||||
|
||||
<SettingsModal ref="settingsModalRef" />
|
||||
@@ -99,6 +123,35 @@ const openSettings = () => {
|
||||
letter-spacing: -.01em;
|
||||
}
|
||||
|
||||
.nav-tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.nav-tab {
|
||||
height: 28px;
|
||||
padding: 0 12px;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
transition: .12s;
|
||||
}
|
||||
|
||||
.nav-tab:hover {
|
||||
color: var(--text-strong);
|
||||
background: var(--surface-2);
|
||||
}
|
||||
|
||||
.nav-tab.active {
|
||||
background: var(--accent-soft);
|
||||
color: var(--accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.headline-meta {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
@@ -143,6 +196,12 @@ const openSettings = () => {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.ck-page {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
.right {
|
||||
overflow: visible;
|
||||
|
||||
Vendored
+4
@@ -27,6 +27,10 @@ interface Window {
|
||||
SaveSettings: (cfg: any) => Promise<any>
|
||||
VerifyExchange: (accountName: string) => Promise<any>
|
||||
VerifyAllExchange: () => Promise<any>
|
||||
VerifyAndExport: (commodityID: string) => Promise<any>
|
||||
ExportAccounts: (accountNames: string[], filename: string) => Promise<any>
|
||||
ExportAccountsWithProduct: (accountNames: string[], commodityID: string, commodityName: string) => Promise<any>
|
||||
OrganizeAccounts: (commodityID: string, commodityName: string, startTime: number, endTime: number) => Promise<any>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package constants
|
||||
import "time"
|
||||
|
||||
// Version 应用版本号,与 wails.json version 同步。
|
||||
const Version = "0.0.3"
|
||||
const Version = "0.1.0"
|
||||
|
||||
const (
|
||||
ManualID = "G4KA4Qnz4LDp7"
|
||||
@@ -18,7 +18,7 @@ const (
|
||||
BatchLimitURL = BaseURL + "/wgapi/ordnc/activity/peace/batchExchangeLimit"
|
||||
PreExchangeURL = BaseURL + "/wgapi/ordnc/activity/peace/preExchange"
|
||||
ExchangeURL = BaseURL + "/wgapi/ordnc/activity/peace/exchange"
|
||||
ExchangeListURL = BaseURL + "/wgapi/ordnc/activity/peace/exchangeList?manualID=" + ManualID + "&limit=50&offset=0"
|
||||
ExchangeListURL = BaseURL + "/wgapi/ordnc/activity/peace/exchangeList?manualID=" + ManualID + "&limit=100&offset=0"
|
||||
BindInfoURL = BaseURL + "/japi/carnivalApi/v2/tencent/bindInfo?actAlias=" + ActAlias
|
||||
ScoreURL = BaseURL + "/japi/oms/web/peace/credit/balance"
|
||||
UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36"
|
||||
|
||||
@@ -160,6 +160,11 @@ func (s *Scheduler) AccountCount() int {
|
||||
return len(s.accounts)
|
||||
}
|
||||
|
||||
// AccountFilePath 返回账号文件路径。
|
||||
func (s *Scheduler) AccountFilePath() string {
|
||||
return s.paths.AccountFile
|
||||
}
|
||||
|
||||
// AccountSnapshot 复制一份账号列表。
|
||||
func (s *Scheduler) AccountSnapshot() []types.Account {
|
||||
s.accountsMu.RLock()
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"$schema": "https://wails.io/schemas/config.v2.json",
|
||||
"name": "douyu_go",
|
||||
"outputfilename": "douyu_go",
|
||||
"version": "0.0.4",
|
||||
"version": "0.1.0",
|
||||
"frontend:dir": "frontend",
|
||||
"frontend:install": "npm install",
|
||||
"frontend:build": "npm run build",
|
||||
|
||||
Reference in New Issue
Block a user