先锋实名
This commit is contained in:
@@ -12,6 +12,8 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
namespace Hncore.Pass.Vpn.Service
|
||||
{
|
||||
//先锋
|
||||
@@ -48,36 +50,59 @@ 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 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 client = CreateHttpClient();
|
||||
var map = new Dictionary<string, string>(){
|
||||
{"taocanName",packageKey },
|
||||
{"username",account },
|
||||
{"password",pwd },
|
||||
{"bingfa",connCount.ToString()},
|
||||
{"type",accountType.ToString()},
|
||||
{"tel","17719092232"}
|
||||
};
|
||||
var title = GetOpTitle("NewAccount", account);
|
||||
LogHelper.Info(title, map.ToJson());
|
||||
try
|
||||
|
||||
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 =="1")
|
||||
{
|
||||
var resp = await client.PostAsForm(this.SingleAddUrl, map);
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
if (content.Has() && content.IndexOf("{alert(\"成功\")") != -1)
|
||||
{
|
||||
return new ApiResult(ResultCode.C_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Error(title, content);
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败");
|
||||
}
|
||||
return new ApiResult(ResultCode.C_SUCCESS);
|
||||
}
|
||||
catch (Exception ex)
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败");
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 续费
|
||||
/// </summary>
|
||||
/// <param name="productId"></param>
|
||||
/// <param name="account"></param>
|
||||
/// <param name="pwd"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<ApiResult> NewReAccount(string packageKey, string account, int connCount, int payCount = 1)
|
||||
{
|
||||
|
||||
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 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 =="1")
|
||||
{
|
||||
LogHelper.Error(title, ex.Message);
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败");
|
||||
return new ApiResult(1);
|
||||
}
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "续费失败");
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除账号
|
||||
@@ -358,5 +383,30 @@ namespace Hncore.Pass.Vpn.Service
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override async Task<bool> Exist(string account)
|
||||
{
|
||||
|
||||
|
||||
var secretId = "626B6170693231";
|
||||
var secretKey = "6b3fdfc206841f44c6609bf19c182a6a";
|
||||
|
||||
var url = "http://bkapi.pptp.biz/userapi3/?secretId="+secretId+"&secretKey="+secretKey+"&type=getuserlenNum&user="+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 =="1")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user