新代理商
This commit is contained in:
1 parent
e37f15737c
commit
0773eaa9fd
34 files changed
+742
-76
No files matched your search
@@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Work;
|
||||
|
||||
namespace TemuKJD.BLL
|
||||
{
|
||||
@@ -559,12 +560,27 @@ namespace TemuKJD.BLL
|
||||
}
|
||||
result = GetProxyHtml.ReadResponse(response);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static string sAuthorization = "";
|
||||
|
||||
public static string e57PostResponse(string _url, string _data, string referer, string Authorization = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Authorization))
|
||||
Authorization = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjQ3YmRlOGNlLWY5MDUtNDIzOS05M2VjLWZiN2U3MjRmOTY0NiJ9.vwxhj3t4zTDdBQTyfVjcKr-0Oma8-VtPDzE2LVkw4A4aWftncY1ikXgEhGwoYHn9E7yOnhS_Pb7FfzgecTqqHA";
|
||||
//if (string.IsNullOrEmpty(Authorization)) Authorization = "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjQ3YmRlOGNlLWY5MDUtNDIzOS05M2VjLWZiN2U3MjRmOTY0NiJ9.vwxhj3t4zTDdBQTyfVjcKr-0Oma8-VtPDzE2LVkw4A4aWftncY1ikXgEhGwoYHn9E7yOnhS_Pb7FfzgecTqqHA";
|
||||
|
||||
bool isRetry = false;
|
||||
if (string.IsNullOrEmpty(sAuthorization))
|
||||
{
|
||||
var url3 = BaseClass.BuildWXObjString("user/get_e57_authorization");
|
||||
var data3 = UserLogin.GetSignaturex();
|
||||
var html3 = GetHtml.PostUtf8(url3, data3);
|
||||
if (string.IsNullOrEmpty(html3) || !html3.Contains("\"code\":200"))
|
||||
html3 = GetHtml.PostUtf8(url3, data3);
|
||||
sAuthorization = BaseRegex.GetStringJson(ref html3, "authorization");
|
||||
}
|
||||
|
||||
Retry:
|
||||
|
||||
HttpWebResponse response = null;
|
||||
string result;
|
||||
try
|
||||
@@ -594,15 +610,17 @@ namespace TemuKJD.BLL
|
||||
request.Headers.Add("sec-ch-ua-mobile", @"?0");
|
||||
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", @"1");
|
||||
request.Headers.Add("Authorization", Authorization);
|
||||
request.Headers.Add("Authorization", "Bearer " + sAuthorization);
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36";
|
||||
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";
|
||||
request.Headers.Add("Sec-Fetch-Site", @"none");
|
||||
request.Headers.Add("Sec-Fetch-Mode", @"navigate");
|
||||
request.Headers.Add("Sec-Fetch-User", @"?1");
|
||||
request.Headers.Add("Sec-Fetch-Dest", @"document");
|
||||
request.Headers.Set(HttpRequestHeader.Cookie, "Admin-Token=" + sAuthorization);
|
||||
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
|
||||
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
|
||||
request.Proxy = null;
|
||||
|
||||
request.Method = "POST";
|
||||
request.ServicePoint.Expect100Continue = false;
|
||||
@@ -632,11 +650,29 @@ namespace TemuKJD.BLL
|
||||
return e.Message;
|
||||
}
|
||||
result = GetProxyHtml.ReadResponse(response);
|
||||
if (result.Contains("没有Authorization") && !isRetry)
|
||||
{
|
||||
isRetry = true;
|
||||
sAuthorization = "";
|
||||
goto Retry;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string e57GetResponse(string _url, string referer)
|
||||
{
|
||||
bool isRetry = false;
|
||||
if (string.IsNullOrEmpty(sAuthorization))
|
||||
{
|
||||
var url3 = BaseClass.BuildWXObjString("user/get_e57_authorization");
|
||||
var data3 = UserLogin.GetSignaturex();
|
||||
var html3 = GetHtml.PostUtf8(url3, data3);
|
||||
if (string.IsNullOrEmpty(html3) || !html3.Contains("\"code\":200"))
|
||||
html3 = GetHtml.PostUtf8(url3, data3);
|
||||
sAuthorization = BaseRegex.GetStringJson(ref html3, "authorization");
|
||||
}
|
||||
Retry:
|
||||
|
||||
HttpWebResponse response = null;
|
||||
string result;
|
||||
try
|
||||
@@ -660,14 +696,17 @@ namespace TemuKJD.BLL
|
||||
request.Headers.Add("sec-ch-ua-mobile", @"?0");
|
||||
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", @"1");
|
||||
request.Headers.Add("Authorization", "Bearer " + sAuthorization);
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36";
|
||||
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";
|
||||
request.Headers.Add("Sec-Fetch-Site", @"none");
|
||||
request.Headers.Add("Sec-Fetch-Mode", @"navigate");
|
||||
request.Headers.Add("Sec-Fetch-User", @"?1");
|
||||
request.Headers.Add("Sec-Fetch-Dest", @"document");
|
||||
request.Headers.Set(HttpRequestHeader.Cookie, "Admin-Token=" + sAuthorization);
|
||||
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
|
||||
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
|
||||
request.Proxy = null;
|
||||
|
||||
response = (HttpWebResponse)request.GetResponse();
|
||||
}
|
||||
@@ -687,6 +726,12 @@ namespace TemuKJD.BLL
|
||||
return e.Message;
|
||||
}
|
||||
result = GetProxyHtml.ReadResponse(response);
|
||||
if (result.Contains("没有Authorization") && !isRetry)
|
||||
{
|
||||
isRetry = true;
|
||||
sAuthorization = "";
|
||||
goto Retry;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user