蘑菇退款
This commit is contained in:
@@ -350,26 +350,25 @@ namespace Hncore.Pass.Vpn.Service
|
|||||||
public override async Task<ApiResult> Refund(string account, string packageKey, int days)
|
public override async Task<ApiResult> Refund(string account, string packageKey, int days)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Console.WriteLine("===========================12312======================================");
|
|
||||||
var infoRet = await this.GetAccountInfo(account);
|
var infoRet = await this.GetAccountInfo(account);
|
||||||
// Console.WriteLine(infoRet.ToJson());
|
// Console.WriteLine(infoRet.ToJson());
|
||||||
await Task.Delay(100);
|
// await Task.Delay(50);
|
||||||
var id = infoRet.Data.Id;
|
var id = infoRet.Data.Id;
|
||||||
|
|
||||||
// Console.WriteLine("===========================12312======================================");
|
|
||||||
|
|
||||||
//{"DefaultRequestHeaders":[{"Key":"hl","Value":["hl"]},{"Key":"Cookie","Value":["EtV1DHm0lJwaH9n4dhKUOIGSO8XKroVSRY7shrgFTJyzk3hANqLsVoiYAIzDR8M7"]},{"Key":"Authorization","Value":["Bearer EtV1DHm0lJwaH9n4dhKUOIGSO8XKroVSRY7shrgFTJyzk3hANqLsVoiYAIzDR8M7"]}],"BaseAddress":"http://xjip.hlapi.com/","Timeout":"00:01:40","MaxResponseContentBufferSize":2147483647}
|
//{"DefaultRequestHeaders":[{"Key":"hl","Value":["hl"]},{"Key":"Cookie","Value":["EtV1DHm0lJwaH9n4dhKUOIGSO8XKroVSRY7shrgFTJyzk3hANqLsVoiYAIzDR8M7"]},{"Key":"Authorization","Value":["Bearer EtV1DHm0lJwaH9n4dhKUOIGSO8XKroVSRY7shrgFTJyzk3hANqLsVoiYAIzDR8M7"]}],"BaseAddress":"http://xjip.hlapi.com/","Timeout":"00:01:40","MaxResponseContentBufferSize":2147483647}
|
||||||
var client = CreateHttpClient();
|
// var client = CreateHttpClient();
|
||||||
var get_token = client.DefaultRequestHeaders.GetCookies()[0].Cookies[0].Name;
|
// var get_token = client.DefaultRequestHeaders.GetCookies()[0].Cookies[0].Name;
|
||||||
|
|
||||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://xjip.hlapi.com/api/number/refund");
|
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://xjip.hlapi.com/api/number/refund");
|
||||||
|
|
||||||
req.Method = "DELETE";
|
req.Method = "DELETE";
|
||||||
|
|
||||||
req.ContentType = "application/x-www-form-urlencoded";
|
req.ContentType = "application/x-www-form-urlencoded";
|
||||||
req.Headers.Add("Authorization", "Bearer " + get_token);
|
req.Headers.Add("Authorization", "Bearer w1v9MjG58z6qEzKPUVAdyhRBM8h1vYZVAGc4YpGx525APv9YHQPKuxVMt5EpF87A");
|
||||||
|
|
||||||
req.Timeout = 800;//请求超时时间
|
req.Timeout = 30000;//请求超时时间
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var postData = "id=" + id;
|
var postData = "id=" + id;
|
||||||
|
|
||||||
@@ -377,6 +376,8 @@ namespace Hncore.Pass.Vpn.Service
|
|||||||
|
|
||||||
req.ContentLength = data.Length;
|
req.ContentLength = data.Length;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using (Stream reqStream = req.GetRequestStream())
|
using (Stream reqStream = req.GetRequestStream())
|
||||||
{
|
{
|
||||||
reqStream.Write(data, 0, data.Length);
|
reqStream.Write(data, 0, data.Length);
|
||||||
@@ -384,16 +385,20 @@ namespace Hncore.Pass.Vpn.Service
|
|||||||
reqStream.Close();
|
reqStream.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
|
|
||||||
|
Console.WriteLine(postData);
|
||||||
|
|
||||||
// Stream stream = resp.GetResponseStream();
|
|
||||||
|
|
||||||
// string result = "";
|
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
|
||||||
// //获取响应内容
|
|
||||||
// using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
Stream stream = resp.GetResponseStream();
|
||||||
// {
|
|
||||||
// result = reader.ReadToEnd();
|
string result = "";
|
||||||
// }
|
//获取响应内容
|
||||||
|
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
||||||
|
{
|
||||||
|
result = reader.ReadToEnd();
|
||||||
|
}
|
||||||
|
|
||||||
return new ApiResult(1);
|
return new ApiResult(1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user