新产品火狐

This commit is contained in:
“wanyongkang”
2021-04-28 08:48:56 +08:00
parent dfc7a6a1c1
commit 403b1663c7
11 changed files with 842 additions and 124 deletions

View File

@@ -71,7 +71,8 @@
地区
</div>
<div class="item">
运营商
<span v-if="product_id ==19">剩余拨数:</span>
<span v-else="product_id ==19">运营商:</span>
</div>
<div class="item">
服务器域名
@@ -105,7 +106,8 @@
<td>{{info.city}}</td>
</tr>
<tr>
<td>运营商</td>
<td v-if="product_id ==19">剩余拨数</td>
<td v-else="product_id ==19">运营商:</td>
<td>{{info.supply}}</td>
</tr>
<tr>
@@ -236,6 +238,11 @@
this.search_field = '蘑菇IP';
this.sstp = '4430';
break;
case 19:
this.l2tp = '123';
this.search_field = '火狐独享IP';
this.sstp = '1500';
break;
}
$.ajax({
type: 'GET',
@@ -334,6 +341,9 @@
case 18:
self.location.href='http://php-api.juip.com/script/linedata/data/download/mogu.csv';
break;
case 19:
self.location.href='http://php-api.juip.com/script/linedata/data/download/huohu.csv';
break;
}
},
detail(r){

View File

@@ -86,6 +86,11 @@
<a href="#@item.Product.Id" role="tab" data-toggle="tab" id="select-7" style="font-size: 25px;">@item.Product.Name </a>
</li>
}
else if(item.Product.Id == 19) {
<li role="presentation" class="@(item.Product.Id==defaultProduct.Id?"active":"")">
<a href="#@item.Product.Id" role="tab" data-toggle="tab" id="select-19" style="font-size: 25px;"><span style="color: #f64e3d;font-weight:bold;padding-right: 5px;">新</span>@item.Product.Name<span style="color: #f64e3d;font-weight:bold;float:right;padding-right: 5px;">抄低价</span></a>
</li>
}
else{
<li role="presentation" class="@(item.Product.Id==defaultProduct.Id?"active":"")">
@@ -99,6 +104,10 @@
$("#select-7").on('click',function(){
alert('请注意无尽IP仅供电脑端使用');
});
$("#select-19").on('click',function(){
alert('本产品为独享每个账号对应一个宽带拨号永不超载保证了网速及稳定性。使用时只需设置这个唯一的服务器1.hhip.vip在账号列表中点击切换地区即可任意组合自己需要的地区。本产品灵活便捷欢迎选购');
});
</script>
<div class="item">
<div class="tab-content">
@@ -118,6 +127,7 @@
需求5个以上可以联系客服设置优惠价;
开通后有任何问题可无理由退款,并支持自助提现
</p>
@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)

View File

