feat(supplier): 添加wave卡片支持并完善代理设置
- 在card_type.go中新增对wave卡片类型的支持 - 启用wave卡片请求的代理设置逻辑 - 在luban.go中为luban渠道发送卡请求添加代理设置 - 移除注释代码,确保代理逻辑生效 - 统一resty客户端超时及追踪配置
This commit is contained in:
@@ -61,6 +61,8 @@ func (c *cardTypeQuery) GetBalance(ctx context.Context) (balance float64, err er
|
||||
return c.aylrPreCard(ctx)
|
||||
case "jisu":
|
||||
return c.jisuCard(ctx)
|
||||
case "wave":
|
||||
return c.waveCard(ctx)
|
||||
}
|
||||
return c.Balance, nil
|
||||
}
|
||||
@@ -618,10 +620,10 @@ func (c *cardTypeQuery) waveCard(ctx context.Context) (balance float64, err erro
|
||||
webClient := resty.New().SetTimeout(time.Second * 5).SetRetryCount(3).SetHeaders(map[string]string{
|
||||
"user-agent": useragent.GetUserAgentByPlatform(useragent.PlatformPhone),
|
||||
}).OnBeforeRequest(func(c *resty.Client, request *resty.Request) error {
|
||||
//proxy, _ := utils.GetProxy(ctx, utils.GenerateId(), "waveCard")
|
||||
//if proxy != "" {
|
||||
// c.SetProxy(proxy)
|
||||
//}
|
||||
proxy, _ := utils.GetProxy(ctx, utils.GenerateId(), "waveCard")
|
||||
if proxy != "" {
|
||||
c.SetProxy(proxy)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
otelresty.TraceClient(webClient)
|
||||
|
||||
@@ -153,7 +153,13 @@ func (s *SendCardTaskTypeLuban) channelTwo(ctx context.Context, orderItem OrderP
|
||||
"card_pwd": task.CardInfo.Data,
|
||||
}
|
||||
jsonBody, _ := json.Marshal(params)
|
||||
client := resty.New().SetTimeout(time.Second * 5).SetTimeout(time.Second * 5)
|
||||
client := resty.New().SetTimeout(time.Second * 5).SetTimeout(time.Second * 5).OnBeforeRequest(func(client *resty.Client, request *resty.Request) error {
|
||||
proxy, _ := utils.GetProxy(ctx, utils.GenerateId(), string(SendCardTaskTypeEnumLuban+"channelTwo"))
|
||||
if proxy != "" {
|
||||
client.SetProxy(proxy)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
otelresty.TraceClient(client)
|
||||
response, err := client.R().SetContext(ctx).SetQueryParams(map[string]string{
|
||||
"json": string(jsonBody),
|
||||
|
||||
Reference in New Issue
Block a user