测试卡超免费1元

This commit is contained in:
“wanyongkang”
2023-07-16 14:01:53 +08:00
parent f530a094b7
commit f22ef6578f
6 changed files with 145 additions and 186 deletions

View File

@@ -81,7 +81,7 @@ namespace Home.Controllers
public async Task<IActionResult> Index()
{
var respList = await m_ProductService.ProductWithPackage(1);
var userInfo = this.Request.GetUserInfo();
if (userInfo != null)
{
@@ -90,6 +90,13 @@ namespace Home.Controllers
var user_Info = await m_UserService.GetById(userInfo.UserId);
var ProductAccountCount = user_Info.ProductAccountCount;
//判断测试卡使用次数是否超过限定次数 false表示免费没用完 true表示免费测试已经用完
var test_flag = false;
if ((user_Info.TestCountLimit!=0 && user_Info.TestCountLimit<=user_Info.UseTestCount) || (user_Info.TestCountLimit ==0 && user_Info.UseTestCount>2)) {
test_flag = true;
}
if((user_Info.agent_id == 0||(user_Info.agent_id != 0 && user_Info.discount_id != 0)) && user_Info.discount_id >= 0){
//根据折扣设置价格
@@ -97,6 +104,7 @@ namespace Home.Controllers
var dis_price = 1000000.0M;
foreach(var product in respList)
{
product.Product.Content = "0";
product.Packages.ForEach(m => {
if (discount != null)
@@ -115,7 +123,17 @@ namespace Home.Controllers
// if (ProductAccountCount == 0 && (m.DayCount == 1||m.DayCount == 2) && m.Id != 1034&&m.Id != 1040&&m.Id != 1079&&m.Id != 1073){
// m.Price = 0.1M;
// }
//判断测试卡是否收费
if (test_flag && (m.IsTest == 1)) {
m.Price = 1.0M;
m.IsTest =0;
}
});
//判断测试卡是否收费
if (test_flag) {
product.Product.Content = "1";
}
}
} else {
//根据会员价
@@ -123,6 +141,7 @@ namespace Home.Controllers
foreach(var product in respList)
{
product.Product.Content = "0";
product.Packages.ForEach(m => {
m.Title = "0";
@@ -134,12 +153,23 @@ namespace Home.Controllers
// if (ProductAccountCount == 0 && (m.DayCount == 1||m.DayCount == 2) && m.Id != 1034&&m.Id != 1040&&m.Id != 1079&&m.Id != 1073){
// m.Price = 0.1M;
// }
//判断测试卡是否收费
if (test_flag && (m.IsTest == 1)) {
m.Price = 1.0M;
m.IsTest =0;
}
});
//判断测试卡是否收费
if (test_flag) {
product.Product.Content = "1";
}
}
}
} else {
foreach(var product in respList)
{
product.Product.Content = "0";
product.Packages.ForEach(m => {
m.Title = "0";