@@ -19,16 +19,55 @@
height: calc(85vh);
overflow: auto;
}
.form-control {
height: 50px;
font-size: 25px;
width: 90%;
}
.citylabel {
font-weight: normal;
width: 300px;
height: 50px;
padding-left: 5px;
padding-top: 5px;
text-align: left;
border: solid 1px #ccc;
}
.citylabel>span{
padding-left: 50px;
display: block;
float: left;
}
.radio input[type="radio"], .radio-inline input[type="radio"], .checkbox input[type="checkbox"], .checkbox-inline input[type="checkbox"] {
position:none;
margin-left: 10px;
width: 25px;
height: 25px;
}
.btn {
height: 50px;
width: 90%;
font-size: 25px;
}
.province{
margin-bottom: 10px;
}
</style>
<vc:redirecct-login></vc:redirecct-login>
<div id="app" >
<div class="checkbox">
<label style="width: 90%;margin-left: 0.3rem;" v-for="(item,index) in assign_add_list">
<input type="checkbox" style="height: 0.3rem;width: 0.3rem;" v-model="assign_list" :value="item.name+'-'+item.id"/>&nbsp;&nbsp;<span v-if="item.status ==2">{{item.name}}</span><span v-if="item.status ==1" style="color: red;">{{item.name}}</span>
</label>
<br>
<br>
<br>
<div id="jike">
<label style="width: 90%;margin-left: 0.3rem;" v-for="(item,index) in assign_add_list">
<input type="checkbox" style="height: 0.3rem;width: 0.3rem;" v-model="assign_list" :value="item.name+'-'+item.id"/>&nbsp;&nbsp;<span v-if="item.status ==2">{{item.name}}</span><span v-if="item.status ==1" style="color: red;">{{item.name}}</span>
</label>
<br>
<br>
<br>
</div>
<div id="huohu">
加载中,请稍后...
</div>
</div>
<div style="text-align: center;height:calc(5vh);margin-top:0.2rem;">
<button type="button" class="btnTui btn-refund" v-on:click="selectAddAssign()">确定选择</button>
@@ -40,8 +79,8 @@
account = getQueryVariable('account'),
pass = getQueryVariable('password');
if(product_id != 13) {
alert('目前仅支持极客产品!');
if(product_id != 13&&product_id != 19) {
alert('目前仅支持极客、火狐产品!');
window.location.href = "/User/MyAccounts";
}
@@ -61,53 +100,111 @@
var that = this;
this.assign_account = account;
this.assign_pass = pass;
$.ajax({
type: 'GET',
url: 'http://php-api.juip.com/product/AccountAddress/index?user='+account+'&password='+pass,
dataType: "json",
contentType: "application/json",
success: function (res) {
console.log(res)
that.assign_add_list = res;
//if (res.Code == 10000) {
// that.onLineData = res.Data;
// for (var i = 0; i < that.onLineData.length; i++) {
// that.onLineData[i].ProductId = productId;
// }
//}
}
});
if(product_id == 13){
$("#jike").show();
$("#huohu").hide();
$.ajax({
type: 'GET',
url: 'http://php-api.juip.com/product/AccountAddress/index?user='+account+'&password='+pass,
dataType: "json",
contentType: "application/json",
success: function (res) {
that.assign_add_list = res;
//if (res.Code == 10000) {
// that.onLineData = res.Data;
// for (var i = 0; i < that.onLineData.length; i++) {
// that.onLineData[i].ProductId = productId;
// }
//}
}
});
}
if(product_id == 19){
$("#huohu").show();
$("#jike").hide();
$.ajax({
type: 'GET',
url: 'http://php-api.juip.com/product/AccountAddress/getList?user='+account+'&password='+pass,
dataType: "json",
contentType: "application/json",
success: function (res) {
$("#huohu").html('<p style="font-size:30px;">统一服务器地址1.hhip.vip</p>');
$("#huohu").append(res.ipmodel);
$("#huohu").append("<hr>");
$("#huohu").append(res.city);
}
});
}
},
selectAddAssign() {
if(this.assign_list.length>20||this.assign_list.length==0){
alert('最多选择20个至少选择一个');
return;
}
let data = {
list:this.assign_list,
account:this.assign_account,
password:this.assign_pass,
}
$.ajax({
type: 'POST',
url: 'http://php-api.juip.com/product/AccountAddress/select',
dataType: "json",
data:JSON.stringify(data),
contentType: "application/json",
success: function (res) {
if(res.code == 1){
alert('选择成功');
} else {
alert('选择失败');
}
//if (res.Code == 10000) {
// that.onLineData = res.Data;
// for (var i = 0; i < that.onLineData.length; i++) {
// that.onLineData[i].ProductId = productId;
// }
//}
if(product_id == 13){
if(this.assign_list.length>20||this.assign_list.length==0){
alert('最多选择20个至少选择一个');
return;
}
});
let data = {
list:this.assign_list,
account:this.assign_account,
password:this.assign_pass,
}
$.ajax({
type: 'POST',
url: 'http://php-api.juip.com/product/AccountAddress/select',
dataType: "json",
data:JSON.stringify(data),
contentType: "application/json",
success: function (res) {
if(res.code == 1){
alert('选择成功');
} else {
alert('选择失败');
}
//if (res.Code == 10000) {
// that.onLineData = res.Data;
// for (var i = 0; i < that.onLineData.length; i++) {
// that.onLineData[i].ProductId = productId;
// }
//}
}
});
}
if(product_id == 19){
let address_checked = [];
$("input[name='citys[]']:checked").each(function(i){
address_checked.push($(this).val());
});
let ipmode = $("select[name='ipmode']").val();
console.log(address_checked)
console.log(ipmode)
let data = {
list:address_checked,
account:this.assign_account,
password:this.assign_pass,
ipmode:ipmode,
}
$.ajax({
type: 'POST',
url: 'http://php-api.juip.com/product/AccountAddress/setAddress',
dataType: "json",
data:JSON.stringify(data),
contentType: "application/json",
success: function (res) {
if(res.code == 1){
alert('选择成功');
} else {
alert('选择失败');
}
//if (res.Code == 10000) {
// that.onLineData = res.Data;
// for (var i = 0; i < that.onLineData.length; i++) {
// that.onLineData[i].ProductId = productId;
// }
//}
}
});
}
},
}
})

