feat(proxy): 支持品赞分组代理与自动白名单
This commit is contained in:
@@ -116,7 +116,15 @@ type attemptOutcome struct {
|
||||
|
||||
// runAccountAttempt 按活动执行一次完整尝试。
|
||||
func (s *Scheduler) runAccountAttempt(attempt types.ExchangeAttempt, mode types.SeckillMode, ctl *runControl) attemptOutcome {
|
||||
cli := s.clientSnapshot()
|
||||
cli := s.clientForAccount(attempt.Account.Name)
|
||||
if cli == nil {
|
||||
return attemptOutcome{result: types.ExchangeResult{
|
||||
Account: attempt.Account.Name,
|
||||
Product: attempt.Product.CommodityName,
|
||||
Attempt: attempt.Index,
|
||||
Message: "失败|没有可用代理客户端",
|
||||
}}
|
||||
}
|
||||
switch {
|
||||
case cli.Activity.IsXiaodian:
|
||||
// 和平小店正常走 RunXiaodian;这里保留兜底分类,避免万一被路由进来时
|
||||
@@ -136,7 +144,15 @@ func (s *Scheduler) runAccountAttempt(attempt types.ExchangeAttempt, mode types.
|
||||
// 锁单失败立即返回,等待与重试交给外层每账号独立循环,因此单个账号的长退避
|
||||
// 不会阻塞其它账号;锁单成功后的支付阶梯不受 75 秒抢购窗口约束。
|
||||
func (s *Scheduler) runPeaceLockPay(attempt types.ExchangeAttempt, ctl *runControl) attemptOutcome {
|
||||
cli := s.clientSnapshot()
|
||||
cli := s.clientForAccount(attempt.Account.Name)
|
||||
if cli == nil {
|
||||
return attemptOutcome{result: types.ExchangeResult{
|
||||
Account: attempt.Account.Name,
|
||||
Product: attempt.Product.CommodityName,
|
||||
Attempt: attempt.Index,
|
||||
Message: "失败|没有可用代理客户端",
|
||||
}}
|
||||
}
|
||||
out := attemptOutcome{result: types.ExchangeResult{
|
||||
Account: attempt.Account.Name,
|
||||
Product: attempt.Product.CommodityName,
|
||||
@@ -324,7 +340,15 @@ func (s *Scheduler) payOnce(cli *client.DouyuClient, attempt types.ExchangeAttem
|
||||
|
||||
// runDirectExchange 电竞手册直接兑换。
|
||||
func (s *Scheduler) runDirectExchange(attempt types.ExchangeAttempt, reuseCache bool, ctl *runControl) attemptOutcome {
|
||||
cli := s.clientSnapshot()
|
||||
cli := s.clientForAccount(attempt.Account.Name)
|
||||
if cli == nil {
|
||||
return attemptOutcome{result: types.ExchangeResult{
|
||||
Account: attempt.Account.Name,
|
||||
Product: attempt.Product.CommodityName,
|
||||
Attempt: attempt.Index,
|
||||
Message: "失败|没有可用代理客户端",
|
||||
}}
|
||||
}
|
||||
out := attemptOutcome{result: types.ExchangeResult{
|
||||
Account: attempt.Account.Name,
|
||||
Product: attempt.Product.CommodityName,
|
||||
@@ -450,7 +474,7 @@ func (s *Scheduler) rememberAuth(accountName, csrf, roleName string) {
|
||||
|
||||
// runXiaodianAttempt 和平小店专用兑换:跳过手册鉴权、批量限制和预兑换,直接调用 livebuy。
|
||||
func (s *Scheduler) runXiaodianAttempt(attempt types.ExchangeAttempt) types.ExchangeResult {
|
||||
cli := s.clientSnapshot()
|
||||
cli := s.clientForAccount(attempt.Account.Name)
|
||||
result := types.ExchangeResult{
|
||||
Account: attempt.Account.Name,
|
||||
Product: attempt.Product.CommodityName,
|
||||
@@ -461,6 +485,10 @@ func (s *Scheduler) runXiaodianAttempt(attempt types.ExchangeAttempt) types.Exch
|
||||
result.Message = "失败|已收到停止指令"
|
||||
return result
|
||||
}
|
||||
if cli == nil {
|
||||
result.Message = "失败|没有可用代理客户端"
|
||||
return result
|
||||
}
|
||||
|
||||
logger.LogAccountEvent("抢购", "info", attempt.Account.Name,
|
||||
"和平小店直接兑换: 账号=%s 商品=%s 第%d次",
|
||||
|
||||
Reference in New Issue
Block a user