极客开通失败-退款天数
This commit is contained in:
@@ -182,7 +182,6 @@ namespace Hncore.Pass.Vpn.Service
|
|||||||
LogHelper.Info(title, map.ToJson());
|
LogHelper.Info(title, map.ToJson());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
var resp = await client.GetAsync(this.UserApiUrl + "?" + this.FormatRequest(map));
|
var resp = await client.GetAsync(this.UserApiUrl + "?" + this.FormatRequest(map));
|
||||||
var content = await resp.Content.ReadAsStringAsync();
|
var content = await resp.Content.ReadAsStringAsync();
|
||||||
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||||
@@ -194,15 +193,35 @@ namespace Hncore.Pass.Vpn.Service
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogHelper.Error(title, content);
|
LogHelper.Error(title, content);
|
||||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败"+status);
|
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.Error(title, ex.GetInfo());
|
ex.GetInfo();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var resp = await client.GetAsync(this.UserApiUrl + "?" + this.FormatRequest(map));
|
||||||
|
var content = await resp.Content.ReadAsStringAsync();
|
||||||
|
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||||
|
var status = jo["code"].ToString();
|
||||||
|
if (status == "1")
|
||||||
|
{
|
||||||
|
return new ApiResult(ResultCode.C_SUCCESS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogHelper.Error(title, content);
|
||||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败");
|
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception exs)
|
||||||
|
{
|
||||||
|
LogHelper.Error(title, exs.GetInfo());
|
||||||
|
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 新开测试账号
|
/// 新开测试账号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -330,9 +349,29 @@ namespace Hncore.Pass.Vpn.Service
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.Error(title, ex.Message);
|
LogHelper.Error(title, ex.Message);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var resp = await client.GetAsync(this.UserApiUrl + "?" + this.FormatRequest(map));
|
||||||
|
var content = await resp.Content.ReadAsStringAsync();
|
||||||
|
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
|
||||||
|
var status = jo["code"].ToString();
|
||||||
|
if (status == "1")
|
||||||
|
{
|
||||||
|
return new ApiResult(ResultCode.C_SUCCESS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogHelper.Error(title, content);
|
||||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "续费失败");
|
return new ApiResult(ResultCode.C_INVALID_ERROR, "续费失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception exs)
|
||||||
|
{
|
||||||
|
LogHelper.Error(title, exs.Message);
|
||||||
|
return new ApiResult(ResultCode.C_INVALID_ERROR, "续费失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除账号
|
/// 删除账号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -758,8 +758,8 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
|
|||||||
var refundDayPrice = userPrice != null && userPrice.RefundDayPrice > 0 ? userPrice.RefundDayPrice : product.RefundDayPrice;
|
var refundDayPrice = userPrice != null && userPrice.RefundDayPrice > 0 ? userPrice.RefundDayPrice : product.RefundDayPrice;
|
||||||
|
|
||||||
var lastOrder = await GetLastOrderByAccount(account);
|
var lastOrder = await GetLastOrderByAccount(account);
|
||||||
|
//获取使用天数
|
||||||
var useDay = (int)Math.Ceiling((DateTime.Now - lastOrder.UpdateTime).TotalDays);
|
var useDay = (int)Math.Ceiling((DateTime.Now - accountInfo.CreateTime).TotalDays);
|
||||||
var refundAmount = lastOrder.PaymentAmount / lastOrder.AccountCount - useDay * refundDayPrice.Value * accountInfo.ConnectCount;
|
var refundAmount = lastOrder.PaymentAmount / lastOrder.AccountCount - useDay * refundDayPrice.Value * accountInfo.ConnectCount;
|
||||||
refundAmount = refundAmount <= 0 ? 0 : refundAmount;
|
refundAmount = refundAmount <= 0 ? 0 : refundAmount;
|
||||||
var order = new ProductOrderEntity()
|
var order = new ProductOrderEntity()
|
||||||
@@ -777,7 +777,7 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
|
|||||||
PayType = PayType.None,
|
PayType = PayType.None,
|
||||||
UserId = userId,
|
UserId = userId,
|
||||||
UserName = accountInfo.UserCode,
|
UserName = accountInfo.UserCode,
|
||||||
DayCount = (lastOrder.EndTime - DateTime.Now).Value.Days,
|
DayCount = (accountInfo.EndTime - DateTime.Now).Value.Days,
|
||||||
DayPrice = refundDayPrice,
|
DayPrice = refundDayPrice,
|
||||||
Accounts = account,
|
Accounts = account,
|
||||||
PaymentAmount = lastOrder.PaymentAmount/ lastOrder.AccountCount,
|
PaymentAmount = lastOrder.PaymentAmount/ lastOrder.AccountCount,
|
||||||
@@ -786,7 +786,7 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
|
|||||||
Remark = "退款",
|
Remark = "退款",
|
||||||
RefundReason = reason,
|
RefundReason = reason,
|
||||||
};
|
};
|
||||||
var time = (lastOrder.EndTime - DateTime.Now).Value;
|
var time = (accountInfo.EndTime - DateTime.Now).Value;
|
||||||
order.RefundRestTime = time.ToString(@"d\天hh\时mm\分");
|
order.RefundRestTime = time.ToString(@"d\天hh\时mm\分");
|
||||||
|
|
||||||
var againBuy = lastOrder.OrderType == OrderType.AgainBuy || lastOrder.OrderType == OrderType.AgainBuys;
|
var againBuy = lastOrder.OrderType == OrderType.AgainBuy || lastOrder.OrderType == OrderType.AgainBuys;
|
||||||
@@ -841,11 +841,11 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
|
|||||||
var refundDayPrice = userPrice == null ? product.RefundDayPrice : userPrice.RefundDayPrice;
|
var refundDayPrice = userPrice == null ? product.RefundDayPrice : userPrice.RefundDayPrice;
|
||||||
|
|
||||||
var lastOrder = await GetLastOrderByAccount(account);
|
var lastOrder = await GetLastOrderByAccount(account);
|
||||||
var useDay = (int)Math.Ceiling((DateTime.Now - lastOrder.UpdateTime).TotalDays);
|
var useDay = (int)Math.Ceiling((DateTime.Now - accountInfo.CreateTime).TotalDays);
|
||||||
var RefundAmount = lastOrder.PaymentAmount / lastOrder.AccountCount - useDay * refundDayPrice.Value * accountInfo.ConnectCount;
|
var RefundAmount = lastOrder.PaymentAmount / lastOrder.AccountCount - useDay * refundDayPrice.Value * accountInfo.ConnectCount;
|
||||||
RefundAmount = RefundAmount <= 0 ? 0 : RefundAmount;
|
RefundAmount = RefundAmount <= 0 ? 0 : RefundAmount;
|
||||||
|
|
||||||
var time = (lastOrder.EndTime - DateTime.Now).Value;
|
var time = (accountInfo.EndTime - DateTime.Now).Value;
|
||||||
var RefundRestTime = time.ToString(@"d\天hh\时mm\分");
|
var RefundRestTime = time.ToString(@"d\天hh\时mm\分");
|
||||||
|
|
||||||
var info = $"{accountInfo.Account}已使用{useDay}天,剩余{RefundRestTime},可退金额{RefundAmount}元";
|
var info = $"{accountInfo.Account}已使用{useDay}天,剩余{RefundRestTime},可退金额{RefundAmount}元";
|
||||||
|
|||||||
Reference in New Issue
Block a user