天天产品分类

This commit is contained in:
“wanyongkang”
2021-10-21 14:05:04 +08:00
parent 7aedb2d73e
commit a3c6952804
8 changed files with 331 additions and 202 deletions

View File

@@ -121,7 +121,7 @@ namespace Home.Controllers
if(m.Price<m.MinPrice){
m.Price = m.MinPrice;
}
if (ProductAccountCount == 0 && (m.DayCount == 1||m.DayCount == 2)){
if (ProductAccountCount == 0 && (m.DayCount == 1||m.DayCount == 2) && m.Id != 1034&&m.Id != 1040){
m.Price = 0.1M;
}
});
@@ -149,7 +149,7 @@ namespace Home.Controllers
{
m.Price = userPrice.UserPrice;
}
if (ProductAccountCount == 0 && (m.DayCount == 1||m.DayCount == 2)){
if (ProductAccountCount == 0 && (m.DayCount == 1||m.DayCount == 2) && m.Id != 1034&&m.Id != 1040){
m.Price = 0.1M;
}
});
@@ -169,7 +169,7 @@ namespace Home.Controllers
if (m.ProductId == 6||m.ProductId == 5){
m.Title = "9";
}
if (m.DayCount == 1||m.DayCount == 2 ){
if ((m.DayCount == 1||m.DayCount == 2) && m.Id != 1034&&m.Id != 1040 ){
m.Price = 0.1M;
}
});
@@ -704,8 +704,15 @@ namespace Home.Controllers
public async Task<IActionResult> TestIndex(int id)
{
var userId = this.Request.GetUserInfo().UserId;
var product = await m_ProductService.GetById(id);
var package = await m_ProductPackageService.Query(m => m.IsTest == 1 && m.ProductId == id).FirstOrDefaultAsync();
var product = new ProductEntity();
var package = new ProductPackageEntity();
if (id==1034||id==1040){
package = await m_ProductPackageService.Query(m => m.Id == id).FirstOrDefaultAsync();
product = await m_ProductService.GetById(package.ProductId);
} else {
product = await m_ProductService.GetById(id);
package = await m_ProductPackageService.Query(m => m.IsTest == 1 && m.ProductId == id).FirstOrDefaultAsync();
}
var restTimes = await m_ProductAccountService.GetRestTestCount(userId);
return View("Test", new PackageInfoResponse()
@@ -720,8 +727,15 @@ namespace Home.Controllers
[HttpGet, UserAuth]
public async Task<IActionResult> Test(int id)
{
var product = await m_ProductService.GetById(id);
var package = await m_ProductPackageService.Query(m => m.IsTest == 1 && m.ProductId == id).FirstOrDefaultAsync();
var product = new ProductEntity();
var package = new ProductPackageEntity();
if (id==1034||id==1040){
package = await m_ProductPackageService.Query(m => m.Id == id).FirstOrDefaultAsync();
product = await m_ProductService.GetById(package.ProductId);
} else {
product = await m_ProductService.GetById(id);
package = await m_ProductPackageService.Query(m => m.IsTest == 1 && m.ProductId == id).FirstOrDefaultAsync();
}
var restTimes = 0;
var userInfo = this.Request.GetUserInfo();
if (userInfo != null)
@@ -825,8 +839,53 @@ namespace Home.Controllers
}
ViewBag.accounts = accounts;
var id = productIds.First().Value;
//0 无状态 1尊享 2高级 3普通
var pro_type_flag = 0;
var pro_type_temp = 0;
if (productId == 14) {
accountList.ForEach(m => {
if (m.PackageId<1034) {
pro_type_flag = 1;
}
if (m.PackageId>1034&&m.PackageId<1040) {
pro_type_flag = 2;
}
if (m.PackageId>1040&&m.PackageId<1046) {
pro_type_flag = 3;
}
if (pro_type_temp==0){
pro_type_temp = pro_type_flag;
}
if (pro_type_temp!=pro_type_flag){
ViewBag.errorTip = "天天不同类型不能同时续费";
}
});
if (ViewBag.errorTip == "天天不同类型不能同时续费"){
return View(model);
}
}
var respList = await m_ProductService.GetOneProductWithPackage(id);
var resp = new ProductWithPackageResponse();
var return_list = new ProductWithPackageResponse();
return_list.Product = respList.Product;
var package_temp = new List<ProductPackageEntity>();
var userInfo = this.Request.GetUserInfo();
if (userInfo != null)
{
@@ -843,6 +902,8 @@ namespace Home.Controllers
respList.Packages.ForEach(m => {
if (discount != null)
{
dis_price = m.LinePrice * discount.discount / 100;
@@ -865,6 +926,20 @@ namespace Home.Controllers
if(m.Price<m.MinPrice){
m.Price = m.MinPrice;
}
if (m.ProductId == 14){
if (pro_type_temp ==1 && m.Id<1034) {
package_temp.Add(m);
}
if (pro_type_temp ==2 && m.Id>1034&&m.Id<1040) {
package_temp.Add(m);
}
if (pro_type_temp ==3 && m.Id>1040&&m.Id<1046) {
package_temp.Add(m);
}
}else {
package_temp.Add(m);
}
});
@@ -873,6 +948,8 @@ namespace Home.Controllers
var userPrices = await m_ProductUserPriceService.GetProductUserPrice(id, userInfo.UserId);
respList.Packages.ForEach(m =>
{
m.Title = "9.5";
if (m.ProductId == 1||m.ProductId == 2||m.ProductId == 13||m.ProductId == 17||m.ProductId == 14||m.ProductId == 19){
m.Title = "8";
@@ -888,12 +965,27 @@ namespace Home.Controllers
{
m.Price = userPrice.UserPrice;
}
if (m.ProductId == 14){
if (pro_type_temp ==1 && m.Id<1034) {
package_temp.Add(m);
}
if (pro_type_temp ==2 && m.Id>1034&&m.Id<1040) {
package_temp.Add(m);
}
if (pro_type_temp ==3 && m.Id>1040&&m.Id<1046) {
package_temp.Add(m);
}
}else {
package_temp.Add(m);
}
});
}
}
return View(respList);
return_list.Packages = package_temp;
return View(return_list);
}
[HttpGet,UserAuth]