增加和平小店关键词固定抢购
This commit is contained in:
@@ -3,7 +3,7 @@ import { useToast } from './useToast'
|
||||
import { useAccounts } from './useAccounts'
|
||||
import { useProducts } from './useProducts'
|
||||
import { useLogs } from './useLogs'
|
||||
import { CancelSchedule, SetSchedule, StartSeckill } from '@wails/go/app/App'
|
||||
import { CancelSchedule, SetSchedule, StartFixedSeckill, StartSeckill } from '@wails/go/app/App'
|
||||
|
||||
const scheduleActive = ref(false)
|
||||
const countdownSeconds = ref(0)
|
||||
@@ -103,6 +103,29 @@ export function useScheduler() {
|
||||
}
|
||||
}
|
||||
|
||||
const startFixed = async (attempts: number, delayMs: number) => {
|
||||
const ap = buildAccountProducts(selectedProductId.value || '')
|
||||
if (!ap) return false
|
||||
resetStatus()
|
||||
clearLocalResults()
|
||||
markSelectedPending('固定抢购中,等待后端结果')
|
||||
setRunState('固定抢购已提交')
|
||||
try {
|
||||
const d = await StartFixedSeckill({ accountProducts: ap, attempts, delayMs })
|
||||
if (d?.success === false) throw new Error(d.error || '提交失败')
|
||||
setRunState(d.msg || '固定抢购已启动')
|
||||
addLocalLog(`固定抢购: ${Object.keys(ap).length} 个账号,${attempts} 次,间隔 ${delayMs}ms`, 'i')
|
||||
showToast('固定抢购已启动', `${Object.keys(ap).length} 个账号`, 'info', 3000)
|
||||
return true
|
||||
} catch (e: any) {
|
||||
setRunState('固定抢购提交失败')
|
||||
markSelectedStatus({ ok: false, message: `提交失败: ${e.message}` })
|
||||
addLocalLog('固定抢购提交失败: ' + e.message, 'e')
|
||||
showToast('提交失败', e.message, 'error')
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const cancelSchedule = async () => {
|
||||
try {
|
||||
await CancelSchedule()
|
||||
@@ -158,6 +181,7 @@ export function useScheduler() {
|
||||
runState,
|
||||
setRunState,
|
||||
startNow,
|
||||
startFixed,
|
||||
startSchedule,
|
||||
cancelSchedule,
|
||||
formatRemain,
|
||||
|
||||
Reference in New Issue
Block a user