View File

@@ -27,4 +27,34 @@
$("#coupon_num").text(res.Data.length);
}
})
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
var is_realname = getQueryString('realname');
if(is_realname){
let data = {
cookie:document.cookie
}
$.ajax({
type: 'POST',
url: 'http://php-api.juip.com/api/test/aliGetResult',
dataType: "json",
contentType: "application/json",
data: JSON.stringify(data),
beforeSend: function(xhr) {
xhr.withCredentials = true;
},
crossDomain: true,
success: function (res) {
}
});
}
</script>

View File

@@ -99,8 +99,8 @@
<a class="btnXq" asp-action="OnLine" asp-controller="User" asp-route-productId="@item.ProductId" asp-route-account="@item.Account">
<button type="button" class="btnXq" style="margin-top:3px">查看在线</button>
</a>
<a class="btnXq" href="/User/AssignAddress?productId=@item.ProductId&account=@item.Account&password=@item.Pwd">
<button type="button" class="btnXq" style="margin-top:3px">指定线路</button>
<a class="btnXq" v-if="@item.ProductId==13||@item.ProductId==19" href="/User/AssignAddress?productId=@item.ProductId&account=@item.Account&password=@item.Pwd">
<button type="button" class="btnXq" style="margin-top:3px">切换地区</button>
</a>
</td>

View File

@@ -94,7 +94,8 @@
<tr>
<th>产品</th>
<th>城市</th>
<th>运营商</th>
<th v-if="product_id ==19">剩余拨数</th>
<th v-else="product_id ==19">运营商</th>
<th>服务器域名</th>
<th>IP量</th>
<th>实时带宽</th>
@@ -228,6 +229,11 @@
this.search_field = '蘑菇IP';
this.sstp = '4430';
break;
case 19:
this.l2tp = '123';
this.search_field = '火狐IP';
this.sstp = '1500';
break;
}
$.ajax({
type: 'GET',
@@ -344,6 +350,9 @@
case 18:
self.location.href='http://php-api.juip.com/script/linedata/data/download/mogu.csv';
break;
case 19:
self.location.href='http://php-api.juip.com/script/linedata/data/download/huohu.csv';
break;
}
}
}

View File

