diff --git a/Host/Views/User/Api.cshtml b/Host/Views/User/Api.cshtml
index cbc9abd..b4a1bcc 100644
--- a/Host/Views/User/Api.cshtml
+++ b/Host/Views/User/Api.cshtml
@@ -435,6 +435,43 @@
+
+
九、解除账号腾讯限制(仅限于极狐、猎豹、极光、蘑菇)
+
使用此权限请务必做好监管义务,如与用户签署或用户同意《网络信息安全承诺书》,上传手持身份证等措施,因您方监管不利导致的一切后果自负,使用此接口即视为默认同意此条款!
+
接口地址:/api/account/openlimit?apikey=1232455165&account=test&productId=29
+
请求方式:GET
+
+ 请求参数:
+
+
+ | apikey |
+ 唯一key值 |
+
+
+ | account |
+ 账号 |
+
+
+ | productId |
+ 产品ID |
+
+
+
+
+ 返回数据:
+
+
+ | Code |
+ 10000 解除成功/其他 失败 |
+
+
+ | Message |
+ 返回提示 |
+
+
+
+
+
diff --git a/Host/Views/User/MyAccounts.cshtml b/Host/Views/User/MyAccounts.cshtml
index 4da46d2..de2c638 100644
--- a/Host/Views/User/MyAccounts.cshtml
+++ b/Host/Views/User/MyAccounts.cshtml
@@ -378,7 +378,7 @@
到期时间 |
剩余时间 |
在线及踢线 |
- 选择地区 |
+
操作 |
软件下载 |
@@ -401,9 +401,9 @@
@(item.Status==AccountStatus.Refund?"已退货": item.RestTime) |
@*查看 | *@
查看 |
- 切换地区 |
+
- 删除 |
+ 删除 |
下载 |
} else {
@@ -423,7 +423,7 @@
@(item.Status==AccountStatus.Refund?"已退货": item.RestTime) |
@*查看 | *@
查看 |
- 切换地区 |
+
删除 |
下载 |
@@ -669,22 +669,23 @@
id: Id
}
-
- $.ajax({
- type: 'POST',
- url: 'https://php-api.juip.com/manager/account/delete',
- dataType: "json",
- contentType: "application/json",
- data: JSON.stringify(data),
- beforeSend: function(xhr) {
- xhr.withCredentials = true;
- },
- crossDomain: true,
- success: function (res) {
- alert('删除成功');
- location.reload();
- }
- });
+ if (confirm("您确定要删除该账号吗?")) {
+ $.ajax({
+ type: 'POST',
+ url: 'https://php-api.juip.com/manager/account/delete',
+ dataType: "json",
+ contentType: "application/json",
+ data: JSON.stringify(data),
+ beforeSend: function(xhr) {
+ xhr.withCredentials = true;
+ },
+ crossDomain: true,
+ success: function (res) {
+ alert('删除成功');
+ location.reload();
+ }
+ });
+ }
},
change_ip(account_id,package,account,old_ip){
this.province_city = [];
diff --git a/Services/Hncore.Pass.Vpn/Controllers/ProductOrderController.cs b/Services/Hncore.Pass.Vpn/Controllers/ProductOrderController.cs
index 8239578..baaaea1 100644
--- a/Services/Hncore.Pass.Vpn/Controllers/ProductOrderController.cs
+++ b/Services/Hncore.Pass.Vpn/Controllers/ProductOrderController.cs
@@ -208,7 +208,7 @@ namespace Hncore.Pass.Vpn.Controllers
{
//通过apikey获取用户信息
var userInfo = m_BaseUserService.Query(m => m.apikey == request.apikey).FirstOrDefault();
- return await m_ProductOrderService.Refund(userInfo.Id, request.Account);
+ return await m_ProductOrderService.ApiRefund(userInfo.Id, request.Account);
}
[UserAuth]
diff --git a/Services/Hncore.Pass.Vpn/Service/ProductOrderService.cs b/Services/Hncore.Pass.Vpn/Service/ProductOrderService.cs
index 1a04e84..f46e0f7 100644
--- a/Services/Hncore.Pass.Vpn/Service/ProductOrderService.cs
+++ b/Services/Hncore.Pass.Vpn/Service/ProductOrderService.cs
@@ -1324,6 +1324,165 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
}
}
+ public async Task ApiRefund(int userId, string account)
+ {
+ using (await _mutex1.LockAsync())
+ {
+ var reason = "";
+ if(account.Contains("-")){
+ string[] arrStr = account.Split('-');
+ account = arrStr[0];
+ reason = arrStr[1];
+ }
+ var accountInfo = await m_ProductAccountService.GetAccountInfo(account, userId);
+
+ if (accountInfo == null)
+ {
+ return new ApiResult(ResultCode.C_Illegal_Operation, "账户不存在");
+ }
+ if(accountInfo.ProductId == 20||accountInfo.ProductId == 21){
+ return new ApiResult(ResultCode.C_Illegal_Operation, "无极账号不允许退款");
+ }
+ if (accountInfo.AccountType == (int)AccountType.Origin)
+ {
+ return new ApiResult(ResultCode.C_Illegal_Operation, "认证的账号不能退款");
+ }
+ if (accountInfo.EndTime < DateTime.Now)
+ {
+ return new ApiResult(ResultCode.C_Illegal_Operation, "已经过期");
+ }
+ var pacageInfo = await m_ProductPackageService.GetById(accountInfo.PackageId);
+
+ // if (pacageInfo.DayCount == 1)
+ // {
+ // return new ApiResult(ResultCode.C_Illegal_Operation, "天卡不能退款");
+ // }
+ if (pacageInfo.IsTest == 1)
+ {
+ return new ApiResult(ResultCode.C_Illegal_Operation, "测试卡不能退款");
+ }
+ var product = await this.m_ProductService.GetById(pacageInfo.ProductId);
+
+ //折扣
+ var refundDayPrice = 10.00M;
+ var userEntity = await m_UserService.GetById(userId);
+ if((userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)) && userEntity.discount_id >= 0){
+ //获取代理折扣
+ var discount = await m_ProductPriceSchemeService.GetById(userEntity.discount_id);
+ if (discount != null){
+ refundDayPrice = (product.RefundDayPrice * discount.discount / 100).ToDecimal();
+ } else {
+ refundDayPrice = (product.RefundDayPrice).ToDecimal();
+ }
+ } else {
+ var userPrice = await m_ProductUserPriceService.GetPackageUserPrice(pacageInfo.Id, userId);
+
+ refundDayPrice = (userPrice != null && userPrice.RefundDayPrice > 0 ? userPrice.RefundDayPrice : product.RefundDayPrice).ToDecimal();
+ }
+
+
+ var lastOrder = await GetLastOrderByAccount(account);
+
+ var dateStr = lastOrder.StartTime.ToString();
+ var now = DateTime.Now.GetUnixTimeStamp();
+
+
+
+ //解析字符串为 DateTime(假设是本地时间)
+ DateTime dateTime = DateTime.Parse(dateStr);
+
+ // 转换为 UTC(如果原始时间是本地时间)
+ DateTime utcTime = dateTime.ToUniversalTime();
+
+ // 计算 Unix 时间戳(秒)
+ DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+ TimeSpan timeDiff = utcTime - epoch;
+ long unixTimestampSeconds = (long)timeDiff.TotalSeconds + 3600;
+
+ var useDay = (int)Math.Ceiling((DateTime.Now - lastOrder.UpdateTime).TotalDays);
+
+ if (unixTimestampSeconds > now) {
+ useDay = 0;
+ }
+
+ var refundAmount = lastOrder.PaymentAmount / lastOrder.AccountCount - useDay * refundDayPrice * accountInfo.ConnectCount;
+ refundAmount = refundAmount <= 0 ? 0 : refundAmount;
+
+ //退款用户总消费修改 这个好像没用用处 已经有其他的统计地方
+ userEntity.ConsumeAmount -= refundAmount;
+ await m_UserService.Update(userEntity);
+
+ var order = new ProductOrderEntity()
+ {
+ AccountCount = 1,
+ ConnectCount = accountInfo.ConnectCount,
+ OrderName = accountInfo.ProductName,
+ OrderNo = GeneratOrderNO(userId, OrderType.Refund),
+ OrderState = OrderStatus.RequestRefund,
+ OrderType = OrderType.Refund,
+ PackageId = accountInfo.PackageId.Value,
+ PackageName = accountInfo.PackageName,
+ ProductId = accountInfo.ProductId.Value,
+ ProductName = accountInfo.ProductName,
+ PayType = PayType.None,
+ UserId = userId,
+ UserName = accountInfo.UserCode,
+ DayCount = (accountInfo.EndTime - DateTime.Now).Value.Days,
+ DayPrice = refundDayPrice,
+ Accounts = account,
+ PaymentAmount = lastOrder.PaymentAmount/ lastOrder.AccountCount,
+ RefundAmount = refundAmount,
+ RefundCount = 1,
+ Remark = "API退款",
+ RefundReason = reason,
+ agent_id = accountInfo.agent_id
+ };
+ var time = (accountInfo.EndTime - DateTime.Now).Value;
+ order.RefundRestTime = time.ToString(@"d\天hh\时mm\分");
+
+ //短信内容 部分运营商收不到短信
+ var tpl_info = new Dictionary(){
+ {"product",accountInfo.ProductName},
+ {"package",accountInfo.PackageName },
+ {"connect",accountInfo.ConnectCount.ToString() },
+ {"account",account },
+ {"resttime",order.RefundRestTime},
+ };
+
+ var againBuy = lastOrder.OrderType == OrderType.AgainBuy || lastOrder.OrderType == OrderType.AgainBuys;
+
+ var laoyingXunFei = againBuy && lastOrder.ProductId == 4;
+ if (product.AutoRefund == 1 && !laoyingXunFei)
+ {
+ var refundRet = await this.m_AgentService.Refund(pacageInfo, accountInfo);
+ if (refundRet.Code == ResultCode.C_SUCCESS)
+ {
+ order.OrderState = OrderStatus.AutoRefundOver;
+ }
+ }
+ var amountInfo = new BaseInfo.Request.User.UpdateAmountRequest()
+ {
+ Amount = order.RefundAmount,
+ OpAmountType = ScoreType.AccountRefund,
+ UserId = order.UserId,
+ AttchInfo = order.OrderNo,
+ OperateUserName = accountInfo.UserCode
+ };
+ var retAmount = await m_BaseUserService.UpdateAmount(amountInfo);
+ accountInfo.EndTime = DateTime.Now;
+ accountInfo.Status = AccountStatus.Refund;
+ await m_ProductAccountService.Update(accountInfo);
+ await this.Add(order);
+
+ var managerEntity = await m_ManageService.GetById(userEntity.ManagerId.ToInt());
+ if (managerEntity.TenantId == 1 && managerEntity.RoleId == 100 && DateTime.Now.Hour<23 && DateTime.Now.Hour>8) {
+ AliSmsService.Send("SMS_462300235", new { name = userEntity.ManagerName,phone=userEntity.Phone }, "河南华连网络科技", managerEntity.Phone);
+ }
+ return new ApiResult(1);
+ }
+ }
+
+
public async Task CaclRefund(int userId, string account)
{
var accountInfo = await m_ProductAccountService.GetAccountInfo(account, userId);