猎豹
This commit is contained in:
@@ -739,7 +739,7 @@ namespace Home.Controllers
|
||||
{
|
||||
var product = new ProductEntity();
|
||||
var package = new ProductPackageEntity();
|
||||
if (id==1034||id==1040||id==89){
|
||||
if (id==1034||id==1040||id==89||id==1094||id==1103||id==1097){
|
||||
package = await m_ProductPackageService.Query(m => m.Id == id).FirstOrDefaultAsync();
|
||||
product = await m_ProductService.GetById(package.ProductId);
|
||||
} else {
|
||||
@@ -894,6 +894,39 @@ namespace Home.Controllers
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
//0 无状态 1:尊享 2:高级 3:普通
|
||||
var pro_type_flag_liebao = 0;
|
||||
var pro_type_temp_liebao = 0;
|
||||
if (productId == 26) {
|
||||
|
||||
|
||||
|
||||
accountList.ForEach(m => {
|
||||
|
||||
|
||||
if (m.PackageId<1097) {
|
||||
pro_type_flag_liebao = 1;
|
||||
}
|
||||
if (m.PackageId>1096&&m.PackageId<1103) {
|
||||
pro_type_flag_liebao = 2;
|
||||
}
|
||||
if (m.PackageId>1103&&m.PackageId<1109) {
|
||||
pro_type_flag_liebao = 3;
|
||||
}
|
||||
|
||||
if (pro_type_temp_liebao==0){
|
||||
pro_type_temp_liebao = pro_type_flag_liebao;
|
||||
}
|
||||
if (pro_type_temp_liebao!=pro_type_flag_liebao){
|
||||
ViewBag.errorTip = "猎豹不同类型不能同时续费";
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (ViewBag.errorTip == "猎豹不同类型不能同时续费"){
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -943,7 +976,7 @@ namespace Home.Controllers
|
||||
if (m.ProductId == 6||m.ProductId == 5){
|
||||
m.Title = "9";
|
||||
}
|
||||
if (m.ProductId == 23||m.ProductId == 13||m.ProductId == 14||m.ProductId == 17){
|
||||
if (m.ProductId == 23||m.ProductId == 13||m.ProductId == 14||m.ProductId == 26||m.ProductId == 17){
|
||||
m.Title = "8";
|
||||
}
|
||||
}
|
||||
@@ -961,7 +994,17 @@ namespace Home.Controllers
|
||||
if (pro_type_temp ==3 && m.Id>1040&&m.Id<1046) {
|
||||
package_temp.Add(m);
|
||||
}
|
||||
}else {
|
||||
}else if(m.ProductId == 26){
|
||||
if (pro_type_temp_liebao ==1 && m.Id<1097) {
|
||||
package_temp.Add(m);
|
||||
}
|
||||
if (pro_type_temp_liebao ==2 && m.Id>1097&&m.Id<1103) {
|
||||
package_temp.Add(m);
|
||||
}
|
||||
if (pro_type_temp_liebao ==3 && m.Id>1103&&m.Id<1109) {
|
||||
package_temp.Add(m);
|
||||
}
|
||||
} else {
|
||||
package_temp.Add(m);
|
||||
}
|
||||
|
||||
@@ -1003,7 +1046,17 @@ namespace Home.Controllers
|
||||
if (pro_type_temp ==3 && m.Id>1040&&m.Id<1046) {
|
||||
package_temp.Add(m);
|
||||
}
|
||||
}else {
|
||||
}else if(m.ProductId == 26){
|
||||
if (pro_type_temp_liebao ==1 && m.Id<1097) {
|
||||
package_temp.Add(m);
|
||||
}
|
||||
if (pro_type_temp_liebao ==2 && m.Id>1097&&m.Id<1103) {
|
||||
package_temp.Add(m);
|
||||
}
|
||||
if (pro_type_temp_liebao ==3 && m.Id>1103&&m.Id<1109) {
|
||||
package_temp.Add(m);
|
||||
}
|
||||
} else {
|
||||
package_temp.Add(m);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -483,6 +483,9 @@
|
||||
case 25:
|
||||
self.location.href='http://php-api.juip.com/script/linedata/data/download/qiangzijt.csv';
|
||||
break;
|
||||
case 26:
|
||||
self.location.href='http://php-api.juip.com/script/linedata/data/download/liebao.csv';
|
||||
break;
|
||||
}
|
||||
},
|
||||
detail(r){
|
||||
|
||||
@@ -171,6 +171,10 @@
|
||||
<li role="presentation" class="@(item.Product.Id==defaultProduct.Id?"active":"")">
|
||||
<a href="#@item.Product.Id" id="p14" role="tab" data-toggle="tab" style="font-size: 25px;border:1px solid #99CCFF">@item.Product.Name</a>
|
||||
</li>
|
||||
}else if(item.Product.Id == 26) {
|
||||
<li role="presentation" class="@(item.Product.Id==defaultProduct.Id?"active":"")">
|
||||
<a href="#@item.Product.Id" id="p26" role="tab" data-toggle="tab" style="font-size: 25px;border:1px solid #99CCFF">@item.Product.Name</a>
|
||||
</li>
|
||||
}
|
||||
else if(item.Product.Id == 22) {
|
||||
<li >
|
||||
@@ -216,11 +220,21 @@
|
||||
<p class=" text-center" style="color:#FF9933">需求五个以上、可联系右侧客服设置优惠价</p>
|
||||
</div>
|
||||
<div style="margin-top:calc(2vh);">
|
||||
|
||||
@if (item.Product.Id == 14){
|
||||
<div class="p_type @("type"+item.Product.Id)" style="padding-top: 10px;">
|
||||
<button type="button" onclick="ttzhizun()" class="btn btn-default btn-lg ttzx" style="background-color: #FF9900;font-size:1.3em;">尊享版-不限速</button>
|
||||
<button type="button" onclick="ttgaoji()" class="btn btn-default btn-lg ttgj" style="background-color: white;font-size:1.3em;">高级版-限速4M</button><br>
|
||||
<button type="button" onclick="ttputong()" class="btn btn-default btn-lg ttpt" style="background-color: white;font-size:1.3em;margin-top:10px;">普通版-限速2M</button>
|
||||
</div>
|
||||
}
|
||||
@if (item.Product.Id == 26){
|
||||
<div class="p_type @("type"+item.Product.Id)" style="padding-top: 10px;">
|
||||
<button type="button" onclick="lbzhizun()" class="btn btn-default btn-lg lbzx" style="background-color: #FF9900;font-size:1.3em;">尊享版-不限速</button>
|
||||
<button type="button" onclick="lbgaoji()" class="btn btn-default btn-lg lbgj" style="background-color: white;font-size:1.3em;">高级版-限速4M</button><br>
|
||||
<button type="button" onclick="lbputong()" class="btn btn-default btn-lg lbpt" style="background-color: white;font-size:1.3em;margin-top:10px;">普通版-限速2M</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (item.Product.Id == 20) {
|
||||
<div style="margin: 5px;">
|
||||
@@ -247,7 +261,7 @@
|
||||
|
||||
@foreach (var package in item.Packages.Where(m => m.Status == 1&&(m.TenantId==1157||m.TenantId==9999||m.TenantId==10000)).OrderBy(m => m.TenantId))
|
||||
{
|
||||
if (package.IsTest == 1 &&package.Id != 89&&package.Id != 1034&&package.Id != 1040)
|
||||
if (package.IsTest == 1 &&package.Id != 89&&package.Id != 1034&&package.Id != 1040&&package.Id != 1094&&package.Id != 1097&&package.Id != 1103)
|
||||
{
|
||||
<a asp-action="test" id="@("package-"+package.Id)" asp-controller="product" asp-route-id="@package.ProductId">
|
||||
<div class="card color_2">
|
||||
@@ -279,7 +293,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
} else if((package.Id == 89||package.Id == 1034||package.Id == 1040)&&package.IsTest==1){
|
||||
} else if((package.Id == 89||package.Id == 1034||package.Id == 1040||package.Id == 1094||package.Id == 1097||package.Id == 1103)&&package.IsTest==1){
|
||||
<a asp-action="test" id="@("package-"+package.Id)" asp-controller="product" asp-route-id="@package.Id">
|
||||
<div class="card color_2">
|
||||
<div class="item">
|
||||
@@ -332,6 +346,7 @@
|
||||
$(".p_type").hide();
|
||||
$("#p14").click(function () {
|
||||
$(".type14").show();
|
||||
$(".type26").hide();
|
||||
$("#package-89").show();
|
||||
$("#package-69").show();
|
||||
$("#package-70").show();
|
||||
@@ -341,6 +356,24 @@
|
||||
for (var i=1034;i<1046;i++){
|
||||
$("#package-"+i).hide();
|
||||
}
|
||||
$(".ttzx").css('background-color','#FF9900');
|
||||
$(".ttgj").css('background-color','white');
|
||||
$(".ttpt").css('background-color','white');
|
||||
|
||||
});
|
||||
$("#p26").click(function () {
|
||||
$(".type14").hide();
|
||||
$(".type26").show();
|
||||
|
||||
for (var i=1090;i<1097;i++){
|
||||
$("#package-"+i).show();
|
||||
}
|
||||
for (var i=1097;i<1109;i++){
|
||||
$("#package-"+i).hide();
|
||||
}
|
||||
$(".lbzx").css('background-color','#FF9900');
|
||||
$(".lbgj").css('background-color','white');
|
||||
$(".lbpt").css('background-color','white');
|
||||
});
|
||||
function ttzhizun() {
|
||||
$("#package-89").show();
|
||||
@@ -357,6 +390,18 @@
|
||||
$(".ttgj").css('background-color','white');
|
||||
$(".ttpt").css('background-color','white');
|
||||
}
|
||||
function lbzhizun() {
|
||||
for (var i=1090;i<1097;i++){
|
||||
$("#package-"+i).show();
|
||||
}
|
||||
for (var i=1097;i<1109;i++){
|
||||
$("#package-"+i).hide();
|
||||
}
|
||||
|
||||
$(".lbzx").css('background-color','#FF9900');
|
||||
$(".lbgj").css('background-color','white');
|
||||
$(".lbpt").css('background-color','white');
|
||||
}
|
||||
function ttgaoji() {
|
||||
$(".ttgj").css('background-color','#FF9900');
|
||||
$(".ttzx").css('background-color','white');
|
||||
@@ -374,6 +419,21 @@
|
||||
$("#package-"+i).show();
|
||||
}
|
||||
}
|
||||
function lbgaoji() {
|
||||
$(".lbgj").css('background-color','#FF9900');
|
||||
$(".lbzx").css('background-color','white');
|
||||
$(".lbpt").css('background-color','white');
|
||||
|
||||
for (var i=1090;i<1097;i++){
|
||||
$("#package-"+i).hide();
|
||||
}
|
||||
for (var i=1103;i<1109;i++){
|
||||
$("#package-"+i).hide();
|
||||
}
|
||||
for (var i=1097;i<1103;i++){
|
||||
$("#package-"+i).show();
|
||||
}
|
||||
}
|
||||
function ttputong() {
|
||||
$(".ttpt").css('background-color','#FF9900');
|
||||
$(".ttzx").css('background-color','white');
|
||||
@@ -391,6 +451,21 @@
|
||||
$("#package-"+i).hide();
|
||||
}
|
||||
}
|
||||
function lbputong() {
|
||||
$(".lbpt").css('background-color','#FF9900');
|
||||
$(".lbzx").css('background-color','white');
|
||||
$(".lbgj").css('background-color','white');
|
||||
|
||||
for (var i=1090;i<1097;i++){
|
||||
$("#package-"+i).hide();
|
||||
}
|
||||
for (var i=1103;i<1109;i++){
|
||||
$("#package-"+i).show();
|
||||
}
|
||||
for (var i=1097;i<1103;i++){
|
||||
$("#package-"+i).hide();
|
||||
}
|
||||
}
|
||||
|
||||
var wjdxtype = 1;
|
||||
function wjdxphone() {
|
||||
|
||||
@@ -284,6 +284,11 @@
|
||||
<td>1234</td>
|
||||
<td>4430</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>猎豹</td>
|
||||
<td>1234</td>
|
||||
<td>4430</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>强子</td>
|
||||
<td>888888</td>
|
||||
@@ -396,6 +401,11 @@
|
||||
this.search_field = '天天IP';
|
||||
this.sstp = '4430';
|
||||
break;
|
||||
case 26:
|
||||
this.l2tp = '1234';
|
||||
this.search_field = '猎豹IP';
|
||||
this.sstp = '4430';
|
||||
break;
|
||||
case 15:
|
||||
this.l2tp = '66';
|
||||
this.search_field = '共享IP';
|
||||
@@ -562,6 +572,9 @@
|
||||
case 25:
|
||||
self.location.href='http://php-api.juip.com/script/linedata/data/download/qiangzijt.csv';
|
||||
break;
|
||||
case 26:
|
||||
self.location.href='http://php-api.juip.com/script/linedata/data/download/liebao.csv';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,6 +259,12 @@
|
||||
|
||||
</div>
|
||||
}
|
||||
else if(item.Product.Id == 26) {
|
||||
<div class="dropdown">
|
||||
<div style="font-size: 18px;" class="productItem" id="@("p"+item.Product.Id)" a-pid="@item.Product.Id"><span style="color: #f64e3d;font-weight:bold;float:right;padding-right: 5px;">新 </span>@item.Product.Name</div>
|
||||
|
||||
</div>
|
||||
}
|
||||
else if(item.Product.Id == 22) {
|
||||
<div style="background-color: #ccc;color:#0098fb" disabled="disabled"><span class="glyphicon glyphicon-arrow-down"></span>静态IP<span class="glyphicon glyphicon-arrow-down"></span></div>
|
||||
<div class="productItem" id="@("p"+item.Product.Id)" a-pid="@item.Product.Id">@item.Product.Name</div>
|
||||
@@ -359,6 +365,21 @@
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
@if(item.Product.Id == 26) { //不限速
|
||||
<div style="padding-top:10px;">
|
||||
<ul class="nav nav-tabs nav-justified" style="margin:0 0 0 50px;cursor: pointer;">
|
||||
<li id="tablbzx" style="border:1px solid #ccc" class="active">
|
||||
<a onclick="lbzhizun()" style="color: #009966;width:350px;background:rgba(0,0,0,0)">尊享版-不限速</a>
|
||||
</li>
|
||||
<li style="border:1px solid #ccc" id="tablbgj">
|
||||
<a onclick="lbgaoji()" style="color: #009966;width:350px;background:rgba(0,0,0,0)">高级版-限速4M</a>
|
||||
</li>
|
||||
<li style="border:1px solid #ccc" id="tablbpt">
|
||||
<a onclick="lbputong()" style="color: #009966;width:350px;background:rgba(0,0,0,0)">普通版-限速2M</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@* @if(item.Product.Id == 18){
|
||||
@@ -444,7 +465,7 @@
|
||||
<div class="card" style="margin-top:30px;">
|
||||
<div style="display: flex;margin: 0 auto;">
|
||||
|
||||
@if(item.Product.TenantId == 1157 && item.Product.Content=="0" && item.Product.Id != 14){
|
||||
@if(item.Product.TenantId == 1157 && item.Product.Content=="0" && item.Product.Id != 14&& item.Product.Id != 26){
|
||||
<div class="item packageitem" a-test="true" id="@("pkgtest"+item.Product.Id)" a-pkg-id="@item.Product.Id">
|
||||
<p><span class="price">免费</span></p>
|
||||
<p class="yuanjia" style="color: #FF9900;text-decoration:none;"><span>@restStatus</span></p>
|
||||
@@ -457,7 +478,7 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
@foreach (var package in item.Packages.Where(m => (m.IsTest == 0 && m.Status == 1) || (m.ProductId==14 && m.Status == 1) ).OrderBy(m => m.TenantId))
|
||||
@foreach (var package in item.Packages.Where(m => (m.IsTest == 0 && m.Status == 1) || (m.ProductId==14 && m.Status == 1) || (m.ProductId==26 && m.Status == 1) ).OrderBy(m => m.TenantId))
|
||||
{
|
||||
@if(package.Title != "0"){
|
||||
<style>
|
||||
@@ -520,7 +541,7 @@
|
||||
</div>
|
||||
<img src="~/img/check.png" class="cardCheck">
|
||||
</div>
|
||||
} else if((package.Id == 89||package.Id == 1034||package.Id == 1040)&&package.IsTest==1){
|
||||
} else if((package.Id == 89||package.Id == 1034||package.Id == 1040||package.Id == 1097||package.Id == 1094||package.Id == 1103)&&package.IsTest==1){
|
||||
|
||||
<div class="item packageitem" a-test="true" id="@("pkg"+package.Id)" a-pkg-id="@package.Id">
|
||||
<p><span class="price">@package.Price</span>元</p>
|
||||
@@ -693,6 +714,19 @@
|
||||
$("#pkg"+i).hide();
|
||||
}
|
||||
}
|
||||
|
||||
function lbzhizun() {
|
||||
for (var i=1090;i<1097;i++){
|
||||
$("#pkg"+i).show();
|
||||
}
|
||||
$("#tablbzx").addClass("active");
|
||||
$("#tablbgj").removeClass("active");
|
||||
$("#tablbpt").removeClass("active");
|
||||
|
||||
for (var i=1097;i<1109;i++){
|
||||
$("#pkg"+i).hide();
|
||||
}
|
||||
}
|
||||
function ttgaoji() {
|
||||
$("#pkg89").hide();
|
||||
$("#pkg69").hide();
|
||||
@@ -710,6 +744,20 @@
|
||||
$("#pkg"+i).show();
|
||||
}
|
||||
}
|
||||
function lbgaoji() {
|
||||
for (var i=1090;i<1097;i++){
|
||||
$("#pkg"+i).hide();
|
||||
}
|
||||
$("#tablbzx").removeClass("active");
|
||||
$("#tablbgj").addClass("active");
|
||||
$("#tablbpt").removeClass("active");
|
||||
for (var i=1103;i<1109;i++){
|
||||
$("#pkg"+i).hide();
|
||||
}
|
||||
for (var i=1097;i<1103;i++){
|
||||
$("#pkg"+i).show();
|
||||
}
|
||||
}
|
||||
function ttputong() {
|
||||
$("#pkg89").hide();
|
||||
$("#pkg69").hide();
|
||||
@@ -727,6 +775,20 @@
|
||||
$("#pkg"+i).hide();
|
||||
}
|
||||
}
|
||||
function lbputong() {
|
||||
for (var i=1090;i<1097;i++){
|
||||
$("#pkg"+i).hide();
|
||||
}
|
||||
$("#tablbzx").removeClass("active");
|
||||
$("#tablbgj").removeClass("active");
|
||||
$("#tablbpt").addClass("active");
|
||||
for (var i=1103;i<1109;i++){
|
||||
$("#pkg"+i).show();
|
||||
}
|
||||
for (var i=1097;i<1103;i++){
|
||||
$("#pkg"+i).hide();
|
||||
}
|
||||
}
|
||||
|
||||
//1 安卓、苹果 2 pc
|
||||
var wjdxtype = 1;
|
||||
@@ -908,6 +970,16 @@
|
||||
for (var i=1;i<30;i++){
|
||||
$("#p"+i).removeClass("on");
|
||||
}
|
||||
} else if (pid == 26) {
|
||||
for (var i=1090;i<1097;i++){
|
||||
$("#pkg"+i).show();
|
||||
}
|
||||
for (var i=1097;i<1109;i++){
|
||||
$("#pkg"+i).hide();
|
||||
}
|
||||
for (var i=1;i<30;i++){
|
||||
$("#p"+i).removeClass("on");
|
||||
}
|
||||
} else if (pid == 20||pid == 21){
|
||||
if (pid ==20) {
|
||||
$("#wjdxgd").removeClass("active");
|
||||
@@ -943,6 +1015,7 @@
|
||||
}
|
||||
} else {
|
||||
$("#p14").removeClass("on");
|
||||
$("#p26").removeClass("on");
|
||||
$("#p20").removeClass("on");
|
||||
$("#p21").removeClass("on");
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace Hncore.Pass.Vpn.Controllers
|
||||
{
|
||||
return Error("套餐不存在");
|
||||
}
|
||||
if (packageEntity.IsTest == 0&&packageEntity.Id!=1034&&packageEntity.Id!=1040)
|
||||
if (packageEntity.IsTest == 0&&packageEntity.Id!=1034&&packageEntity.Id!=1040&&packageEntity.Id!=1097&&packageEntity.Id!=1103)
|
||||
{
|
||||
return Error("非测试套餐");
|
||||
}
|
||||
@@ -320,6 +320,14 @@ namespace Hncore.Pass.Vpn.Controllers
|
||||
} else if (request.PackageId == 89){
|
||||
account_type = 1;
|
||||
}
|
||||
if (request.PackageId == 1097) {
|
||||
account_type = 2;
|
||||
} else if (request.PackageId == 1103){
|
||||
account_type = 3;
|
||||
} else if (request.PackageId == 1094){
|
||||
account_type = 1;
|
||||
}
|
||||
|
||||
|
||||
var ret= await m_agentService.NewAccount(0, request.PackageId, request.Account, request.Pwd, accountType:account_type);
|
||||
|
||||
@@ -380,7 +388,7 @@ namespace Hncore.Pass.Vpn.Controllers
|
||||
{
|
||||
return Error("套餐不存在");
|
||||
}
|
||||
if (packageEntity.IsTest == 0&&packageEntity.Id!=1034&&packageEntity.Id!=1040)
|
||||
if (packageEntity.IsTest == 0&&packageEntity.Id!=1034&&packageEntity.Id!=1040&&packageEntity.Id!=1097&&packageEntity.Id!=1103)
|
||||
{
|
||||
return Error("非测试套餐");
|
||||
}
|
||||
@@ -413,6 +421,13 @@ namespace Hncore.Pass.Vpn.Controllers
|
||||
} else if (request.PackageId == 89){
|
||||
account_type = 1;
|
||||
}
|
||||
if (request.PackageId == 1097) {
|
||||
account_type = 2;
|
||||
} else if (request.PackageId == 1103){
|
||||
account_type = 3;
|
||||
} else if (request.PackageId == 1094){
|
||||
account_type = 1;
|
||||
}
|
||||
|
||||
var ret= await m_agentService.NewAccount(0, request.PackageId, request.Account, request.Pwd, accountType:account_type);
|
||||
|
||||
|
||||
536
Services/Hncore.Pass.Vpn/Service/AgentClient20Service.cs
Normal file
536
Services/Hncore.Pass.Vpn/Service/AgentClient20Service.cs
Normal file
@@ -0,0 +1,536 @@
|
||||
using AngleSharp;
|
||||
using AngleSharp.Dom;
|
||||
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.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading.Tasks;
|
||||
namespace Hncore.Pass.Vpn.Service
|
||||
{
|
||||
public class AgentClient20Service : AgentClientBaseService
|
||||
{
|
||||
string apiId = "130";
|
||||
string apiKey = "3AT7XCHjWG8sSMpRBjtAJ8JRkSAbhJit";
|
||||
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; } = "v1/renewal";
|
||||
string MuiltAddUrl { get; set; } = "agent/memberMuiltAdd.html";
|
||||
string RefundUrl { get; set; } = "agent/memberRefundAct.html ";
|
||||
string UpdateUrl = "v1/edit";
|
||||
string OnlineLoginUrl { get; set; } = "online";
|
||||
string OnlineUrl { get; set; } = "v1/oln";
|
||||
string KIllUrl { get; set; } = "agent/disConnect2/radacctid/{0}.html";
|
||||
string searchAccountUrl = "v1/get";
|
||||
string DeleteUrl { get; set; } = "v1/refund";//1160862.html";
|
||||
|
||||
string ExistUrl = "v1/verify";
|
||||
IHttpClientFactory m_HttpClientFactory;
|
||||
public AgentClient20Service(IHttpClientFactory httpClientFactory) : base(httpClientFactory)
|
||||
{
|
||||
m_HttpClientFactory = httpClientFactory;
|
||||
}
|
||||
|
||||
protected override HttpClient CreateHttpClient(bool autoCooke = true)
|
||||
{
|
||||
var client = m_HttpClientFactory.CreateClient("agentClient1.0");
|
||||
client.BaseAddress = new System.Uri(this.BaseUrl);
|
||||
if (this.Token.Has() && autoCooke)
|
||||
{
|
||||
AddCookie(client, this.Token);
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
public override async Task<int> RefrushStatus()
|
||||
{
|
||||
int status = 0;
|
||||
if (this.Token.Has())
|
||||
{
|
||||
var client = CreateHttpClient();
|
||||
if (this.RefrushTokenUrl.Has())
|
||||
{
|
||||
// client.DefaultRequestHeaders.Add("Cookie", this.Token);
|
||||
var getResp = await client.GetAsync(this.RefrushTokenUrl);
|
||||
if (getResp.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
var request = new AgentLoginRequest()
|
||||
{
|
||||
Account = this.Product.Account,
|
||||
Pwd = this.Product.Pwd
|
||||
};
|
||||
|
||||
var ret = await this.Login(request);
|
||||
if (ret.Code == ResultCode.C_SUCCESS)
|
||||
{
|
||||
this.Product.Token = ret.Data.ToString();
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.WriteLine("离线");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
private async Task<(string, string)> GetHomeCookie()
|
||||
{
|
||||
var client = CreateHttpClient(false);
|
||||
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();
|
||||
|
||||
var content = await getResp.Content.ReadAsStringAsync();
|
||||
|
||||
var parser = new HtmlParser();
|
||||
var document = await parser.ParseDocumentAsync(content);
|
||||
var csrf_tokenNode = document.QuerySelector("meta[name=csrf-token]");//<meta name="csrf-token" content="WfjPwY-RY_A_3d09abknzQm-eRDaVnDeMNRxN-juDDEYzomD3cshgk-zk3M94FC9P8Yte6AjCvMCmz4BmYZvSw==">
|
||||
var csrf_token = csrf_tokenNode.GetAttribute("content");
|
||||
return (cookies, csrf_token);
|
||||
}
|
||||
|
||||
public override async Task<ApiResult> Login(AgentLoginRequest request)
|
||||
{
|
||||
var tokens = await this.GetHomeCookie();
|
||||
var client = CreateHttpClient(false);
|
||||
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>(){
|
||||
{"_csrf-daili",tokens.Item2},
|
||||
{"LoginForm[username]",request.Account },
|
||||
{"LoginForm[password]",request.Pwd },
|
||||
};
|
||||
LogHelper.Info("Login", map.ToJson());
|
||||
|
||||
var csrf = GetCookieValue(tokens.Item1, "_csrf-daili");
|
||||
AddCookie(client, $"_csrf-daili={csrf}");
|
||||
var resp = await client.PostAsForm(this.LoginUrl, map);
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
if (resp.StatusCode != HttpStatusCode.OK || content.IndexOf("成功") == -1)
|
||||
{
|
||||
return new ApiResult(ResultCode.C_VISITOR_CHECKING, "登录失败");
|
||||
}
|
||||
var frontend = this.GetCookie(resp, "advanced-frontend");
|
||||
csrf = this.GetCookie(resp, "_csrf-daili");
|
||||
request.Key = $"{frontend};{csrf}";
|
||||
return new ApiResult(request.Key);
|
||||
}
|
||||
public override bool CheckAccount(int productId,List<string> accounts)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private string Sign(SortedDictionary<string, string> map)
|
||||
{
|
||||
map["apiid"] = this.apiId;
|
||||
map["sendtime"] = DateTime.Now.GetUnixTimeStamp().ToString();
|
||||
var data = string.Join("&", map.Select(m => $"{m.Key}={m.Value}"));
|
||||
var signStr = Md5(data + apiKey);
|
||||
data = $"{data}&sign={signStr}";
|
||||
return data;
|
||||
}
|
||||
|
||||
//Md5摘要
|
||||
private static string Md5(string text)
|
||||
{
|
||||
MD5 md5 = new MD5CryptoServiceProvider();
|
||||
byte[] fromData = System.Text.Encoding.UTF8.GetBytes(text);
|
||||
byte[] targetData = md5.ComputeHash(fromData);
|
||||
string byte2String = null;
|
||||
|
||||
for (int i = 0; i < targetData.Length; i++)
|
||||
{
|
||||
byte2String += targetData[i].ToString("x2");
|
||||
}
|
||||
|
||||
return byte2String;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新开
|
||||
/// </summary>
|
||||
/// <param name="packageId"></param>
|
||||
/// <param name="account"></param>
|
||||
/// <param name="pwd"></param>
|
||||
/// <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 =="test"){
|
||||
new_url = "v1/test";
|
||||
} else if(packageKey =="m3"){
|
||||
package = "m";
|
||||
buyCount = "3";
|
||||
} else if(packageKey =="m12"){
|
||||
package = "m";
|
||||
buyCount = "12";
|
||||
} else {
|
||||
package = packageKey;
|
||||
buyCount = payCount.ToString();
|
||||
}
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"mark","api" },
|
||||
{"max_conn",connCount.ToString() },
|
||||
{"mobile","13073735878" },
|
||||
{"name",account },
|
||||
{"num","1"},
|
||||
{"passwd",pwd },
|
||||
{"paytype",package },
|
||||
{"paynum",buyCount },
|
||||
{"product_id",accountType.ToString() },
|
||||
};
|
||||
var title = GetOpTitle("NewAccount", account);
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync(new_url+"?"+ Sign(map));
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
Console.WriteLine("==============================================");
|
||||
Console.WriteLine(jo.ToJson());
|
||||
Console.WriteLine("==============================================");
|
||||
var status = jo["status"].ToString();
|
||||
if (status =="200")
|
||||
{
|
||||
var retAccount=jo["data"].ToArray().FirstOrDefault();
|
||||
// var id = retAccount["name"].ToString();
|
||||
return new ApiResult(ResultCode.C_SUCCESS);
|
||||
}
|
||||
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, "开户失败");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 续费
|
||||
/// </summary>
|
||||
/// <param name="productId"></param>
|
||||
/// <param name="account">原始的账号的id</param>
|
||||
/// <param name="pwd"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<ApiResult> NewReAccount(string packageKey, string id, int connCount, int payCount = 1)
|
||||
{
|
||||
var package = "m";
|
||||
var buyCount = "1";
|
||||
if(packageKey =="m3"){
|
||||
package = "m";
|
||||
buyCount = "3";
|
||||
} else if(packageKey =="m12"){
|
||||
package = "m";
|
||||
buyCount = "12";
|
||||
} else {
|
||||
package = packageKey;
|
||||
buyCount = payCount.ToString();
|
||||
}
|
||||
var client = CreateHttpClient();
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"names",id }, //原始的账号的id
|
||||
{"paytype",package },
|
||||
{"paynum",buyCount },
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync(this.SingleReAddUrl + "?" + Sign(map));
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["status"].ToString();
|
||||
if (status =="200")
|
||||
{
|
||||
return new ApiResult(ResultCode.C_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = jo["info"].ToString();
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, info);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "续费失败");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除账号
|
||||
/// </summary>
|
||||
/// <param name="productId"></param>
|
||||
/// <param name="account"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<bool> DeleteAccount(string account)
|
||||
{
|
||||
var client = CreateHttpClient();
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"name",account },
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync(this.DeleteUrl + "?" + Sign(map));
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["status"].ToString();
|
||||
if (status=="200")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 得到账号信息
|
||||
/// </summary>
|
||||
/// <param name="productId"></param>
|
||||
/// <param name="account"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<ApiResult<OriginAccountModel>> GetAccountInfo(string id, bool isTest=false)
|
||||
{
|
||||
var client = CreateHttpClient();
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"name",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();
|
||||
|
||||
if (status == "200")
|
||||
{
|
||||
var data = jo["data"];
|
||||
var trData = new OriginAccountModel
|
||||
{
|
||||
Id = data["name"].ToString(),
|
||||
Account = data["name"].ToString(),
|
||||
Pwd = data["passwd"].ToString(),
|
||||
AccountType = data["mark"].ToString(),
|
||||
Package = "",
|
||||
ConnectCount = data["max_conn"].ToString(),
|
||||
RegistTime = data["add_time"].ToString(),
|
||||
EndTime = data["end_time"].ToString(),
|
||||
RestTime = "",
|
||||
Amount = data["balance"].ToString(),
|
||||
Remark = data["mark"].ToString(),
|
||||
};
|
||||
return new ApiResult<OriginAccountModel>(trData);
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = jo["info"].ToString();
|
||||
return new ApiResult<OriginAccountModel>(ResultCode.C_INVALID_ERROR, "没有查询到信息");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ApiResult<OriginAccountModel>(ResultCode.C_INVALID_ERROR, "查询失败");
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改账号密码
|
||||
/// </summary>
|
||||
/// <param name="productId"></param>
|
||||
/// <param name="account"></param>
|
||||
/// <param name="pwd"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<bool> UpdateAccountPwd(string account, string pwd)
|
||||
{
|
||||
var client = CreateHttpClient();
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"name",account },
|
||||
{"passwd",pwd },
|
||||
};
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync(this.UpdateUrl + "?" + Sign(map));
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["status"].ToString();
|
||||
if (status == "200")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Error(GetOpTitle("UpdateAccountPwd", account), content);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error(GetOpTitle("UpdateAccountPwd", account), ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 退款
|
||||
/// </summary>
|
||||
/// <param name="packageId"></param>
|
||||
/// <param name="account"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<ApiResult> Refund(string id, string packageKey, int days)
|
||||
{
|
||||
var ret = await this.DeleteAccount(id);
|
||||
if (ret)
|
||||
{
|
||||
return new ApiResult(ResultCode.C_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "退款失败");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否在线
|
||||
/// </summary>
|
||||
/// <param name="productId"></param>
|
||||
/// <param name="account"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<ApiResult<List<OriginAccountOnlineModel>>> OnLine(string account)
|
||||
{
|
||||
var client = CreateHttpClient();
|
||||
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"])
|
||||
{
|
||||
JObject jsondata = (JObject)JsonConvert.DeserializeObject(tr.ToJson());
|
||||
|
||||
var trData = new OriginAccountOnlineModel
|
||||
{
|
||||
Account = account,
|
||||
ServerIP = jsondata["ip"].ToString(),
|
||||
LoginTime = "",
|
||||
OnlineTime = "",
|
||||
LoginIP = jsondata["user_ip"].ToString(),
|
||||
UpStream = "",
|
||||
DownStream = "",
|
||||
Id= jsondata["id"].ToString(),
|
||||
|
||||
};
|
||||
|
||||
retData.Add(trData);
|
||||
}
|
||||
}
|
||||
return new ApiResult<List<OriginAccountOnlineModel>>(retData);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ApiResult<List<OriginAccountOnlineModel>>(ResultCode.C_INVALID_ERROR, "查询失败");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 踢号
|
||||
/// </summary>
|
||||
/// <param name="productId"></param>
|
||||
/// <param name="account"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<bool> KillOut( string id)
|
||||
{
|
||||
var client = CreateHttpClient();
|
||||
var title = GetOpTitle("KillOut", id);
|
||||
var info = "";
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"id",id },
|
||||
};
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync("v1/olnstop?" + Sign(map));
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error(title, ex.Message + "-->info:" + info);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在
|
||||
/// </summary>
|
||||
/// <param name="account"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<bool> Exist(string account)
|
||||
{
|
||||
var client = CreateHttpClient();
|
||||
|
||||
var map = new SortedDictionary<string, string>(){
|
||||
{"user",account }
|
||||
};
|
||||
var title = GetOpTitle("Exist", account);
|
||||
LogHelper.Info(title, account);
|
||||
try
|
||||
{
|
||||
var resp = await client.GetAsync(this.ExistUrl + "?" + Sign(map));
|
||||
var content = await resp.Content.ReadAsStringAsync();
|
||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||
var status = jo["status"].ToString();
|
||||
if (status != "200")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error(title, ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,8 @@ namespace Hncore.Pass.Vpn.Service
|
||||
agent = new AgentClient18Service(m_HttpClientFactory) { ClientName = product.GroupNO };
|
||||
if (product.GroupNO == "g19")
|
||||
agent = new AgentClient19Service(m_HttpClientFactory) { ClientName = product.GroupNO };
|
||||
if (product.GroupNO == "g20")
|
||||
agent = new AgentClient20Service(m_HttpClientFactory) { ClientName = product.GroupNO };
|
||||
agent.Product = product;
|
||||
return agent;
|
||||
}
|
||||
|
||||
@@ -699,6 +699,11 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
|
||||
}
|
||||
else if (accountEntity.PackageId.Value > 1040 && accountEntity.PackageId.Value < 1046) {
|
||||
ret = await m_AgentService.NewAccount(order.Id, accountEntity.PackageId.Value, accountEntity.Account, accountEntity.Pwd, accountEntity.ConnectCount,3);
|
||||
} else if (accountEntity.PackageId.Value > 1097 && accountEntity.PackageId.Value < 1103) {
|
||||
ret = await m_AgentService.NewAccount(order.Id, accountEntity.PackageId.Value, accountEntity.Account, accountEntity.Pwd, accountEntity.ConnectCount,2);
|
||||
}
|
||||
else if (accountEntity.PackageId.Value > 1103 && accountEntity.PackageId.Value < 1109) {
|
||||
ret = await m_AgentService.NewAccount(order.Id, accountEntity.PackageId.Value, accountEntity.Account, accountEntity.Pwd, accountEntity.ConnectCount,3);
|
||||
}
|
||||
else {
|
||||
ret = await m_AgentService.NewAccount(order.Id, accountEntity.PackageId.Value, accountEntity.Account, accountEntity.Pwd, accountEntity.ConnectCount);
|
||||
@@ -929,6 +934,11 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
|
||||
}
|
||||
else if (accountEntity.PackageId.Value > 1040 && accountEntity.PackageId.Value < 1046) {
|
||||
ret = await m_AgentService.NewAccount(order.Id, accountEntity.PackageId.Value, accountEntity.Account, accountEntity.Pwd, accountEntity.ConnectCount,3);
|
||||
} else if (accountEntity.PackageId.Value > 1097 && accountEntity.PackageId.Value < 1103) {
|
||||
ret = await m_AgentService.NewAccount(order.Id, accountEntity.PackageId.Value, accountEntity.Account, accountEntity.Pwd, accountEntity.ConnectCount,2);
|
||||
}
|
||||
else if (accountEntity.PackageId.Value > 1103 && accountEntity.PackageId.Value < 1109) {
|
||||
ret = await m_AgentService.NewAccount(order.Id, accountEntity.PackageId.Value, accountEntity.Account, accountEntity.Pwd, accountEntity.ConnectCount,3);
|
||||
}
|
||||
else {
|
||||
ret = await m_AgentService.NewAccount(order.Id, accountEntity.PackageId.Value, accountEntity.Account, accountEntity.Pwd, accountEntity.ConnectCount);
|
||||
|
||||
Reference in New Issue
Block a user