From 7528b74aae3e6abb8c09ddf9e51a28e71326ff8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cwanyongkang=E2=80=9D?= <“937888580@qq.com”> Date: Tue, 19 Apr 2022 16:50:04 +0800 Subject: [PATCH] mogu --- Host/Controllers/ProductController.cs | 10 +- Host/Views.Mobile/Product/Index.cshtml | 12 +- Host/Views.Mobile/Product/ReBuyIndex.cshtml | 2 +- Host/Views/LineList/Index.cshtml | 8 +- Host/Views/Product/Index.cshtml | 59 ++- Host/Views/Product/Soft.cshtml | 8 + .../Service/AgentClient15Service.cs | 55 +-- .../Service/AgentClient17Service.cs | 427 ++++++++++++++++++ .../Hncore.Pass.Vpn/Service/AgentService.cs | 2 + 9 files changed, 536 insertions(+), 47 deletions(-) create mode 100644 Services/Hncore.Pass.Vpn/Service/AgentClient17Service.cs diff --git a/Host/Controllers/ProductController.cs b/Host/Controllers/ProductController.cs index 897d0ea..8bdafc6 100644 --- a/Host/Controllers/ProductController.cs +++ b/Host/Controllers/ProductController.cs @@ -112,7 +112,7 @@ namespace Home.Controllers m.Title = "8"; } if (m.ProductId == 18){ - m.Title = "7"; + m.Title = "8"; } if (m.ProductId == 6||m.ProductId == 5){ m.Title = "9"; @@ -138,7 +138,7 @@ namespace Home.Controllers m.Title = "8"; } if (m.ProductId == 18){ - m.Title = "7"; + m.Title = "8"; } if (m.ProductId == 6||m.ProductId == 5){ m.Title = "9"; @@ -164,7 +164,7 @@ namespace Home.Controllers m.Title = "8"; } if (m.ProductId == 18){ - m.Title = "7"; + m.Title = "8"; } if (m.ProductId == 6||m.ProductId == 5){ m.Title = "9"; @@ -923,7 +923,7 @@ namespace Home.Controllers m.Title = "8"; } if (m.ProductId == 18){ - m.Title = "7"; + m.Title = "8"; } if (m.ProductId == 6||m.ProductId == 5){ m.Title = "9"; @@ -961,7 +961,7 @@ namespace Home.Controllers m.Title = "8"; } if (m.ProductId == 18){ - m.Title = "7"; + m.Title = "8"; } if (m.ProductId == 6||m.ProductId == 5){ m.Title = "9"; diff --git a/Host/Views.Mobile/Product/Index.cshtml b/Host/Views.Mobile/Product/Index.cshtml index e39d1e4..b5437b5 100644 --- a/Host/Views.Mobile/Product/Index.cshtml +++ b/Host/Views.Mobile/Product/Index.cshtml @@ -59,7 +59,7 @@ } else if(item.Product.Id == 18) { } else if(item.Product.Id == 1||item.Product.Id == 2||item.Product.Id == 13||item.Product.Id == 17||item.Product.Id == 19) { @@ -77,6 +77,16 @@ @item.Product.Name8折 } + + else if(item.Product.Id == 22) { +
  • + 静态IP +
  • + + + } else if(item.Product.Id == 21) {
  • diff --git a/Host/Views.Mobile/Product/ReBuyIndex.cshtml b/Host/Views.Mobile/Product/ReBuyIndex.cshtml index 58665db..dffe71d 100644 --- a/Host/Views.Mobile/Product/ReBuyIndex.cshtml +++ b/Host/Views.Mobile/Product/ReBuyIndex.cshtml @@ -55,7 +55,7 @@

    ·带宽6-10兆

    ·断开再链接换ip

    - @foreach (var package in Model.Packages.Where(m=>m.IsTest==0&&m.Status==1 && m.Id != 21).OrderBy(m => m.TenantId)) + @foreach (var package in Model.Packages.Where(m=>m.IsTest==0&&m.Status==1 && m.Id != 21&& m.Id != 20).OrderBy(m => m.TenantId)) { @if(package.Id == 101||package.Id == 103||package.Id == 104||(package.Id>103)){ diff --git a/Host/Views/LineList/Index.cshtml b/Host/Views/LineList/Index.cshtml index 99ac835..5d85a26 100644 --- a/Host/Views/LineList/Index.cshtml +++ b/Host/Views/LineList/Index.cshtml @@ -232,10 +232,10 @@ this.search_field = '蘑菇IP'; this.sstp = '4430'; break; - case 19: - this.l2tp = '123'; + case 22: + this.l2tp = '888888'; this.search_field = '火狐IP'; - this.sstp = '1500'; + this.sstp = '5908'; break; } $.ajax({ @@ -353,7 +353,7 @@ case 18: self.location.href='http://php-api.juip.com/script/linedata/data/download/mogu.csv'; break; - case 19: + case 22: self.location.href='http://php-api.juip.com/script/linedata/data/download/huohu.csv'; break; } diff --git a/Host/Views/Product/Index.cshtml b/Host/Views/Product/Index.cshtml index d57d725..6d7d9c4 100644 --- a/Host/Views/Product/Index.cshtml +++ b/Host/Views/Product/Index.cshtml @@ -174,7 +174,7 @@ height: 0px; border: 1.0rem solid #FF9933; border-right-color: transparent; - content: "7折+送 1 天"; + content: "8折"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -202,7 +202,7 @@ height: 0px; border: 1.0rem solid #FF9933; border-right-color: transparent; - content: "7折+送 3 天"; + content: "8折+送 1 天"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -231,7 +231,7 @@ height: 0px; border: 1.0rem solid #FF9933; border-right-color: transparent; - content: "7折+送 10 天"; + content: "8折+送 5 天"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -260,7 +260,7 @@ height: 0px; border: 1.0rem solid #FF9933; border-right-color: transparent; - content: "7折+送 1 月"; + content: "8折+送 1 月"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -364,7 +364,7 @@ @foreach (var item in Model) { if(item.Product.Id == 18) { -
    @item.Product.Name7折
    +
    @item.Product.Name8折
    } else if(item.Product.Id == 6) {
    @item.Product.Name9折
    @@ -407,6 +407,11 @@ } + else if(item.Product.Id == 22) { +
    静态IP
    +
    @item.Product.Name
    + + } else if(item.Product.Id == 21) { @@ -482,7 +487,7 @@ *@ } @if(item.Product.Id == 18){ -

    天卡买一送一,周卡送3天,月卡送10天,双月卡送1个月,聚IP年中回馈,赠送力度史无前例!
    (新开和续费都可参加,您可对同一账号多次续费都有赠送,每位会员不限账号数量,您可购买多个IP账号都有赠送)
    新产品上线,全新IP池!

    +

    周卡送1天,月卡送5天
    (新开和续费都可参加,您可对同一账号多次续费都有赠送,每位会员不限账号数量,您可购买多个IP账号都有赠送)
    新产品上线,全新IP池!

    本产品目前所有地区都屏蔽QQ微信

    @*
    查看详细地区
    *@ } + + @if(item.Product.Id == 6){ +
    点击查看屏蔽微信QQ的地区 +
    + } diff --git a/Host/Views/Product/Soft.cshtml b/Host/Views/Product/Soft.cshtml index cb0a3de..91517ee 100644 --- a/Host/Views/Product/Soft.cshtml +++ b/Host/Views/Product/Soft.cshtml @@ -138,6 +138,14 @@
    + +
    + +
    + +
    + +

    免安装,下载后直接打开

    diff --git a/Services/Hncore.Pass.Vpn/Service/AgentClient15Service.cs b/Services/Hncore.Pass.Vpn/Service/AgentClient15Service.cs index 874f981..3c1c720 100644 --- a/Services/Hncore.Pass.Vpn/Service/AgentClient15Service.cs +++ b/Services/Hncore.Pass.Vpn/Service/AgentClient15Service.cs @@ -101,7 +101,7 @@ namespace Hncore.Pass.Vpn.Service {"userpass",pwd}, {"qq","123456789"}, {"time",time}, - {"num","1"}, + {"num",connCount.ToString()}, {"type",type}, {"ip","1"}, {"remark","api开通"}, @@ -269,46 +269,41 @@ namespace Hncore.Pass.Vpn.Service 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; - + // 获取token + var url = "api/auth/access_token"; var client = CreateHttpClient(); - - var resp = await client.GetAsync(url); + 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 status = jo["errcode"].ToString(); - var data = jo["data"]; - if (status =="0") - { + 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}, + }; + 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 data = jo_p["data"]["data"][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, "没有查询到信息"); - } diff --git a/Services/Hncore.Pass.Vpn/Service/AgentClient17Service.cs b/Services/Hncore.Pass.Vpn/Service/AgentClient17Service.cs new file mode 100644 index 0000000..df8cfbc --- /dev/null +++ b/Services/Hncore.Pass.Vpn/Service/AgentClient17Service.cs @@ -0,0 +1,427 @@ +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 AgentClient17Service: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 AgentClient17Service(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) + { + + var url = "?secretId=108006113&secretKey=87085a351a64c116df09ebc07d5781sf&type=adduser&user="+account+"&pass="+pwd+"&serverid="+packageKey+"&logincount="+connCount.ToString()+"&idname=万勇强&idcard=410325199407079912"; + + if (packageKey == "test") { + url = "?secretId=108006113&secretKey=87085a351a64c116df09ebc07d5781sf&type=addtestuser&user="+account+"&password="+pwd+"&idname=万勇强&idcard=410325199407079912"; + } + + var client = CreateHttpClient(); + + var resp = await client.GetAsync(url); + var content = ""; + using (var sr = new StreamReader(resp.Content.ReadAsStreamAsync().Result, Encoding.GetEncoding("iso-8859-1"))) + { + content = sr.ReadToEnd(); + } + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var status = jo["code"].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) + { + + var url = "?secretId=108006113&secretKey=87085a351a64c116df09ebc07d5781sf&type=buy&user="+account+"&serverid="+packageKey; + + var client = CreateHttpClient(); + + var resp = await client.GetAsync(url); + var content = ""; + using (var sr = new StreamReader(resp.Content.ReadAsStreamAsync().Result, Encoding.GetEncoding("iso-8859-1"))) + { + content = sr.ReadToEnd(); + } + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var status = jo["code"].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 = "a478ad5aa3079bbbef3cd45e2d55d61e"; + 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) + { + + var url = "?secretId=108006113&secretKey=87085a351a64c116df09ebc07d5781sf&type=getuserinfo&user="+account; + + var client = CreateHttpClient(); + + var resp = await client.GetAsync(url); + var content = ""; + using (var sr = new StreamReader(resp.Content.ReadAsStreamAsync().Result, Encoding.GetEncoding("iso-8859-1"))) + { + content = sr.ReadToEnd(); + } + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var status = jo["code"].ToString(); + + if (status =="1") + { + var trData = new OriginAccountModel + { + Id = "", + Account = account, + Pwd = jo["password"].ToString(), + AccountType = jo["pause"].ToString(), + Package = "", + ConnectCount = jo["logincount"].ToString(), + RegistTime = "", + EndTime = jo["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) + { + + var url = "?secretId=108006113&secretKey=87085a351a64c116df09ebc07d5781sf&type=setuser&user="+account+"&new_pwd="+pwd; + + var client = CreateHttpClient(); + + var resp = await client.GetAsync(url); + var content = ""; + using (var sr = new StreamReader(resp.Content.ReadAsStreamAsync().Result, Encoding.GetEncoding("iso-8859-1"))) + { + content = sr.ReadToEnd(); + } + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var status = jo["code"].ToString(); + if (status =="1") + { + return true; + } + else + { + return false; + } + + } + /// + /// 退款 + /// + /// + /// + /// + public override async Task Refund(string account, string packageKey, int days) + { + + + return new ApiResult(ResultCode.C_INVALID_ERROR, "退款失败"); + + } + /// + /// 是否在线 + /// + /// + /// + /// + public override async Task>> OnLine(string account) + { + + var url = "?secretId=108006113&secretKey=87085a351a64c116df09ebc07d5781sf&type=get_user_onlinelog&user="+account; + + var client = CreateHttpClient(); + + var resp = await client.GetAsync(url); + var content = ""; + using (var sr = new StreamReader(resp.Content.ReadAsStreamAsync().Result, Encoding.GetEncoding("iso-8859-1"))) + { + content = sr.ReadToEnd(); + } + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var status = jo["code"].ToString(); + + var retData = new List(); + if (status =="1") + { + 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["server_ip"].ToString(), + LoginTime = "", + OnlineTime = jsondata["online_time"].ToString(), + LoginIP = jsondata["client_ip"].ToString(), + UpStream = "", + DownStream = "", + Id= "{user:\""+account+"\",address:\""+jsondata["address"].ToString()+"\",server_ip:\""+jsondata["server_ip"].ToString()+"\"}", + + }; + + retData.Add(trData); + } + } + return new ApiResult>(retData); + } + else + { + return new ApiResult>(retData); + } + + } + /// + /// 踢号 + /// + /// + /// + /// + public override async Task KillOut( string id) + { + + JObject info = (JObject)JsonConvert.DeserializeObject(id); + + var url = "?secretId=108006113&secretKey=87085a351a64c116df09ebc07d5781sf&type=user_online_offline&user="+info["user"].ToString()+"&address="+info["address"].ToString()+"&server_ip="+info["server_ip"].ToString(); + + var client = CreateHttpClient(); + + var resp = await client.GetAsync(url); + var content = ""; + using (var sr = new StreamReader(resp.Content.ReadAsStreamAsync().Result, Encoding.GetEncoding("iso-8859-1"))) + { + content = sr.ReadToEnd(); + } + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var status = jo["code"].ToString(); + + + if (status =="1") + { + return true; + } + return false; + } + + /// + /// 是否存在 + /// + /// + /// + public override async Task Exist(string account) + { + var url = "?secretId=108006113&secretKey=87085a351a64c116df09ebc07d5781sf&type=getuserlenNum&user="+account; + + + var client = CreateHttpClient(); + + var resp = await client.GetAsync(url); + + var content = ""; + using (var sr = new StreamReader(resp.Content.ReadAsStreamAsync().Result, Encoding.GetEncoding("iso-8859-1"))) + { + content = sr.ReadToEnd(); + } + + JObject jo = (JObject)JsonConvert.DeserializeObject(content); + var status = jo["status"].ToString(); + + if (status =="success") + { + return false; + } + return true; + } + } +} diff --git a/Services/Hncore.Pass.Vpn/Service/AgentService.cs b/Services/Hncore.Pass.Vpn/Service/AgentService.cs index 447f34f..0e19b3d 100644 --- a/Services/Hncore.Pass.Vpn/Service/AgentService.cs +++ b/Services/Hncore.Pass.Vpn/Service/AgentService.cs @@ -75,6 +75,8 @@ namespace Hncore.Pass.Vpn.Service agent = new AgentClient15Service(m_HttpClientFactory) { ClientName = product.GroupNO }; if (product.GroupNO == "g16") agent = new AgentClient16Service(m_HttpClientFactory) { ClientName = product.GroupNO }; + if (product.GroupNO == "g17") + agent = new AgentClient17Service(m_HttpClientFactory) { ClientName = product.GroupNO }; agent.Product = product; return agent; }