优化: 兑换上限视为成功
- classifyRetryStop 添加 success 返回值 - 兑换上限(2019)现在算作抢购成功,而非失败 - 前端状态显示:兑换上限显示为「已抢到」 - 设置弹窗说明更新 以日志为例:成功率从 0.6% 提升到 39.4%(63/160)
This commit is contained in:
@@ -42,7 +42,7 @@ const getStatusInfo = (name: string, selected: boolean) => {
|
|||||||
if (obj.ok) return { text: '成功', cls: 'status-success' }
|
if (obj.ok) return { text: '成功', cls: 'status-success' }
|
||||||
const msg = String(obj.message || '')
|
const msg = String(obj.message || '')
|
||||||
if (msg.includes('库存已耗完')) return { text: '库存耗尽', cls: 'status-warn' }
|
if (msg.includes('库存已耗完')) return { text: '库存耗尽', cls: 'status-warn' }
|
||||||
if (msg.includes('兑换上限')) return { text: '已达上限', cls: 'status-warn' }
|
if (msg.includes('兑换上限') || msg.includes('已抢到')) return { text: '已抢到', cls: 'status-success' }
|
||||||
if (msg.includes('未绑定')) return { text: '未绑定', cls: 'status-fail' }
|
if (msg.includes('未绑定')) return { text: '未绑定', cls: 'status-fail' }
|
||||||
if (msg.includes('精英手册')) return { text: '资格不足', cls: 'status-fail' }
|
if (msg.includes('精英手册')) return { text: '资格不足', cls: 'status-fail' }
|
||||||
return { text: selected ? '未命中' : '失败', cls: selected ? 'status-warn' : 'status-fail' }
|
return { text: selected ? '未命中' : '失败', cls: selected ? 'status-warn' : 'status-fail' }
|
||||||
|
|||||||
@@ -145,9 +145,8 @@ defineExpose({ open, close })
|
|||||||
<div class="info-card info-card-warn">
|
<div class="info-card info-card-warn">
|
||||||
<div class="info-title">⚠️ 自动停止条件</div>
|
<div class="info-title">⚠️ 自动停止条件</div>
|
||||||
<ul class="info-list">
|
<ul class="info-list">
|
||||||
<li><strong>成功</strong> - 抢到商品</li>
|
<li><strong>成功</strong> - 抢到商品(含兑换上限)</li>
|
||||||
<li><strong>库存耗尽</strong> - 商品本次活动库存已耗完</li>
|
<li><strong>库存耗尽</strong> - 商品本次活动库存已耗完</li>
|
||||||
<li><strong>兑换上限</strong> - 该账号已达本次活动兑换上限</li>
|
|
||||||
<li><strong>未绑定</strong> - 账号未绑定角色</li>
|
<li><strong>未绑定</strong> - 账号未绑定角色</li>
|
||||||
<li><strong>资格不足</strong> - 需要开通精英手册</li>
|
<li><strong>资格不足</strong> - 需要开通精英手册</li>
|
||||||
<li><strong>超时</strong> - 75秒抢购窗口结束</li>
|
<li><strong>超时</strong> - 75秒抢购窗口结束</li>
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ func (s *Scheduler) executeRound(attempts []types.ExchangeAttempt) roundOutcome
|
|||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
} else {
|
} else {
|
||||||
logger.LogEvent("抢购", "info", "尝试: %s %s 第%d包 %s", result.Account, result.Product, result.Attempt, result.Message)
|
logger.LogEvent("抢购", "info", "尝试: %s %s 第%d包 %s", result.Account, result.Product, result.Attempt, result.Message)
|
||||||
terminalAccount, terminalProduct, reason := classifyRetryStop(result.Message)
|
terminalAccount, terminalProduct, isSuccess, reason := classifyRetryStop(result.Message)
|
||||||
if terminalAccount || terminalProduct {
|
if terminalAccount || terminalProduct {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
if terminalAccount {
|
if terminalAccount {
|
||||||
@@ -400,6 +400,12 @@ func (s *Scheduler) executeRound(attempts []types.ExchangeAttempt) roundOutcome
|
|||||||
if terminalProduct {
|
if terminalProduct {
|
||||||
outcome.stoppedProducts[attempt.Product.CommodityID] = reason
|
outcome.stoppedProducts[attempt.Product.CommodityID] = reason
|
||||||
}
|
}
|
||||||
|
// 兑换上限也算成功
|
||||||
|
if isSuccess {
|
||||||
|
outcome.successAccounts[attempt.Account.Name] = true
|
||||||
|
logger.LogEvent("抢购", "success", "成功(兑换上限): %s %s 第%d包", result.Account, result.Product, result.Attempt)
|
||||||
|
go image.SaveSuccessImage(attempt.Account, attempt.Product, result.RoleName, s.font, s.paths.SuccessDir)
|
||||||
|
}
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -430,18 +436,18 @@ func jitterDuration(base time.Duration) time.Duration {
|
|||||||
return base + jitter
|
return base + jitter
|
||||||
}
|
}
|
||||||
|
|
||||||
func classifyRetryStop(message string) (account bool, product bool, reason string) {
|
func classifyRetryStop(message string) (account bool, product bool, success bool, reason string) {
|
||||||
switch {
|
switch {
|
||||||
case strings.Contains(message, "商品本次活动库存已耗完"):
|
case strings.Contains(message, "商品本次活动库存已耗完"):
|
||||||
return true, true, "商品库存已耗完"
|
return true, true, false, "商品库存已耗完"
|
||||||
case strings.Contains(message, "您已达本次活动兑换上限"):
|
case strings.Contains(message, "您已达本次活动兑换上限"):
|
||||||
return true, false, "账号已达兑换上限"
|
return true, false, true, "已抢到(兑换上限)"
|
||||||
case strings.Contains(message, "未绑定账号"):
|
case strings.Contains(message, "未绑定账号"):
|
||||||
return true, false, "账号未绑定角色"
|
return true, false, false, "账号未绑定角色"
|
||||||
case strings.Contains(message, "需要开通精英手册"):
|
case strings.Contains(message, "需要开通精英手册"):
|
||||||
return true, false, "账号不满足精英手册条件"
|
return true, false, false, "账号不满足精英手册条件"
|
||||||
default:
|
default:
|
||||||
return false, false, ""
|
return false, false, false, ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user