|
@@ -9,12 +9,13 @@ namespace molilian.core
|
|
|
|
|
|
|
|
public async Task<string> H5stHack(dynamic querystring, CancellationToken cancellationToken)
|
|
public async Task<string> H5stHack(dynamic querystring, CancellationToken cancellationToken)
|
|
|
{
|
|
{
|
|
|
|
|
+ string body = string.Empty;
|
|
|
string useragent = _account.user_agent;
|
|
string useragent = _account.user_agent;
|
|
|
if (string.IsNullOrEmpty(useragent)) useragent = ProviderFakeUserAgent.RandomComputer;
|
|
if (string.IsNullOrEmpty(useragent)) useragent = ProviderFakeUserAgent.RandomComputer;
|
|
|
|
|
|
|
|
var args = new
|
|
var args = new
|
|
|
{
|
|
{
|
|
|
- version = "4.9.7",
|
|
|
|
|
|
|
+ version = _config.jd_h5st_sign_version,
|
|
|
body = querystring,
|
|
body = querystring,
|
|
|
pin = _account.pin,
|
|
pin = _account.pin,
|
|
|
ua = _account.user_agent,
|
|
ua = _account.user_agent,
|
|
@@ -22,26 +23,41 @@ namespace molilian.core
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
- string data = args.Convert2Json();
|
|
|
|
|
- string url = "http://localhost:3001/h5st";
|
|
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ string data = args.Convert2Json();
|
|
|
|
|
+ string url = _config.jd_h5st_sign_url;
|
|
|
|
|
+ if (string.IsNullOrEmpty(url)) url = "http://localhost:3001/h5st";
|
|
|
|
|
+
|
|
|
#if DEBUG
|
|
#if DEBUG
|
|
|
- url = "http://bjapi.molilian.com:3001/h5st";
|
|
|
|
|
|
|
+ url = "http://bjapi.molilian.com:3001/h5st";
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
- WebClientUtility client = new WebClientUtility();
|
|
|
|
|
- client.SetContentType("application/json");
|
|
|
|
|
- client.Post(data);
|
|
|
|
|
- var response = await client.RequestAsync(url, "POST", cancellationToken);
|
|
|
|
|
|
|
+ WebClientUtility client = new WebClientUtility();
|
|
|
|
|
+ client.SetContentType("application/json");
|
|
|
|
|
+ client.Timeout = TimeSpan.FromMicroseconds(2000);
|
|
|
|
|
+ client.Post(data);
|
|
|
|
|
+ var response = await client.RequestAsync(url, "POST", cancellationToken);
|
|
|
|
|
+
|
|
|
|
|
+ body = response.Body();
|
|
|
|
|
+ var root = body.Convert2JsonElement();
|
|
|
|
|
+ int code = root.Read<int>("code");
|
|
|
|
|
+ string qs = root.PathRead<string>("body.qs");
|
|
|
|
|
+ if (code == 200)
|
|
|
|
|
+ {
|
|
|
|
|
+ return qs;
|
|
|
|
|
+ }
|
|
|
|
|
+ _ = new LoggerLibrary("JdUnion", "h5st").Info(body).SaveAsync();
|
|
|
|
|
|
|
|
- string body = response.Body();
|
|
|
|
|
- var root = body.Convert2JsonElement();
|
|
|
|
|
- int code = root.Read<int>("code");
|
|
|
|
|
- string qs = root.PathRead<string>("body.qs");
|
|
|
|
|
- if (code == 200)
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
- return qs;
|
|
|
|
|
|
|
+ _ = new LoggerLibrary("JdUnion", "h5st_error")
|
|
|
|
|
+ .Info(body)
|
|
|
|
|
+ .Info(ex.Message, ex.StackTrace)
|
|
|
|
|
+ .SaveAsync();
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- _ = new LoggerLibrary("JdUnion", "h5st").Info(body).SaveAsync();
|
|
|
|
|
return string.Empty;
|
|
return string.Empty;
|
|
|
}
|
|
}
|
|
|
|
|
|