优化和平小店碎片兑换链路

This commit is contained in:
yml2213
2026-08-09 10:07:36 +08:00
parent c6f16dfbee
commit feb72196c1
6 changed files with 54 additions and 18 deletions
+7
View File
@@ -12,6 +12,10 @@ import (
// runAttempt 标准模式兑换:完整执行鉴权 token→BatchLimit→PreExchange→Exchange 链路。
func (s *Scheduler) runAttempt(attempt types.ExchangeAttempt) types.ExchangeResult {
cli := s.clientSnapshot()
// 最终防护:任何旧入口在和平小店活动下都必须使用 livebuy。
if cli.Activity.IsXiaodian {
return s.runXiaodianAttempt(attempt)
}
result := types.ExchangeResult{
Account: attempt.Account.Name,
Product: attempt.Product.CommodityName,
@@ -101,6 +105,9 @@ func (s *Scheduler) runAttempt(attempt types.ExchangeAttempt) types.ExchangeResu
// runAttemptFast 激进模式的兑换逻辑,复用缓存的鉴权 token,跳过 BatchExchangeLimit 和 PreExchange。
func (s *Scheduler) runAttemptFast(attempt types.ExchangeAttempt) types.ExchangeResult {
cli := s.clientSnapshot()
if cli.Activity.IsXiaodian {
return s.runXiaodianAttempt(attempt)
}
result := types.ExchangeResult{
Account: attempt.Account.Name,
Product: attempt.Product.CommodityName,