@@ -517,7 +517,7 @@
else if(item.Product.Id == 6||item.Product.Id == 2||item.Product.Id == 4 ||item.Product.Id == 14||item.Product.Id == 8) {
<div class="productItem" id="@("p"+item.Product.Id)" a-pid="@item.Product.Id" a-pkg-id="@(item.Packages.FirstOrDefault(m=>m.Status==1).Id)">@item.Product.Name <span style="color: #f64e3d;font-weight:bold;float:right;padding-right: 5px;">抄底价</span></div>
}
else if(item.Product.Id == 18|| item.Product.Id == 5) {
else if(item.Product.Id == 18|| item.Product.Id == 5|| item.Product.Id == 19) {
<div class="productItem" style="" id="@("p"+item.Product.Id)" a-pid="@item.Product.Id"><span style="color: #f64e3d;font-weight:bold;padding-right: 5px;"> 新</span>@item.Product.Name <span style="color: #f64e3d;font-weight:bold;float:right;padding-right: 5px;">抄底价</span></div>
}
else if(item.Product.Id == 17) {
@@ -606,6 +606,9 @@
@* @if(item.Product.Id == 8){
<p class="youhuiNew">月卡送10天双月卡赠送1个月活动截止时间2021年3月31日<br>同一个IP账号不限次数<span style="color:FF0033;background-color:#FFFF33;">您可对同一账号多次续费都有赠送</span>每位会员不限账号数量您可购买多个IP账号都有赠送</p>
} *@
@if(item.Product.Id == 19){
<p class="youhuiNew">本产品为独享,每个账号对应一个宽带拨号,永不超载,保证了网速及稳定性。<br>使用时只需设置这个唯一的服务器1.hhip.vip在账号列表中点击切换地区即可任意组合自己需要的地区。本产品灵活便捷欢迎选购</p>
}
@*<p class="text-center nameSmall">—<span>@item.Product.Name</span>—</p>*@
<div class="card" style="margin-top:30px;">

View File

@@ -442,6 +442,9 @@
@* @if(defaultProduct.Id == 8){
<p class="youhuiNew">月卡送10天双月卡赠送1个月活动截止时间2021年3月31日<br>同一个IP账号不限次数<span style="color:FF0033;background-color:#FFFF33;">您可对同一账号多次续费都有赠送</span>每位会员不限账号数量您可购买多个IP账号都有赠送</p>
} *@
@if(defaultProduct.Id == 19){
<p class="youhuiNew">本产品为独享,每个账号对应一个宽带拨号,永不超载,保证了网速及稳定性。<br>使用时只需设置这个唯一的服务器1.hhip.vip在账号列表中点击切换地区即可任意组合自己需要的地区。本产品灵活便捷欢迎选购</p>
}
<div class="card">
<div style="display: flex;margin: 0 auto;">

View File

@@ -51,6 +51,18 @@
padding: 30px;
display: none;
}
.citylabel {
font-weight: normal;
width: 160px;
height: 35px;
padding-left: 5px;
padding-top: 5px;
text-align: left;
border: solid 1px #ccc;
}
.province{
margin-bottom: 10px;
}
.online {
position: fixed;
@@ -250,20 +262,26 @@
</div>
</div>
@* 指定地区 *@
<div class="online" style="overflow: hidden;" v-cloak v-if="showAddress">
<h4>最多选择20条线路 <span style="color: red;">标红</span>为线路正在维护中</h4>
<img src="~/img/close.png" class="btnOnlineClose" style="position: absolute;top:10px;" v-on:click="closeOnline()" />
<div style="overflow-y: auto;width:950px;height:580px;">
<div class="checkbox">
<label style="width: 25%;" v-for="(item,index) in assign_add_list">
<input type="checkbox" v-model="assign_list" :value="item.name+'-'+item.id"><span v-if="item.status ==2">{{item.name}}</span><span v-if="item.status ==1" style="color: red;">{{item.name}}</span>
</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" v-on:click="closeOnline()">取消</button>
<button type="button" class="btn btn-primary" v-on:click="selectAddAssign()">确定选择</button>
</div>
<div class="online" style="overflow: hidden;display:none;" v-cloak id="showAddress">
<div id="jike">
<h4>最多选择20条线路 <span style="color: red;">标红</span>为线路正在维护中</h4>
<img src="~/img/close.png" class="btnOnlineClose" style="position: absolute;top:10px;" v-on:click="closeOnline()" />
<div style="overflow-y: auto;width:950px;height:580px;">
<div class="checkbox">
<label style="width: 25%;" v-for="(item,index) in assign_add_list">
<input type="checkbox" v-model="assign_list" :value="item.name+'-'+item.id"><span v-if="item.status ==2">{{item.name}}</span><span v-if="item.status ==1" style="color: red;">{{item.name}}</span>
</label>
</div>
</div>
</div>
<div id="huohu" style="overflow-y: auto;width:950px;height:580px;">
请稍后,加载中...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" v-on:click="closeOnline()">取消</button>
<button type="button" class="btn btn-primary" v-on:click="selectAddAssign()">确定选择</button>
</div>
</div>
<div class="editList">
<form>
@@ -346,7 +364,7 @@
<button type="button" class="btn btn-danger btn-rebuy"><img src="~/img/xufei.png"> 续费</button>
<button type="button" class="btn btn-primary btn-refund">
<img src="~/img/tui.png"> 退货</button>
<a style="color:red">&nbsp;*非本系统开通账号无法退款,请联系客服处理</a>
<a style="color:red">&nbsp;*批量续费可通过筛选和搜索功能精准定位账号</a>
</div>
<div class="col-lg-6 text-right">
<button type="button" class="btn btn-primary laozhanghao"><img src="~/img/renzheng_gray.png"> 老账号认证</button>
@@ -382,7 +400,7 @@
<td class="redT">@(item.Status==AccountStatus.Refund?"已退货": item.RestTime)</td>
@*<td class="greenT">查看</td>*@
<td class="blueT"><a @@click="online(@item.ProductId,'@item.Account')">查看</a> </td>
<td class="blueT"><a @@click="assign_address(@item.ProductId,'@item.Account','@item.Pwd')">地区列表</a> </td>
<td class="blueT"><a v-if="@item.ProductId==13||@item.ProductId==19" @@click="assign_address(@item.ProductId,'@item.Account','@item.Pwd')">切换地区</a> </td>
<td class="blueT"><a asp-action="Index" asp-controller="LineList" asp-route-ProductId="@item.ProductId" target="_blank">查看</a> </td>
<td class="blueT"> <a asp-action="soft" asp-controller="product" target="_blank">下载</a></td>
</tr>
@@ -452,11 +470,11 @@
mutilAuthLoading: false,
oneAuthLoading: false,
showOnline: false,
showAddress: false,
assign_add_list:[],
assign_list:[],
assign_account:'',
assign_pass:'',
productId:'',
searchModel: {
ExpiredDay:-1,
ProductId:@this.Context.Request.GetInt("ProductId"),
@@ -643,64 +661,125 @@
});
},
assign_address(productId, account,pass) {
if(productId != 13){
alert('目前仅支持极客产品!');
if(productId != 13 && productId != 19){
alert('目前仅支持极客、火狐产品!');
return;
}
this.showAddress = true
var that = this;
$("#showAddress").show();
var that = this;
this.assign_account = account;
this.assign_pass = pass;
$.ajax({
type: 'GET',
url: 'http://php-api.juip.com/product/AccountAddress/index?user='+account+'&password='+pass,
dataType: "json",
contentType: "application/json",
success: function (res) {
that.assign_add_list = res;
//if (res.Code == 10000) {
// that.onLineData = res.Data;
// for (var i = 0; i < that.onLineData.length; i++) {
// that.onLineData[i].ProductId = productId;
// }
//}
}
});
this.assign_pass = pass;
this.productId = productId;
if(productId == 13){
$("#jike").show();
$("#huohu").hide();
$.ajax({
type: 'GET',
url: 'http://php-api.juip.com/product/AccountAddress/index?user='+account+'&password='+pass,
dataType: "json",
contentType: "application/json",
success: function (res) {
that.assign_add_list = res;
//if (res.Code == 10000) {
// that.onLineData = res.Data;
// for (var i = 0; i < that.onLineData.length; i++) {
// that.onLineData[i].ProductId = productId;
// }
//}
}
});
}
if(productId == 19){
$("#huohu").show();
$("#jike").hide();
$.ajax({
type: 'GET',
url: 'http://php-api.juip.com/product/AccountAddress/getList?user='+account+'&password='+pass,
dataType: "json",
contentType: "application/json",
success: function (res) {
$("#huohu").html('<p style="font-size:30px;">统一服务器地址1.hhip.vip</p>');
$("#huohu").append(res.ipmodel);
$("#huohu").append("<hr>");
$("#huohu").append(res.city);
}
});
}
},
selectAddAssign() {
if(this.assign_list.length>20||this.assign_list.length==0){
alert('最多选择20个至少选择一个');
return;
}
let data = {
list:this.assign_list,
account:this.assign_account,
password:this.assign_pass,
}
$.ajax({
type: 'POST',
url: 'http://php-api.juip.com/product/AccountAddress/select',
dataType: "json",
data:JSON.stringify(data),
contentType: "application/json",
success: function (res) {
if(res.code == 1){
alert('选择成功');
} else {
alert('选择失败');
}
//if (res.Code == 10000) {
// that.onLineData = res.Data;
// for (var i = 0; i < that.onLineData.length; i++) {
// that.onLineData[i].ProductId = productId;
// }
//}
if(this.productId == 19){
let address_checked = [];
$("input[name='citys[]']:checked").each(function(i){
address_checked.push($(this).val());
});
let ipmode = $("select[name='ipmode']").val();
console.log(address_checked)
console.log(ipmode)
let data = {
list:address_checked,
account:this.assign_account,
password:this.assign_pass,
ipmode:ipmode,
}
});
$.ajax({
type: 'POST',
url: 'http://php-api.juip.com/product/AccountAddress/setAddress',
dataType: "json",
data:JSON.stringify(data),
contentType: "application/json",
success: function (res) {
if(res.code == 1){
alert('选择成功');
} else {
alert('选择失败');
}
//if (res.Code == 10000) {
// that.onLineData = res.Data;
// for (var i = 0; i < that.onLineData.length; i++) {
// that.onLineData[i].ProductId = productId;
// }
//}
}
});
}
if(this.productId == 13){
if(this.assign_list.length>20||this.assign_list.length==0){
alert('最多选择20个至少选择一个');
return;
}
let data = {
list:this.assign_list,
account:this.assign_account,
password:this.assign_pass,
}
$.ajax({
type: 'POST',
url: 'http://php-api.juip.com/product/AccountAddress/select',
dataType: "json",
data:JSON.stringify(data),
contentType: "application/json",
success: function (res) {
if(res.code == 1){
alert('选择成功');
} else {
alert('选择失败');
}
//if (res.Code == 10000) {
// that.onLineData = res.Data;
// for (var i = 0; i < that.onLineData.length; i++) {
// that.onLineData[i].ProductId = productId;
// }
//}
}
});
}
},
closeOnline() {
this.showOnline = false;
this.showAddress = false;
$("#showAddress").hide();
this.onLineData = [];
},
killout: function (item) {

View File

@@ -0,0 +1,475 @@
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 AgentClient14Service: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 AgentClient14Service(IHttpClientFactory httpClientFactory):base(httpClientFactory)
{
m_HttpClientFactory = httpClientFactory;
}
public override async Task<int> 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<ApiResult> Login(AgentLoginRequest request)
{
return new ApiResult(request.Key);
}
public override bool CheckAccount(int productId,List<string> accounts)
{
return false;
}
/// <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)
{
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 userid = "kh";
var url = "/api/raduserCreate?agentid="+agentid+"&ti="+time_s+"&nonce="+nonce+"&sign="+sign+"&userid="+userid+"&username="+account+"&password="+pwd+"&prdid=8&maxonline="+connCount+"&day="+packageKey;
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();
if (status =="0")
{
return new ApiResult(ResultCode.C_SUCCESS);
}
else
{
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败");
}
}
/// <summary>
/// 新开
/// </summary>
/// <param name="packageId"></param>
/// <param name="account"></param>
/// <param name="pwd"></param>
/// <returns></returns>
public override async Task<ApiResult> 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<string, string>(){
{"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, "开户失败");
}
}
/// <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)
{
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/raduserRenew?agentid="+agentid+"&ti="+time_s+"&nonce="+nonce+"&sign="+sign+"&username="+account+"&day="+packageKey;
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();
if (status =="0")
{
return new ApiResult(1);
}
else
{
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 infoRet = await this.GetAccountInfo(account, true);
if (infoRet.Code != ResultCode.C_SUCCESS)
return false;
var title = GetOpTitle("DeleteAccount", account);
LogHelper.Info(title, account);
try
{
var delete = this.DeleteUrl + infoRet.Data.Id + ".html";
var resp = await client.GetAsync(delete);
var content = await resp.Content.ReadAsStringAsync();
if (content.Has() && content.IndexOf("alert(\"删除成功\")") != -1)
{
return true;
}
else
{
LogHelper.Error(title, content);
return false;
}
}
catch (Exception ex)
{
LogHelper.Error(title, ex.Message);
return false;
}
}
/// <summary>
/// 得到账号信息
/// </summary>
/// <param name="productId"></param>
/// <param name="account"></param>
/// <returns></returns>
public override async Task<ApiResult<OriginAccountModel>> 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<OriginAccountModel>(trData);
}
else
{
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)
{
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/raduserChpw?agentid="+agentid+"&ti="+time_s+"&nonce="+nonce+"&sign="+sign+"&username="+account+"&newpass="+pwd;
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();
if (status =="0")
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 退款
/// </summary>
/// <param name="packageId"></param>
/// <param name="account"></param>
/// <returns></returns>
public override async Task<ApiResult> Refund(string account, string packageKey, int days)
{
return new ApiResult(1);
}
/// <summary>
/// 是否在线
/// </summary>
/// <param name="productId"></param>
/// <param name="account"></param>
/// <returns></returns>
public override async Task<ApiResult<List<OriginAccountOnlineModel>>> 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<OriginAccountOnlineModel>();
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<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)
{
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;
}
/// <summary>
/// 是否存在
/// </summary>
/// <param name="account"></param>
/// <returns></returns>
public override async Task<bool> Exist(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/raduserExist?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 false;
}
return true;
}
}
}

View File

@@ -69,6 +69,8 @@ namespace Hncore.Pass.Vpn.Service
agent = new AgentClient12Service(m_HttpClientFactory) { ClientName = product.GroupNO };
if (product.GroupNO == "g13")
agent = new AgentClient13Service(m_HttpClientFactory) { ClientName = product.GroupNO };
if (product.GroupNO == "g14")
agent = new AgentClient14Service(m_HttpClientFactory) { ClientName = product.GroupNO };
agent.Product = product;
return agent;
}