先锋 神龙
This commit is contained in:
@@ -14,6 +14,8 @@ using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
namespace Hncore.Pass.Vpn.Service
|
||||
{
|
||||
//先锋
|
||||
@@ -26,7 +28,6 @@ namespace Hncore.Pass.Vpn.Service
|
||||
string SingleReAddUrl { get; set; } = "agent/memberRenew.html";
|
||||
string MuiltAddUrl { get; set; } = "agent/memberMuiltAdd.html";
|
||||
string RefundUrl { get; set; } = "agent/memberRefund/id/{0}.html";
|
||||
string UpdateUrl = "agent/memberUpdate/id/{0}.html";//agent/memberUpdate/id/1155709.html
|
||||
string OnlineUrl { get; set; } = "agent/radiusOnline.html?search=1&username=";
|
||||
string ClientOnlineUrl { get; set; } = "agent/clientOnline.html?search=1&username=";
|
||||
string KIllUrl { get; set; } = "";
|
||||
@@ -51,14 +52,9 @@ namespace Hncore.Pass.Vpn.Service
|
||||
public override async Task<ApiResult> NewAccount(string packageKey, string account, string pwd, int connCount = 1, int accountType = 1, int payCount = 1)
|
||||
{
|
||||
|
||||
if(packageKey == "free"){
|
||||
return await NewTestAccount(packageKey, account, pwd, 1, accountType, 1);
|
||||
}
|
||||
var password = "y8sPoSPLUJvl6wjFzH70cQ==";
|
||||
|
||||
var secretId = "626B6170693231";
|
||||
var secretKey = "6b3fdfc206841f44c6609bf19c182a6a";
|
||||
|
||||
var url = "http://bkapi.pptp.biz/userapi/?secretId="+secretId+"&secretKey="+secretKey+"&type=adduser&user="+account+"&pass="+pwd+"&serverid="+packageKey+"&logincount="+connCount.ToString()+"&phone=17719092232&cardname=万永康&cardno=410325199810129916";
|
||||
var url = "http://webapi.shenlongip.com/buyvpn?username=admin1&password="+password+"&mealId="+packageKey+"&vpnAccount="+account+"&vpnPassword="+pwd+"&links="+connCount;
|
||||
|
||||
var client = CreateHttpClient();
|
||||
|
||||
@@ -70,7 +66,7 @@ namespace Hncore.Pass.Vpn.Service
|
||||
|
||||
|
||||
|
||||
if (status =="1")
|
||||
if (status =="0")
|
||||
{
|
||||
return new ApiResult(ResultCode.C_SUCCESS);
|
||||
}
|
||||
@@ -99,12 +95,6 @@ namespace Hncore.Pass.Vpn.Service
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["code"].ToString();
|
||||
|
||||
Console.WriteLine("==================================================");
|
||||
Console.WriteLine(jo);
|
||||
Console.WriteLine("==================================================");
|
||||
|
||||
|
||||
|
||||
|
||||
if (status =="1")
|
||||
{
|
||||
@@ -122,11 +112,10 @@ namespace Hncore.Pass.Vpn.Service
|
||||
/// <returns></returns>
|
||||
public override async Task<ApiResult> NewReAccount(string packageKey, string account, int connCount, int payCount = 1)
|
||||
{
|
||||
|
||||
var password = "y8sPoSPLUJvl6wjFzH70cQ==";
|
||||
|
||||
var secretId = "626B6170693231";
|
||||
var secretKey = "6b3fdfc206841f44c6609bf19c182a6a";
|
||||
|
||||
var url = "http://bkapi.pptp.biz/userapi/?secretId="+secretId+"&secretKey="+secretKey+"&type=buy&user="+account+"&serverid="+packageKey+"&logincount="+connCount.ToString()+"&phone=17719092232&cardname=万永康&cardno=410325199810129916";
|
||||
var url = "http://webapi.shenlongip.com/renewvpn?username=admin1&password="+password+"&mealId="+packageKey+"&vpnAccount="+account;
|
||||
|
||||
var client = CreateHttpClient();
|
||||
|
||||
@@ -135,8 +124,7 @@ namespace Hncore.Pass.Vpn.Service
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["code"].ToString();
|
||||
|
||||
|
||||
if (status =="1")
|
||||
if (status =="0")
|
||||
{
|
||||
return new ApiResult(1);
|
||||
}
|
||||
@@ -151,6 +139,7 @@ namespace Hncore.Pass.Vpn.Service
|
||||
/// <returns></returns>
|
||||
public override async Task<bool> DeleteAccount(string account)
|
||||
{
|
||||
return false;
|
||||
var client = CreateHttpClient();
|
||||
var infoRet = await this.GetAccountInfo(account, true);
|
||||
if (infoRet.Code != ResultCode.C_SUCCESS)
|
||||
@@ -189,10 +178,10 @@ namespace Hncore.Pass.Vpn.Service
|
||||
public override async Task<ApiResult<OriginAccountModel>> GetAccountInfo(string account,bool isTest=false)
|
||||
{
|
||||
|
||||
var secretId = "626B6170693231";
|
||||
var secretKey = "6b3fdfc206841f44c6609bf19c182a6a";
|
||||
|
||||
var password = "y8sPoSPLUJvl6wjFzH70cQ==";
|
||||
|
||||
var url = "http://bkapi.pptp.biz/userapi/?secretId="+secretId+"&secretKey="+secretKey+"&type=getuserinfo&user="+account;
|
||||
var url = "http://webapi.shenlongip.com/searchvpn?username=admin1&password="+password+"&vpnAccount="+account;
|
||||
|
||||
var client = CreateHttpClient();
|
||||
|
||||
@@ -201,23 +190,18 @@ namespace Hncore.Pass.Vpn.Service
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["code"].ToString();
|
||||
|
||||
Console.WriteLine("---------------------------------------------------------------");
|
||||
Console.WriteLine(jo);
|
||||
Console.WriteLine("---------------------------------------------------------------");
|
||||
|
||||
|
||||
if (status =="1")
|
||||
if (status =="0")
|
||||
{
|
||||
var trData = new OriginAccountModel
|
||||
{
|
||||
Account = account,
|
||||
Pwd = "",
|
||||
AccountType = "",
|
||||
Package = "",
|
||||
Pwd = jo["data"]["vpnPassword"].ToString(),
|
||||
AccountType = jo["data"]["mealType"].ToString(),
|
||||
Package = jo["data"]["mealType"].ToString(),
|
||||
RegistTime = "",
|
||||
EndTime = jo["expiretime"].ToString(),
|
||||
EndTime = "",
|
||||
RestTime = "",
|
||||
ConnectCount = jo["logincount"].ToString(),
|
||||
ConnectCount = jo["data"]["mealTylinkspe"].ToString(),
|
||||
Amount = "",
|
||||
IsActive = "",
|
||||
Remark = "",
|
||||
@@ -238,10 +222,9 @@ namespace Hncore.Pass.Vpn.Service
|
||||
public override async Task<bool> UpdateAccountPwd(string account, string pwd)
|
||||
{
|
||||
|
||||
var secretId = "626B6170693231";
|
||||
var secretKey = "6b3fdfc206841f44c6609bf19c182a6a";
|
||||
var password = "y8sPoSPLUJvl6wjFzH70cQ==";
|
||||
|
||||
var url = "http://bkapi.pptp.biz/userapi/?secretId="+secretId+"&secretKey="+secretKey+"&type=setuser&user="+account+"&&new_pwd="+pwd;
|
||||
var url = "http://webapi.shenlongip.com/vpnpasswd?username=admin1&password="+password+"&vpnAccount="+account+"&newVpnPasswd="+pwd;
|
||||
|
||||
var client = CreateHttpClient();
|
||||
|
||||
@@ -250,7 +233,8 @@ namespace Hncore.Pass.Vpn.Service
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["code"].ToString();
|
||||
|
||||
if (status =="1")
|
||||
|
||||
if (status =="0")
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
@@ -266,31 +250,24 @@ namespace Hncore.Pass.Vpn.Service
|
||||
/// <returns></returns>
|
||||
public override async Task<ApiResult> Refund(string account, string packageKey, int days)
|
||||
{
|
||||
var client = CreateHttpClient();
|
||||
var title = GetOpTitle("Refund", account);
|
||||
try
|
||||
var password = "y8sPoSPLUJvl6wjFzH70cQ==";
|
||||
|
||||
var url = "http://webapi.shenlongip.com/refundvpn?username=admin1&password="+password+"&vpnAccount="+account;
|
||||
|
||||
var client = CreateHttpClient();
|
||||
|
||||
var resp = await client.GetAsync(url);
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["code"].ToString();
|
||||
|
||||
|
||||
if (status =="0")
|
||||
{
|
||||
var accountInfo = await this.GetAccountInfo(account);
|
||||
if (accountInfo.Code != ResultCode.C_SUCCESS)
|
||||
{
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "退款失败");
|
||||
}
|
||||
var url = string.Format(this.RefundUrl, accountInfo.Data.Id);
|
||||
var resp = await client.GetAsync(url);
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
if (content.Has() && content.IndexOf("退款成功!") != -1)
|
||||
{
|
||||
return new ApiResult(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Error(title, content);
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "退款失败");
|
||||
}
|
||||
return new ApiResult(1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
else
|
||||
{
|
||||
LogHelper.Error(title, ex.Message);
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "退款失败");
|
||||
}
|
||||
}
|
||||
@@ -302,11 +279,11 @@ namespace Hncore.Pass.Vpn.Service
|
||||
/// <returns></returns>
|
||||
public override async Task<ApiResult<List<OriginAccountOnlineModel>>> OnLine(string account)
|
||||
{
|
||||
var retData = new List<OriginAccountOnlineModel>();
|
||||
|
||||
var secretId = "626B6170693231";
|
||||
var secretKey = "6b3fdfc206841f44c6609bf19c182a6a";
|
||||
var password = "y8sPoSPLUJvl6wjFzH70cQ==";
|
||||
|
||||
var url = "http://bkapi.pptp.biz/userapi3/?secretId="+secretId+"&secretKey="+secretKey+"&type=get_user_onlinelog&user="+account;
|
||||
var url = "http://webapi.shenlongip.com/searchvpn/links?username=admin1&password="+password+"&vpnAccount="+account;
|
||||
|
||||
var client = CreateHttpClient();
|
||||
|
||||
@@ -314,8 +291,9 @@ namespace Hncore.Pass.Vpn.Service
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["code"].ToString();
|
||||
var retData = new List<OriginAccountOnlineModel>();
|
||||
if (status =="1")
|
||||
|
||||
|
||||
if (status =="0")
|
||||
{
|
||||
if(jo.ContainsKey("data")){
|
||||
foreach (var tr in jo["data"])
|
||||
@@ -325,13 +303,13 @@ namespace Hncore.Pass.Vpn.Service
|
||||
var trData = new OriginAccountOnlineModel
|
||||
{
|
||||
Account = account,
|
||||
ServerIP = jsondata["server_ip"].ToString(),
|
||||
ServerIP = jsondata["clients"]["outIp"].ToString(),
|
||||
LoginTime = "",
|
||||
OnlineTime = jsondata["online_time"].ToString(),
|
||||
LoginIP = jsondata["client_ip"].ToString(),
|
||||
OnlineTime = "",
|
||||
LoginIP = jsondata["clients"]["userIp"].ToString(),
|
||||
UpStream = "",
|
||||
DownStream = "",
|
||||
Id = "user="+account+"-address="+jsondata["address"].ToString()+"-server_ip="+jsondata["server_ip"].ToString(),
|
||||
Id = account,
|
||||
|
||||
};
|
||||
|
||||
@@ -340,7 +318,7 @@ namespace Hncore.Pass.Vpn.Service
|
||||
}
|
||||
return new ApiResult<List<OriginAccountOnlineModel>>(retData);
|
||||
} else {
|
||||
return new ApiResult<List<OriginAccountOnlineModel>>(retData);
|
||||
return new ApiResult<List<OriginAccountOnlineModel>>();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -352,15 +330,10 @@ namespace Hncore.Pass.Vpn.Service
|
||||
/// <returns></returns>
|
||||
public override async Task<bool> KillOut(string id)
|
||||
{
|
||||
var ids = "";
|
||||
if(id.Contains("-")){
|
||||
string[] arrStr = id.Split('-');
|
||||
ids = arrStr[0]+"&"+arrStr[1]+"&"+arrStr[2];
|
||||
}
|
||||
var secretId = "626B6170693231";
|
||||
var secretKey = "6b3fdfc206841f44c6609bf19c182a6a";
|
||||
|
||||
var password = "y8sPoSPLUJvl6wjFzH70cQ==";
|
||||
|
||||
var url = "http://bkapi.pptp.biz/userapi3/?secretId="+secretId+"&secretKey="+secretKey+"&type=user_online_offline&"+ids;
|
||||
var url = "http://webapi.shenlongip.com/kickvpn?username=admin1&password="+password+"&vpnAccount="+id;
|
||||
|
||||
var client = CreateHttpClient();
|
||||
|
||||
@@ -368,7 +341,9 @@ namespace Hncore.Pass.Vpn.Service
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["code"].ToString();
|
||||
if (status =="1")
|
||||
|
||||
|
||||
if (status =="0")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -399,12 +374,9 @@ namespace Hncore.Pass.Vpn.Service
|
||||
|
||||
public override async Task<bool> Exist(string account)
|
||||
{
|
||||
|
||||
var password = "y8sPoSPLUJvl6wjFzH70cQ==";
|
||||
|
||||
var secretId = "626B6170693231";
|
||||
var secretKey = "6b3fdfc206841f44c6609bf19c182a6a";
|
||||
|
||||
var url = "http://bkapi.pptp.biz/userapi3/?secretId="+secretId+"&secretKey="+secretKey+"&type=getuserlenNum&user="+account;
|
||||
var url = "http://webapi.shenlongip.com/searchvpn?username=admin1&password="+password+"&vpnAccount="+account;
|
||||
|
||||
var client = CreateHttpClient();
|
||||
|
||||
@@ -413,18 +385,38 @@ namespace Hncore.Pass.Vpn.Service
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["code"].ToString();
|
||||
|
||||
|
||||
|
||||
Console.WriteLine("================test==================================");
|
||||
Console.WriteLine(jo);
|
||||
Console.WriteLine("==================================================");
|
||||
|
||||
|
||||
if (status =="1")
|
||||
if (status =="0")
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public string AesEncrypt(string content, string aesKey, string aesIV)
|
||||
{
|
||||
|
||||
byte[] byteKEY = Encoding.UTF8.GetBytes(aesKey);
|
||||
byte[] byteIV = Encoding.UTF8.GetBytes(aesIV);
|
||||
|
||||
byte[] byteContnet = Encoding.UTF8.GetBytes(content);
|
||||
|
||||
var _aes = new RijndaelManaged();
|
||||
_aes.Padding = PaddingMode.PKCS7;
|
||||
_aes.Mode = CipherMode.CBC;
|
||||
|
||||
_aes.Key = byteKEY;
|
||||
_aes.IV = byteIV;
|
||||
|
||||
var _crypto = _aes.CreateEncryptor(byteKEY, byteIV);
|
||||
byte[] decrypted = _crypto.TransformFinalBlock(
|
||||
byteContnet, 0, byteContnet.Length);
|
||||
|
||||
_crypto.Dispose();
|
||||
|
||||
return Convert.ToBase64String(decrypted);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user