diff --git a/Host/Views.Mobile/LineList/Index.cshtml b/Host/Views.Mobile/LineList/Index.cshtml index e2153af..380250c 100644 --- a/Host/Views.Mobile/LineList/Index.cshtml +++ b/Host/Views.Mobile/LineList/Index.cshtml @@ -41,7 +41,7 @@
+ @if (item.Product.Id == 20) { +
+ + +
+
+
+ + +
+ }

需求5个以上,可以联系客服设置优惠价; diff --git a/Host/Views.Mobile/Product/Soft.cshtml b/Host/Views.Mobile/Product/Soft.cshtml index ca3057f..5f56074 100644 --- a/Host/Views.Mobile/Product/Soft.cshtml +++ b/Host/Views.Mobile/Product/Soft.cshtml @@ -29,11 +29,17 @@ {

@*

*@ -

@item.Name

-

+

@item.Name

+ @if (item.Id != 20){ +

+ } @if (!string.IsNullOrEmpty(item.DroidDownloadUrl)){


+ } else if (item.Id == 20) { +

+ +

}
} diff --git a/Host/Views.Mobile/User/IndexInfo.cshtml b/Host/Views.Mobile/User/IndexInfo.cshtml index 6a19cfb..860c40e 100644 --- a/Host/Views.Mobile/User/IndexInfo.cshtml +++ b/Host/Views.Mobile/User/IndexInfo.cshtml @@ -133,7 +133,7 @@ 余额 - + @* *@
diff --git a/Host/Views/LineList/Index.cshtml b/Host/Views/LineList/Index.cshtml index 340803d..d06ec95 100644 --- a/Host/Views/LineList/Index.cshtml +++ b/Host/Views/LineList/Index.cshtml @@ -52,7 +52,7 @@

*聚IP商城全线服务器都已更新,可显示实时维护状态及服务器负载情况*

*线路表和账号必须为同一产品才能使用。

