极客开通失败-退款天数

This commit is contained in:
wanyongkang
2020-11-26 15:37:39 +08:00
parent 149fabd9d6
commit 52524905e5
2 changed files with 50 additions and 11 deletions

View File

@@ -182,7 +182,6 @@ namespace Hncore.Pass.Vpn.Service
LogHelper.Info(title, map.ToJson());
try
{
var resp = await client.GetAsync(this.UserApiUrl + "?" + this.FormatRequest(map));
var content = await resp.Content.ReadAsStringAsync();
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
@@ -194,13 +193,33 @@ namespace Hncore.Pass.Vpn.Service
else
{
LogHelper.Error(title, content);
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败"+status);
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败");
}
}
catch (Exception ex)
{
LogHelper.Error(title, ex.GetInfo());
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败");
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, "开户失败");
}
}
catch (Exception exs)
{
LogHelper.Error(title, exs.GetInfo());
return new ApiResult(ResultCode.C_INVALID_ERROR, "开户失败");
}
}
}
/// <summary>
@@ -330,7 +349,27 @@ namespace Hncore.Pass.Vpn.Service
catch (Exception ex)
{
LogHelper.Error(title, ex.Message);
return new ApiResult(ResultCode.C_INVALID_ERROR, "续费失败");
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, "续费失败");
}
}
catch (Exception exs)
{
LogHelper.Error(title, exs.Message);
return new ApiResult(ResultCode.C_INVALID_ERROR, "续费失败");
}
}
}
/// <summary>

View File

@@ -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 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;
refundAmount = refundAmount <= 0 ? 0 : refundAmount;
var order = new ProductOrderEntity()
@@ -777,7 +777,7 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
PayType = PayType.None,
UserId = userId,
UserName = accountInfo.UserCode,
DayCount = (lastOrder.EndTime - DateTime.Now).Value.Days,
DayCount = (accountInfo.EndTime - DateTime.Now).Value.Days,
DayPrice = refundDayPrice,
Accounts = account,
PaymentAmount = lastOrder.PaymentAmount/ lastOrder.AccountCount,
@@ -786,7 +786,7 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
Remark = "退款",
RefundReason = reason,
};
var time = (lastOrder.EndTime - DateTime.Now).Value;
var time = (accountInfo.EndTime - DateTime.Now).Value;
order.RefundRestTime = time.ToString(@"d\天hh\时mm\分");
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 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;
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 info = $"{accountInfo.Account}已使用{useDay}天,剩余{RefundRestTime},可退金额{RefundAmount}元";