天天IP
This commit is contained in:
@@ -209,7 +209,7 @@
|
||||
this.sstp = '4433';
|
||||
break;
|
||||
case 14:
|
||||
this.l2tp = '91ip';
|
||||
this.l2tp = '1234';
|
||||
this.search_field = '天天IP';
|
||||
this.sstp = '4430';
|
||||
break;
|
||||
|
||||
@@ -203,7 +203,7 @@
|
||||
this.sstp = '4433';
|
||||
break;
|
||||
case 14:
|
||||
this.l2tp = '91ip';
|
||||
this.l2tp = '1234';
|
||||
this.search_field = '天天IP';
|
||||
this.sstp = '4430';
|
||||
break;
|
||||
|
||||
@@ -21,24 +21,24 @@ namespace Hncore.Pass.Vpn.Service
|
||||
{
|
||||
public class AgentClient7Service : AgentClientBaseService
|
||||
{
|
||||
string apiId = "135";
|
||||
string apiKey = "7dayCFfY6zcwJa6QHtHbGQBRckjJbrbS";
|
||||
string apiId = "89";
|
||||
string apiKey = "NFeK72yYXmPiGR86YeMCBRTWDxXkrQsd";
|
||||
string LoginIndexUrl { get; set; } = "login";
|
||||
string LoginUrl { get; set; } = "login";
|
||||
string LoginCodeUrl { get; set; } = "";
|
||||
string RefrushTokenUrl { get; set; } = "my";
|
||||
string SingleAddUrl { get; set; } = "api/add";
|
||||
string SingleReAddUrl { get; set; } = "api/renewal";
|
||||
string SingleReAddUrl { get; set; } = "v1/renewal";
|
||||
string MuiltAddUrl { get; set; } = "agent/memberMuiltAdd.html";
|
||||
string RefundUrl { get; set; } = "agent/memberRefundAct.html ";
|
||||
string UpdateUrl = "api/edit";
|
||||
string UpdateUrl = "v1/edit";
|
||||
string OnlineLoginUrl { get; set; } = "online";
|
||||
string OnlineUrl { get; set; } = "ppp/oln?";
|
||||
string OnlineUrl { get; set; } = "v1/oln";
|
||||
string KIllUrl { get; set; } = "agent/disConnect2/radacctid/{0}.html";
|
||||
string searchAccountUrl = "api/get";
|
||||
string DeleteUrl { get; set; } = "api/del";//1160862.html";
|
||||
string searchAccountUrl = "v1/get";
|
||||
string DeleteUrl { get; set; } = "v1/refund";//1160862.html";
|
||||
|
||||
string ExistUrl = "api/verify";
|
||||
string ExistUrl = "v1/verify";
|
||||
IHttpClientFactory m_HttpClientFactory;
|
||||
public AgentClient7Service(IHttpClientFactory httpClientFactory) : base(httpClientFactory)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ namespace Hncore.Pass.Vpn.Service
|
||||
private async Task<(string, string)> GetHomeCookie()
|
||||
{
|
||||
var client = CreateHttpClient(false);
|
||||
client.BaseAddress = new Url("http://dl.91ip.vip/");
|
||||
client.BaseAddress = new Url("https://yoyoapi.yoyoip.com/");
|
||||
var getResp = await client.GetAsync(this.LoginIndexUrl);
|
||||
var cookies = this.GetCookies(getResp);
|
||||
cookies = cookies.Replace("path=/;", "").Replace("httponly", "").Trim();
|
||||
@@ -115,7 +115,7 @@ namespace Hncore.Pass.Vpn.Service
|
||||
{
|
||||
var tokens = await this.GetHomeCookie();
|
||||
var client = CreateHttpClient(false);
|
||||
client.BaseAddress = new Url("http://dl.91ip.vip/");
|
||||
client.BaseAddress = new Url("https://yoyoapi.yoyoip.com");
|
||||
client.DefaultRequestHeaders.Add("Connection", "keep-alive");
|
||||
client.DefaultRequestHeaders.Add("Upgrade-Insecure-Requests", "1");
|
||||
var map = new Dictionary<string, string>(){
|
||||
@@ -179,10 +179,13 @@ namespace Hncore.Pass.Vpn.Service
|
||||
/// <returns></returns>
|
||||
public override async Task<ApiResult> NewAccount(string packageKey, string account, string pwd, int connCount = 1, int accountType = 1, int payCount = 1)
|
||||
{
|
||||
var new_url = "v1/one";
|
||||
var client = CreateHttpClient();
|
||||
var package = "m";
|
||||
var buyCount = "1";
|
||||
if(packageKey =="m3"){
|
||||
if(packageKey =="test"){
|
||||
new_url = "v1/test";
|
||||
} else if(packageKey =="m3"){
|
||||
package = "m";
|
||||
buyCount = "3";
|
||||
} else if(packageKey =="m12"){
|
||||
@@ -193,28 +196,31 @@ namespace Hncore.Pass.Vpn.Service
|
||||
buyCount = payCount.ToString();
|
||||
}
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"user",account },
|
||||
{"name",account },
|
||||
{"passwd",pwd },
|
||||
{"num","1"},
|
||||
{"conn_max",connCount.ToString() },
|
||||
{"test",packageKey=="test"?"1":"0" },
|
||||
{"type",packageKey=="test"?"d":package },
|
||||
{"max_conn",connCount.ToString() },
|
||||
{"paytype",package },
|
||||
{"paynum",buyCount },
|
||||
{"mobile","17719092232" },
|
||||
{"mobile","13073735878" },
|
||||
{"mark","api" },
|
||||
};
|
||||
var title = GetOpTitle("NewAccount", account);
|
||||
LogHelper.Info(title, map.ToJson());
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync(this.SingleAddUrl+"?"+ Sign(map));
|
||||
var resp = await client.GetAsync(new_url+"?"+ Sign(map));
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["status"].ToString();
|
||||
Console.WriteLine("==============================tiantian==========================================================");
|
||||
Console.WriteLine(jo);
|
||||
Console.WriteLine(status);
|
||||
Console.WriteLine("========================================================================================");
|
||||
if (status =="200")
|
||||
{
|
||||
var retAccount=jo["data"].ToArray().FirstOrDefault();
|
||||
var id = retAccount["id"].ToString();
|
||||
return new ApiResult(ResultCode.C_SUCCESS) { Data=id};
|
||||
// var id = retAccount["name"].ToString();
|
||||
return new ApiResult(ResultCode.C_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -239,7 +245,6 @@ namespace Hncore.Pass.Vpn.Service
|
||||
/// <returns></returns>
|
||||
public override async Task<ApiResult> NewReAccount(string packageKey, string id, int connCount, int payCount = 1)
|
||||
{
|
||||
var ret = await this.GetAccountInfo(id);
|
||||
var package = "m";
|
||||
var buyCount = "1";
|
||||
if(packageKey =="m3"){
|
||||
@@ -251,20 +256,14 @@ namespace Hncore.Pass.Vpn.Service
|
||||
} else {
|
||||
package = packageKey;
|
||||
buyCount = payCount.ToString();
|
||||
}
|
||||
if (ret.Code != ResultCode.C_SUCCESS|| ret.Data==null)
|
||||
{
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "账户不存在,续费失败");
|
||||
}
|
||||
}
|
||||
var client = CreateHttpClient();
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"id",id }, //原始的账号的id
|
||||
{"type",package },
|
||||
{"names",id }, //原始的账号的id
|
||||
{"paytype",package },
|
||||
{"paynum",buyCount },
|
||||
};
|
||||
|
||||
var title = GetOpTitle("NewReAccount", id);
|
||||
LogHelper.Info(title, map.ToJson());
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync(this.SingleReAddUrl + "?" + Sign(map));
|
||||
@@ -278,13 +277,11 @@ namespace Hncore.Pass.Vpn.Service
|
||||
else
|
||||
{
|
||||
var info = jo["info"].ToString();
|
||||
LogHelper.Error(title, content);
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, info);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error(title, ex.Message);
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "续费失败");
|
||||
}
|
||||
}
|
||||
@@ -294,15 +291,13 @@ namespace Hncore.Pass.Vpn.Service
|
||||
/// <param name="productId"></param>
|
||||
/// <param name="account"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<bool> DeleteAccount(string id)
|
||||
public override async Task<bool> DeleteAccount(string account)
|
||||
{
|
||||
var client = CreateHttpClient();
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"id",id },
|
||||
{"name",account },
|
||||
};
|
||||
|
||||
var title = GetOpTitle("DeleteAccount", id);
|
||||
LogHelper.Info(title, id);
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync(this.DeleteUrl + "?" + Sign(map));
|
||||
@@ -315,13 +310,11 @@ namespace Hncore.Pass.Vpn.Service
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Error(title, content);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error(title, ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -335,44 +328,45 @@ namespace Hncore.Pass.Vpn.Service
|
||||
{
|
||||
var client = CreateHttpClient();
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"id",id },
|
||||
{"name",id },
|
||||
};
|
||||
var title = GetOpTitle("GetAccountInfo", id);
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync(this.searchAccountUrl + "?" + Sign(map));
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["status"].ToString();
|
||||
|
||||
Console.WriteLine("====================================================");
|
||||
Console.WriteLine(jo);
|
||||
Console.WriteLine("====================================================");
|
||||
if (status == "200")
|
||||
{
|
||||
var data = jo["data"];
|
||||
var trData = new OriginAccountModel
|
||||
{
|
||||
Id = data["id"].ToString(),
|
||||
Account = data["user"].ToString(),
|
||||
Id = data["name"].ToString(),
|
||||
Account = data["name"].ToString(),
|
||||
Pwd = data["passwd"].ToString(),
|
||||
AccountType = data["type"].ToString(),
|
||||
AccountType = data["mark"].ToString(),
|
||||
Package = "",
|
||||
ConnectCount = data["conn_max"].ToString(),
|
||||
ConnectCount = data["max_conn"].ToString(),
|
||||
RegistTime = data["add_time"].ToString(),
|
||||
EndTime = data["end_time"].ToString(),
|
||||
RestTime = "",
|
||||
Amount = data["money"].ToString(),
|
||||
Remark = data["details"].ToString(),
|
||||
Amount = data["balance"].ToString(),
|
||||
Remark = data["mark"].ToString(),
|
||||
};
|
||||
return new ApiResult<OriginAccountModel>(trData);
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = jo["info"].ToString();
|
||||
LogHelper.Error(title, content);
|
||||
return new ApiResult<OriginAccountModel>(ResultCode.C_INVALID_ERROR, "没有查询到信息");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error(title, ex.Message);
|
||||
return new ApiResult<OriginAccountModel>(ResultCode.C_INVALID_ERROR, "查询失败");
|
||||
}
|
||||
|
||||
@@ -388,11 +382,9 @@ namespace Hncore.Pass.Vpn.Service
|
||||
{
|
||||
var client = CreateHttpClient();
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"id",Raw },
|
||||
{"user",account },
|
||||
{"name",account },
|
||||
{"passwd",pwd },
|
||||
};
|
||||
LogHelper.Info(GetOpTitle("UpdateAccountPwd", account), map.ToJson());
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync(this.UpdateUrl + "?" + Sign(map));
|
||||
@@ -441,44 +433,44 @@ namespace Hncore.Pass.Vpn.Service
|
||||
public override async Task<ApiResult<List<OriginAccountOnlineModel>>> OnLine(string account)
|
||||
{
|
||||
var client = CreateHttpClient();
|
||||
// client.BaseAddress = new Url("http://dl.91ip.vip/");
|
||||
var title = GetOpTitle("OnLine", account);
|
||||
var info = "";
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync(this.OnlineUrl+ "user="+account);
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
var parser = new HtmlParser();
|
||||
var document = await parser.ParseDocumentAsync(content);
|
||||
var trs = document.QuerySelectorAll("table.table tr").ToList();
|
||||
var retData = new List<OriginAccountOnlineModel>();
|
||||
if (trs.Count() > 1)
|
||||
{
|
||||
foreach (var tr in trs.Skip(1))
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"name",account },
|
||||
};
|
||||
|
||||
var resp = await client.GetAsync(this.OnlineUrl + "?" + Sign(map));
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
|
||||
var status = jo["status"].ToString();
|
||||
var retData = new List<OriginAccountOnlineModel>();
|
||||
if (status =="200")
|
||||
{
|
||||
if(jo["data"]["total"].ToInt()>0){
|
||||
foreach (var tr in jo["data"]["items"])
|
||||
{
|
||||
var tds = tr.QuerySelectorAll("td").ToList();
|
||||
var tdAccount = tds[0].FirstChild.TextContent;
|
||||
|
||||
if (tdAccount != account)
|
||||
continue;
|
||||
info = string.Join("", tds.Select(m => m.OuterHtml));
|
||||
JObject jsondata = (JObject)JsonConvert.DeserializeObject(tr.ToJson());
|
||||
|
||||
var trData = new OriginAccountOnlineModel
|
||||
{
|
||||
Account = account,
|
||||
ServerIP = tds[1].TextContent,
|
||||
OnlineTime = tds[2].TextContent,
|
||||
ServerIP = jsondata["ip"].ToString(),
|
||||
LoginTime = "",
|
||||
OnlineTime = "",
|
||||
LoginIP = jsondata["user_ip"].ToString(),
|
||||
UpStream = "",
|
||||
DownStream = "",
|
||||
Id= jsondata["id"].ToString(),
|
||||
|
||||
};
|
||||
var href = tr.LastElementChild.QuerySelector("a")?.Attributes["href"]?.Value;
|
||||
trData.Id = href;
|
||||
|
||||
retData.Add(trData);
|
||||
}
|
||||
}
|
||||
return new ApiResult<List<OriginAccountOnlineModel>>(retData);
|
||||
}
|
||||
catch (Exception ex)
|
||||
else
|
||||
{
|
||||
LogHelper.Error(title, ex.Message + "-->info:" + info);
|
||||
return new ApiResult<List<OriginAccountOnlineModel>>(ResultCode.C_INVALID_ERROR, "查询失败");
|
||||
return new ApiResult<List<OriginAccountOnlineModel>>(ResultCode.C_INVALID_ERROR, "查询失败");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -492,9 +484,12 @@ namespace Hncore.Pass.Vpn.Service
|
||||
var client = CreateHttpClient();
|
||||
var title = GetOpTitle("KillOut", id);
|
||||
var info = "";
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"id",id },
|
||||
};
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync(id);
|
||||
var resp = await client.GetAsync("v1/olnstop?" + Sign(map));
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace Hncore.Pass.Vpn.Service
|
||||
var agent = GetAgent(product);
|
||||
agent.Init(product.BaseUrl, product.Token);
|
||||
var account = item.Account;
|
||||
if (product.GroupNO == "g7") account = item.Raw;
|
||||
// if (product.GroupNO == "g7") account = item.Raw;
|
||||
var ret = await agent.GetAccountInfo(account);
|
||||
if (ret.Code == ResultCode.C_SUCCESS)
|
||||
retList.Add(ret.Data as OriginAccountModel);
|
||||
@@ -150,12 +150,12 @@ namespace Hncore.Pass.Vpn.Service
|
||||
var product = await m_ProductService.GetById(productId);
|
||||
var agent = GetAgent(product);
|
||||
agent.Init(product.BaseUrl, product.Token);
|
||||
if (product.GroupNO == "g7")
|
||||
{
|
||||
var accountInfo = await GetProductAccount(productId, account);
|
||||
if (accountInfo != null && accountInfo.Raw.Has())
|
||||
account = accountInfo.Raw;
|
||||
}
|
||||
// if (product.GroupNO == "g7")
|
||||
// {
|
||||
// var accountInfo = await GetProductAccount(productId, account);
|
||||
// if (accountInfo != null && accountInfo.Raw.Has())
|
||||
// account = accountInfo.Raw;
|
||||
// }
|
||||
var ret = await agent.GetAccountInfo(account);
|
||||
if (ret.Code != ResultCode.C_SUCCESS && product.Id!=17&& product.Id!=13) return new ApiResult<OriginAccountModel>(ResultCode.C_NOT_EXISTS_ERROR, "账号不存在");
|
||||
if (pwd.Has()&&ret.Data.Pwd != pwd && product.Id!=17&& product.Id!=13)
|
||||
@@ -172,12 +172,12 @@ namespace Hncore.Pass.Vpn.Service
|
||||
foreach (var item in accounts)
|
||||
{
|
||||
var account = item;
|
||||
if (product.GroupNO == "g7")
|
||||
{
|
||||
var accountInfo = await GetProductAccount(productId, item);
|
||||
if (accountInfo != null && accountInfo.Raw.Has())
|
||||
account = accountInfo.Raw;
|
||||
}
|
||||
// if (product.GroupNO == "g7")
|
||||
// {
|
||||
// var accountInfo = await GetProductAccount(productId, item);
|
||||
// if (accountInfo != null && accountInfo.Raw.Has())
|
||||
// account = accountInfo.Raw;
|
||||
// }
|
||||
var ret = await agent.GetAccountInfo(account);
|
||||
if (ret.Code == ResultCode.C_SUCCESS)
|
||||
{
|
||||
@@ -256,12 +256,12 @@ namespace Hncore.Pass.Vpn.Service
|
||||
{
|
||||
var package = await m_ProductPackageService.GetById(packageId);
|
||||
var product = await m_ProductService.GetById(package.ProductId);
|
||||
if (product.GroupNO == "g7")
|
||||
{
|
||||
var accountInfo = await GetProductAccount(package.ProductId, account);
|
||||
if (accountInfo != null && accountInfo.Raw.Has())
|
||||
account = accountInfo.Raw;
|
||||
}
|
||||
// if (product.GroupNO == "g7")
|
||||
// {
|
||||
// var accountInfo = await GetProductAccount(package.ProductId, account);
|
||||
// if (accountInfo != null && accountInfo.Raw.Has())
|
||||
// account = accountInfo.Raw;
|
||||
// }
|
||||
var agent = GetAgent(product);
|
||||
agent.Init(product.BaseUrl, product.Token);
|
||||
ApiResult flagResult = new ApiResult(ResultCode.C_SUCCESS);
|
||||
@@ -312,12 +312,12 @@ namespace Hncore.Pass.Vpn.Service
|
||||
var product = await m_ProductService.GetById(productId);
|
||||
var agent = GetAgent(product);
|
||||
agent.Init(product.BaseUrl, product.Token);
|
||||
if (product.GroupNO == "g7")
|
||||
{
|
||||
var accountInfo = await GetProductAccount(productId, account);
|
||||
if (accountInfo != null && accountInfo.Raw.Has())
|
||||
agent.Raw = accountInfo.Raw;
|
||||
}
|
||||
// if (product.GroupNO == "g7")
|
||||
// {
|
||||
// var accountInfo = await GetProductAccount(productId, account);
|
||||
// if (accountInfo != null && accountInfo.Raw.Has())
|
||||
// agent.Raw = accountInfo.Raw;
|
||||
// }
|
||||
return await agent.UpdateAccountPwd(account, pwd);
|
||||
}
|
||||
/// <summary>
|
||||
@@ -332,11 +332,11 @@ namespace Hncore.Pass.Vpn.Service
|
||||
var agent = GetAgent(product);
|
||||
agent.Init(product.BaseUrl, product.Token);
|
||||
var account = accountInfo.Account;
|
||||
if (product.GroupNO == "g7")
|
||||
{
|
||||
if (accountInfo != null && accountInfo.Raw.Has())
|
||||
account = accountInfo.Raw;
|
||||
}
|
||||
// if (product.GroupNO == "g7")
|
||||
// {
|
||||
// if (accountInfo != null && accountInfo.Raw.Has())
|
||||
// account = accountInfo.Raw;
|
||||
// }
|
||||
var flag = await agent.Refund(account, package.OriginKey, accountInfo.RestDay);
|
||||
return flag;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user