- @foreach (var item in product.Where(m => m.Id != 3 && m.Id != 7 && m.Id != 9)) + @foreach (var item in product.Where(m => m.Id != 3 && m.Id != 7 && m.Id != 9&& m.Id != 20)) {
@item.Name diff --git a/Host/Views/Product/Index.cshtml b/Host/Views/Product/Index.cshtml index ca509cc..d8b406c 100644 --- a/Host/Views/Product/Index.cshtml +++ b/Host/Views/Product/Index.cshtml @@ -393,7 +393,7 @@ } else if(item.Product.Id == 20) {
-
\ No newline at end of file +
+ + + + + \ No newline at end of file diff --git a/Host/Views/User/Index.cshtml b/Host/Views/User/Index.cshtml index c7e60eb..79387c6 100644 --- a/Host/Views/User/Index.cshtml +++ b/Host/Views/User/Index.cshtml @@ -489,7 +489,7 @@
-
余额资金转移
+
余额

提现

充值

¥@Model.UserModel.RestAmount
diff --git a/Services/Hncore.Pass.BaseInfo/Service/UserService.cs b/Services/Hncore.Pass.BaseInfo/Service/UserService.cs index 35d4a73..cbe0a0c 100644 --- a/Services/Hncore.Pass.BaseInfo/Service/UserService.cs +++ b/Services/Hncore.Pass.BaseInfo/Service/UserService.cs @@ -248,7 +248,7 @@ namespace Hncore.Pass.BaseInfo.Service return new ApiResult(ResultCode.C_SUCCESS,"重置成功"); } - public async Task UpdateAmount(UpdateAmountRequest request) + public async Task UpdateAmount(UpdateAmountRequest request,String product="",String package="",String account="") { using (await _mutex1.LockAsync()) { @@ -258,7 +258,10 @@ namespace Hncore.Pass.BaseInfo.Service if (request.Amount <= 0) return new ApiResult(ResultCode.C_INVALID_ERROR, "金额必须大于0"); - + var remark = request.AttchInfo; + if (product != "") { + remark = product+"-"+package+"-"+account; + } var userScore = new UserScore() { @@ -267,7 +270,7 @@ namespace Hncore.Pass.BaseInfo.Service ScoreType = request.OpAmountType, ScoreValue = request.Amount, ScoreTypeName = request.OpAmountType.GetEnumDisplayName(), - Remark = request.AttchInfo, + Remark = remark, OperateUserName = request.OperateUserName }; diff --git a/Services/Hncore.Pass.Vpn/Service/AgentClient15Service.cs b/Services/Hncore.Pass.Vpn/Service/AgentClient15Service.cs new file mode 100644 index 0000000..e5926eb --- /dev/null +++ b/Services/Hncore.Pass.Vpn/Service/AgentClient15Service.cs @@ -0,0 +1,534 @@ +using AngleSharp.Html.Parser; +using Hncore.Infrastructure.Common; +using Hncore.Infrastructure.Extension; +using Hncore.Infrastructure.Serializer; +using Hncore.Infrastructure.WebApi; +using Hncore.Pass.Vpn.Model; +using Hncore.Pass.Vpn.Request.Product; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Text; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.IO; +using System.Threading.Tasks; +namespace Hncore.Pass.Vpn.Service +{ + public class AgentClient15Service:AgentClientBaseService + { + string LoginUrl { get; set; } = "api/login"; + string LoginCodeUrl { get; set; } = "main/imgcode.html"; + string RefrushTokenUrl { get; set; } = "agent/index.html"; + string SingleAddUrl { get; set; } = "api/number"; + string SingleReAddUrl { get; set; } = "api/number/renew"; + string MuiltAddUrl { get; set; } = "agent/memberMuiltAdd.html"; + string RefundUrl { get; set; } = "api/number/refund"; + string UpdateUrl = "api/number/";//agent/memberUpdate/id/1155709.html + string OnlineUrl { get; set; } = "api/numberLine/"; + string KIllUrl { get; set; } = "api/numberOffline"; + string searchAccountUrl = "api/numberSingle/"; + string searchTestAccountUrl = "api/numberSingle/"; + string DeleteUrl { get; set; } = "api/number/refund";//1160862.html"; + IHttpClientFactory m_HttpClientFactory; + public AgentClient15Service(IHttpClientFactory httpClientFactory):base(httpClientFactory) + { + m_HttpClientFactory = httpClientFactory; + } + + public override async Task RefrushStatus() + { + return 1; + } + public override async Task<(byte[], string)> GetCode() + { + var client = CreateHttpClient(false); + if (this.LoginUrl.NotHas()) return (null, ""); + var getResp = await client.GetAsync(this.LoginUrl); + var cookie = this.GetCookie(getResp, "PHPSESSID"); + if (cookie.Has()) + { + client.DefaultRequestHeaders.Add("Cookie", cookie); + var ret = await client.GetByteArrayAsync(this.LoginCodeUrl + "?t=" + DateTime.Now.Millisecond); + return (ret, cookie); + } + return (null, ""); + } + public override async Task Login(AgentLoginRequest request) + { + return new ApiResult(request.Key); + } + public override bool CheckAccount(int productId,List accounts) + { + return false; + } + + /// + /// 新开 + /// + /// + /// + /// + /// + public override async Task NewAccount(string packageKey, string account, string pwd, int connCount = 1, int accountType = 1, int payCount = 1) + { + string[] arrStr = packageKey.Split('.'); + var time =arrStr[0]; + var type =arrStr[1]; + var speed =arrStr[2]; + + + // 获取token + var url = "api/auth/access_token"; + var client = CreateHttpClient(); + var map = new Dictionary(){ + {"app_id","416" }, + {"app_key","882453f7cdb7525a4362d1776e937086" }, + }; + var resp = await client.PostAsForm(url, map); + var content = await resp.Content.ReadAsStringAsync(); + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var token = jo["data"]["access_token"]; + //正式请求 + var url_p = "api/user/user_add_rand"; + var client_p = CreateHttpClient(); + var map_p = new Dictionary(){ + {"access_token",token.ToString() }, + {"username",account}, + {"userpass",pwd}, + {"qq","123456789"}, + {"time",time}, + {"num","1"}, + {"type",type}, + {"ip","1"}, + {"remark","api开通"}, + {"speed",speed}, + }; + var resp_p = await client_p.PostAsForm(url_p, map_p); + var content_p = await resp_p.Content.ReadAsStringAsync(); + JObject jo_p = (JObject)JsonConvert.DeserializeObject(content_p); + Console.WriteLine("========================================开号============================================"); + Console.WriteLine(content_p); + Console.WriteLine(jo_p); + Console.WriteLine("====================================================================================="); + var status = jo_p["data"]["addnew"].ToString(); + if (status =="1") + { + return new ApiResult(ResultCode.C_SUCCESS); + } + else + { + return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败"); + } + } + + /// + /// 新开 + /// + /// + /// + /// + /// + public override async Task NewMuiltAccount(string packageKey, string account, string pwd, int connCount = 1, int accountType = 1,int startNum=0, int endNum=1 ) + { + var client = CreateHttpClient(); + var map = new Dictionary(){ + {"group","single" }, + {"number",account }, + {"password",pwd }, + {"connect",connCount.ToString()}, + {"interval","1"}, + {"type",packageKey}, + {"body","api"}, + {"mobile","13073735878"} + }; + var title = GetOpTitle("NewAccount", account); + LogHelper.Info(title, map.ToJson()); + try + { + var resp = await client.PostAsForm(this.SingleAddUrl, map); + var content = await resp.Content.ReadAsStringAsync(); + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var status = jo["status"].ToString(); + if (status =="400") + { + return new ApiResult(ResultCode.C_SUCCESS); + } + else + { + LogHelper.Error(title, content); + return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败"); + } + } + catch (Exception ex) + { + LogHelper.Error(title, ex.Message); + return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败"); + } + } + + /// + /// 续费 + /// + /// + /// + /// + /// + public override async Task NewReAccount(string packageKey, string account, int connCount, int payCount = 1) + { + + string[] arrStr = packageKey.Split('.'); + var time =arrStr[0]; + var type =arrStr[1]; + var speed =arrStr[2]; + + // 获取token + var url = "api/auth/access_token"; + var client = CreateHttpClient(); + var map = new Dictionary(){ + {"app_id","416" }, + {"app_key","882453f7cdb7525a4362d1776e937086" }, + }; + var resp = await client.PostAsForm(url, map); + var content = await resp.Content.ReadAsStringAsync(); + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var token = jo["data"]["access_token"]; + //正式请求 + var url_p = "api/user/user_renew_vpn"; + var client_p = CreateHttpClient(); + var map_p = new Dictionary(){ + {"access_token",token.ToString() }, + {"username[]",account}, + {"days",time}, + }; + var resp_p = await client_p.PostAsForm(url_p, map_p); + var content_p = await resp_p.Content.ReadAsStringAsync(); + JObject jo_p = (JObject)JsonConvert.DeserializeObject(content_p); + Console.WriteLine("========================================开号============================================"); + Console.WriteLine(content_p); + Console.WriteLine(jo_p); + Console.WriteLine("====================================================================================="); + var status = jo_p["data"]["renew"].ToString(); + if (status =="1") + { + return new ApiResult(1); + } + else + { + return new ApiResult(ResultCode.C_INVALID_ERROR, "续费失败"); + } + } + /// + /// 删除账号 + /// + /// + /// + /// + public override async Task DeleteAccount(string account) + { + Random rd = new Random(Guid.NewGuid().GetHashCode()); + int i = rd.Next(); + + var time_s = DateTime.Now.GetUnixTimeStamp(); + var agentid = "admin1"; + var nonce = MD5(time_s.ToString()) + i.ToString(); + var apikey = "b220b83508db57f44e5ce86a7b34cae9"; + var sign = MD5(time_s+nonce+apikey); + + + var url = "/api/raduserRefund?agentid="+agentid+"&ti="+time_s+"&nonce="+nonce+"&sign="+sign+"&username="+account; + + var client = CreateHttpClient(); + + var resp = await client.GetAsync(url); + var content = await resp.Content.ReadAsStringAsync(); + Console.WriteLine("=============================================================="); + Console.WriteLine(content); + Console.WriteLine("=============================================================="); + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var status = jo["errcode"].ToString(); + + if (status =="0") + { + return true; + } + else + { + return false; + } + } + /// + /// 得到账号信息 + /// + /// + /// + /// + public override async Task> GetAccountInfo(string account,bool isTest=false) + { + + Random rd = new Random(Guid.NewGuid().GetHashCode()); + int i = rd.Next(); + + var time_s = DateTime.Now.GetUnixTimeStamp(); + var agentid = "admin1"; + var nonce = MD5(time_s.ToString()) + i.ToString(); + var apikey = "b220b83508db57f44e5ce86a7b34cae9"; + var sign = MD5(time_s+nonce+apikey); + + var url = "/api/raduserInfo?agentid="+agentid+"&ti="+time_s+"&nonce="+nonce+"&sign="+sign+"&username="+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["errcode"].ToString(); + var data = jo["data"]; + if (status =="0") + { + var trData = new OriginAccountModel + { + Id = "", + Account = data["username"].ToString(), + Pwd = data["password"].ToString(), + AccountType = "", + Package = "", + ConnectCount = "", + RegistTime = data["createtime"].ToString(), + EndTime = data["expiretime"].ToString(), + RestTime = "", + Amount = "", + Remark = "", + }; + return new ApiResult(trData); + } + else + { + return new ApiResult(ResultCode.C_INVALID_ERROR, "没有查询到信息"); + } + + + + } + /// + /// 修改账号密码 + /// + /// + /// + /// + /// + public override async Task UpdateAccountPwd(string account, string pwd) + { + + // 获取token + var url = "api/auth/access_token"; + var client = CreateHttpClient(); + var map = new Dictionary(){ + {"app_id","416" }, + {"app_key","882453f7cdb7525a4362d1776e937086" }, + }; + var resp = await client.PostAsForm(url, map); + var content = await resp.Content.ReadAsStringAsync(); + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var token = jo["data"]["access_token"]; + //正式请求 + var url_p = "api/user/user_repass"; + var client_p = CreateHttpClient(); + var map_p = new Dictionary(){ + {"access_token",token.ToString() }, + {"username",account}, + {"newpass",pwd}, + }; + var resp_p = await client_p.PostAsForm(url_p, map_p); + var content_p = await resp_p.Content.ReadAsStringAsync(); + JObject jo_p = (JObject)JsonConvert.DeserializeObject(content_p); + return true; + + } + /// + /// 退款 + /// + /// + /// + /// + public override async Task Refund(string account, string packageKey, int days) + { + Random rd = new Random(Guid.NewGuid().GetHashCode()); + int i = rd.Next(); + + var time_s = DateTime.Now.GetUnixTimeStamp(); + var agentid = "admin1"; + var nonce = MD5(time_s.ToString()) + i.ToString(); + var apikey = "b220b83508db57f44e5ce86a7b34cae9"; + var sign = MD5(time_s+nonce+apikey); + + + + var url = "/api/raduserRefund?agentid="+agentid+"&ti="+time_s+"&nonce="+nonce+"&sign="+sign+"&username="+account; + + var client = CreateHttpClient(); + + var resp = await client.GetAsync(url); + var content = await resp.Content.ReadAsStringAsync(); + Console.WriteLine("=============================================================="); + Console.WriteLine(content); + Console.WriteLine("=============================================================="); + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var status = jo["errcode"].ToString(); + + if (status =="0") + { + return new ApiResult(1); + } + return new ApiResult(ResultCode.C_INVALID_ERROR, "退款失败"); + + } + /// + /// 是否在线 + /// + /// + /// + /// + public override async Task>> OnLine(string account) + { + + Random rd = new Random(Guid.NewGuid().GetHashCode()); + int i = rd.Next(); + + var time_s = DateTime.Now.GetUnixTimeStamp(); + var agentid = "admin1"; + var nonce = MD5(time_s.ToString()) + i.ToString(); + var apikey = "b220b83508db57f44e5ce86a7b34cae9"; + var sign = MD5(time_s+nonce+apikey); + + var url = "/api/raduserAcct?agentid="+agentid+"&ti="+time_s+"&nonce="+nonce+"&sign="+sign+"&username="+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["errcode"].ToString(); + var retData = new List(); + if (status =="0") + { + if(jo.ContainsKey("data")){ + foreach (var tr in jo["data"]) + { + JObject jsondata = (JObject)JsonConvert.DeserializeObject(tr.ToJson()); + + var trData = new OriginAccountOnlineModel + { + Account = account, + ServerIP = jsondata["serverip"].ToString(), + LoginTime = jsondata["starttime"].ToString(), + OnlineTime = "", + LoginIP = jsondata["framedip"].ToString(), + UpStream = "", + DownStream = "", + Id= "{account:\""+account+"\",radacctid:\""+jsondata["radacctid"].ToString()+"\"}", + + }; + + retData.Add(trData); + } + } + return new ApiResult>(retData); + } + else + { + return new ApiResult>(ResultCode.C_INVALID_ERROR, "查询失败"); + } + + } + /// + /// 踢号 + /// + /// + /// + /// + public override async Task KillOut( string id) + { + + Random rd = new Random(Guid.NewGuid().GetHashCode()); + int i = rd.Next(); + + var time_s = DateTime.Now.GetUnixTimeStamp(); + var agentid = "admin1"; + var nonce = MD5(time_s.ToString()) + i.ToString(); + var apikey = "b220b83508db57f44e5ce86a7b34cae9"; + var sign = MD5(time_s+nonce+apikey); + + JObject userinfo = (JObject)JsonConvert.DeserializeObject(id); + + var url = "/api/raduserDisconnect?agentid="+agentid+"&ti="+time_s+"&nonce="+nonce+"&sign="+sign+"&username="+userinfo["account"]+"&radacctid="+userinfo["radacctid"]; + + var client = CreateHttpClient(); + var title = GetOpTitle("KillOut", id); + var info = ""; + + + try + { + + var resp = await client.GetAsync(url); + var content = await resp.Content.ReadAsStringAsync(); + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var status = jo["errcode"].ToString(); + if (status =="0") + { + return true; + } + } + catch (Exception ex) + { + LogHelper.Error(title, ex.Message + "-->info:" + info); + } + return false; + } + + /// + /// 是否存在 + /// + /// + /// + public override async Task Exist(string account) + { + + // 获取token + var url = "api/auth/access_token"; + var client = CreateHttpClient(); + var map = new Dictionary(){ + {"app_id","416" }, + {"app_key","882453f7cdb7525a4362d1776e937086" }, + }; + var resp = await client.PostAsForm(url, map); + var content = await resp.Content.ReadAsStringAsync(); + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var token = jo["data"]["access_token"]; + Console.WriteLine("========================================12321============================================="); + Console.WriteLine(token); + Console.WriteLine("====================================================================================="); + return true; + //正式请求 + var url_p = "api/auth/check_user"; + var client_p = CreateHttpClient(); + var map_p = new Dictionary(){ + {"access_token",token.ToString() }, + {"username",account}, + }; + var resp_p = await client_p.PostAsForm(url_p, map_p); + var content_p = await resp_p.Content.ReadAsStringAsync(); + JObject jo_p = (JObject)JsonConvert.DeserializeObject(content_p); + var is_exit = jo_p["data"]["check"]; + if (is_exit.ToString() =="1") + { + return false; + } + return true; + } + } +} diff --git a/Services/Hncore.Pass.Vpn/Service/AgentService.cs b/Services/Hncore.Pass.Vpn/Service/AgentService.cs index ea10d34..e0220fd 100644 --- a/Services/Hncore.Pass.Vpn/Service/AgentService.cs +++ b/Services/Hncore.Pass.Vpn/Service/AgentService.cs @@ -71,6 +71,8 @@ namespace Hncore.Pass.Vpn.Service agent = new AgentClient13Service(m_HttpClientFactory) { ClientName = product.GroupNO }; if (product.GroupNO == "g14") agent = new AgentClient14Service(m_HttpClientFactory) { ClientName = product.GroupNO }; + if (product.GroupNO == "g15") + agent = new AgentClient15Service(m_HttpClientFactory) { ClientName = product.GroupNO }; agent.Product = product; return agent; }