|
|
@@ -1320,14 +1320,18 @@ async fn http_post_form_steam(
|
|
|
}
|
|
|
|
|
|
for attempt in 0..=retry_times {
|
|
|
- // POST 请求不使用代理,直接连接 Steam
|
|
|
+ // 使用全局共享代理池获取代理(本地5000端口Steam API必须走代理)
|
|
|
+ let proxy_url = get_proxy_from_global_pool(sweep_file).await?;
|
|
|
let msg = format!(
|
|
|
- "[sweep:{}] Steam POST 直连(不使用代理)",
|
|
|
- label
|
|
|
+ "[sweep:{}] Steam POST 使用代理 {}",
|
|
|
+ label,
|
|
|
+ proxy_endpoint_for_log(&proxy_url)
|
|
|
);
|
|
|
info!("{}", msg);
|
|
|
sweep_log_diag(sweep_file, rid, "info", &msg).await;
|
|
|
+ let proxy = reqwest::Proxy::all(&proxy_url).map_err(|e| e.to_string())?;
|
|
|
let client = reqwest::Client::builder()
|
|
|
+ .proxy(proxy)
|
|
|
.timeout(Duration::from_secs(25))
|
|
|
.build()
|
|
|
.map_err(|e| e.to_string())?;
|
|
|
@@ -1465,6 +1469,7 @@ async fn operate_confirmation(
|
|
|
acc: &mut LocalAccount,
|
|
|
confirmation_id: &str,
|
|
|
_client: &reqwest::Client,
|
|
|
+ sweep_file: Option<&SweepShared>,
|
|
|
) -> Result<bool, String> {
|
|
|
let url = format!(
|
|
|
"{}/trade-confirmations/operate",
|
|
|
@@ -1482,8 +1487,11 @@ async fn operate_confirmation(
|
|
|
"ConfirmationId": cid,
|
|
|
"Operation": "accept",
|
|
|
});
|
|
|
- // 不使用代理,直接连接本地 steamAPI
|
|
|
+ // 使用代理连接本地 steamAPI
|
|
|
+ let proxy_url = get_proxy_from_global_pool(sweep_file).await?;
|
|
|
+ let proxy = reqwest::Proxy::all(&proxy_url).map_err(|e| e.to_string())?;
|
|
|
let client = reqwest::Client::builder()
|
|
|
+ .proxy(proxy)
|
|
|
.timeout(Duration::from_secs(25))
|
|
|
.build()
|
|
|
.map_err(|e| format!("创建HTTP客户端失败: {}", e))?;
|
|
|
@@ -1522,6 +1530,7 @@ async fn operate_confirmation_with_retry(
|
|
|
acc: &mut LocalAccount,
|
|
|
confirmation_id: &str,
|
|
|
max_retries: u32,
|
|
|
+ sweep_file: Option<&SweepShared>,
|
|
|
) -> Result<bool, String> {
|
|
|
let url = format!(
|
|
|
"{}/trade-confirmations/operate",
|
|
|
@@ -1529,12 +1538,16 @@ async fn operate_confirmation_with_retry(
|
|
|
);
|
|
|
let cid: i64 = confirmation_id.parse().map_err(|_| "confirmation_id 无效".to_string())?;
|
|
|
|
|
|
- let client = reqwest::Client::builder()
|
|
|
- .timeout(Duration::from_secs(25))
|
|
|
- .build()
|
|
|
- .map_err(|e| format!("创建HTTP客户端失败: {}", e))?;
|
|
|
-
|
|
|
for attempt in 1..=max_retries {
|
|
|
+ // 使用代理连接本地 steamAPI
|
|
|
+ let proxy_url = get_proxy_from_global_pool(sweep_file).await?;
|
|
|
+ let proxy = reqwest::Proxy::all(&proxy_url).map_err(|e| e.to_string())?;
|
|
|
+ let client = reqwest::Client::builder()
|
|
|
+ .proxy(proxy)
|
|
|
+ .timeout(Duration::from_secs(25))
|
|
|
+ .build()
|
|
|
+ .map_err(|e| format!("创建HTTP客户端失败: {}", e))?;
|
|
|
+
|
|
|
// 每次重试时重新构建 body(因为 session 可能已更新)
|
|
|
let body = json!({
|
|
|
"MaFilePath": acc.mafile_path,
|
|
|
@@ -1907,7 +1920,7 @@ async fn purchase_one_listing(
|
|
|
}
|
|
|
|
|
|
// 第一步:使用幂等重试确认交易(最多10次)
|
|
|
- let confirm_result = operate_confirmation_with_retry(acc, &confirmation_id, 10).await;
|
|
|
+ let confirm_result = operate_confirmation_with_retry(acc, &confirmation_id, 10, sweep_file).await;
|
|
|
let ok = match confirm_result {
|
|
|
Ok(result) => result,
|
|
|
Err(e) => {
|