diff --git a/Host/Controllers/ProductController.cs b/Host/Controllers/ProductController.cs index 0a259a6..aefbaad 100644 --- a/Host/Controllers/ProductController.cs +++ b/Host/Controllers/ProductController.cs @@ -45,8 +45,10 @@ namespace Home.Controllers WxAppUserService m_WxAppUserService; UserService m_UserService; ProductUserPriceService m_ProductUserPriceService; + ProductPriceSchemeService m_ProductPriceSchemeService; public productController(ProductService _ProductService , ProductOrderService _ProductOrderService + , ProductPriceSchemeService _ProductPriceSchemeService , ProductPackageService _ProductPackageService , WxPayClient _WxPayClient ,ProductAccountService _ProductAccountService @@ -57,6 +59,7 @@ namespace Home.Controllers { m_ProductService = _ProductService; m_ProductOrderService = _ProductOrderService; + m_ProductPriceSchemeService = _ProductPriceSchemeService; m_ProductPackageService = _ProductPackageService; m_Configuration = _Configuration; m_WxPayClient = _WxPayClient; @@ -86,26 +89,59 @@ namespace Home.Controllers //从user表获取用户信息 var user_Info = await m_UserService.GetById(userInfo.UserId); var ProductAccountCount = user_Info.ProductAccountCount; - var userPrices = await m_ProductUserPriceService.GetProductUserPrice(userInfo.UserId); - - foreach(var product in respList) - { - product.Packages.ForEach(m => { - var userPrice = userPrices.FirstOrDefault(p => p.PackageId == m.Id && p.ProductId == m.ProductId); - if (userPrice != null && userPrice.UserPrice > 0) - { - m.Price = userPrice.UserPrice; - } - if (ProductAccountCount == 0 && m.DayCount == 1){ - m.Price = 0.1M; - } - }); - } + if(user_Info.agent_id == 0||(user_Info.agent_id != 0 && user_Info.discount_id != 0)){ + //根据折扣设置价格 + + var discount = await m_ProductPriceSchemeService.GetById(user_Info.discount_id); + var dis_price = 1000000.0M; + foreach(var product in respList) + { + product.Packages.ForEach(m => { + + if (discount != null) + { + dis_price = m.LinePrice * discount.discount / 100; + } + if(dis_price { + m.Title = "9"; + + var userPrice = userPrices.FirstOrDefault(p => p.PackageId == m.Id && p.ProductId == m.ProductId); + if (userPrice != null && userPrice.UserPrice > 0) + { + m.Price = userPrice.UserPrice; + } + if (ProductAccountCount == 0 && m.DayCount == 1){ + m.Price = 0.1M; + } + }); + } + } } else { foreach(var product in respList) { product.Packages.ForEach(m => { + m.Title = "9"; if ( m.DayCount == 1 ){ m.Price = 0.1M; } @@ -676,14 +712,32 @@ namespace Home.Controllers var user_Info = await m_UserService.GetById(userId); var ProductAccountCount = user_Info.ProductAccountCount; - var userPrice = await m_ProductUserPriceService.GetPackageUserPrice(package.Id, userId); - if (userPrice != null && userPrice.UserPrice > 0) - { - package.Price = userPrice.UserPrice; + var dis_price = 1000000M; + if(user_Info.agent_id == 0||(user_Info.agent_id != 0 && user_Info.discount_id != 0)){ + //根据折扣设置价格 + var discount = await m_ProductPriceSchemeService.GetById(user_Info.discount_id); + if (discount != null) + { + dis_price = package.LinePrice * discount.discount / 100; + } + } else { + //根据会员价 + var userPrice = await m_ProductUserPriceService.GetPackageUserPrice(package.Id, userId); + if (userPrice != null && userPrice.UserPrice > 0) + { + dis_price = userPrice.UserPrice; + } } + if(dis_price - { - var userPrice = userPrices.FirstOrDefault(p => p.PackageId == m.Id); - if (userPrice != null && userPrice.UserPrice > 0) + + + //从user表获取用户信息 + var user_Info = await m_UserService.GetById(userInfo.UserId); + + if(user_Info.agent_id == 0||(user_Info.agent_id != 0 && user_Info.discount_id != 0)){ + //根据折扣设置价格 + + var discount = await m_ProductPriceSchemeService.GetById(user_Info.discount_id); + var dis_price = 1000000.0M; + + respList.Packages.ForEach(m => { + + if (discount != null) + { + dis_price = m.LinePrice * discount.discount / 100; + } + if(dis_price { - m.Price = userPrice.UserPrice; - } - }); + m.Title = "9"; + var userPrice = userPrices.FirstOrDefault(p => p.PackageId == m.Id); + if (userPrice != null && userPrice.UserPrice > 0) + { + m.Price = userPrice.UserPrice; + } + }); + } + + } return View(respList); } @@ -753,11 +842,32 @@ namespace Home.Controllers var accountEntity = await m_ProductAccountService.GetProductAccountInfo(package.ProductId, account); var userId = this.Request.GetUserInfo().UserId; - var userPrice = await m_ProductUserPriceService.GetPackageUserPrice(packageId, userId); - if (userPrice != null && userPrice.UserPrice > 0) - { - package.Price = userPrice.UserPrice; + + var user_Info = await m_UserService.GetById(userId); + var dis_price = 1000000M; + if(user_Info.agent_id == 0||(user_Info.agent_id != 0 && user_Info.discount_id != 0)){ + //根据折扣设置价格 + var discount = await m_ProductPriceSchemeService.GetById(user_Info.discount_id); + if (discount != null) + { + dis_price = package.LinePrice * discount.discount / 100; + } + } else { + //根据会员价 + var userPrice = await m_ProductUserPriceService.GetPackageUserPrice(packageId, userId); + if (userPrice != null && userPrice.UserPrice > 0) + { + dis_price = userPrice.UserPrice; + } } + if(dis_price

公告

X -

老鹰IP已恢复运营!已更新最新的IP池,产品稳定性也做了大幅度的升级!

-

老鹰IP已加入8折助攻计划,月卡仅需54元,量大价更低!

+

聚IP官网已更新为自动更改折扣优惠价

+

总消费超过200,自动升级为白银9折

+

总消费超过500,自动升级为黄金8折

+

...

+

几乎所有用户在此次自动更新后优惠都变的更大了,可能出现个别用户价格比之前的高,可联系客服帮您更改手动更改折扣。

+

如果您对价格有疑问也可联系客服帮您更改折扣!

+

如果您有更大用量或销量,可咨询客服获取更低的折扣!

1.动态IP一毛钱一天,每用户限一次。

2.复工季,聚IP助力开工,全部产品所有套餐8折狂欢价,月卡低至50多,量大价更低!

-

3.月卡送10天,双月卡送一个月,部分产品参加。

-

4.新上老鹰IP,蘑菇IP,西瓜IP,新上安卓APP。

diff --git a/Host/Views.Mobile/Product/Index.cshtml b/Host/Views.Mobile/Product/Index.cshtml index 589cb60..e79e3be 100644 --- a/Host/Views.Mobile/Product/Index.cshtml +++ b/Host/Views.Mobile/Product/Index.cshtml @@ -38,7 +38,7 @@

欢迎淘宝下单,每次下单都会随机赠送优惠券,最低54元
优惠券支持所有套餐!点击去淘宝店铺付款 

-

需求五个以上

+

总消费满200元,即可享受超值优惠价

联系客服设置优惠价

>>>联系客服<<<

@@ -245,7 +245,11 @@
-

@package.Name 九折

+ @if(package.Title != ""){ +

@package.Name @package.Title 折

+ } else { +

@package.Name 9 折

+ }

@(Math.Round(package.Price/package.DayCount,2))元/天

@package.Profile

@@ -262,7 +266,11 @@
-

需求五个以上

+

总消费满200元,即可享受超值优惠价

联系客服设置优惠价

>>>联系客服<<<

diff --git a/Host/Views/Home/Index.cshtml b/Host/Views/Home/Index.cshtml index 45bd3a1..ded4e8d 100644 --- a/Host/Views/Home/Index.cshtml +++ b/Host/Views/Home/Index.cshtml @@ -678,12 +678,15 @@

公告

X -

老鹰IP已恢复运营!已更新最新的IP池,产品稳定性也做了大幅度的升级!

-

老鹰IP已加入8折助攻计划,月卡仅需54元,量大价更低!

+

聚IP官网已更新为自动更改折扣优惠价

+

总消费超过200,自动升级为白银9折

+

总消费超过500,自动升级为黄金8折

+

...

+

几乎所有用户在此次自动更新后优惠都变的更大了,可能出现个别用户价格比之前的高,可联系客服帮您更改手动更改折扣。

+

如果您对价格有疑问也可联系客服帮您更改折扣!

+

如果您有更大用量或销量,可咨询客服获取更低的折扣!

1.动态IP一毛钱一天,每用户限一次。

2.复工季,聚IP助力开工,全部产品所有套餐8折狂欢价,月卡低至50多,量大价更低!

-

3.月卡送10天,双月卡送一个月,部分产品参加。

-

4.新上老鹰IP,蘑菇IP,西瓜IP,新上安卓APP。

diff --git a/Host/Views/Product/Index.cshtml b/Host/Views/Product/Index.cshtml index 4940576..d98c6f6 100644 --- a/Host/Views/Product/Index.cshtml +++ b/Host/Views/Product/Index.cshtml @@ -173,7 +173,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "八折+送十天"; + content: "8 折+送十天"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -203,7 +203,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "七折+送一月"; + content: "7 折+送一月"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -262,7 +262,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "八折+送一个月"; + content: "8 折+送一个月"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -291,7 +291,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "九折+送七天"; + content: "9 折+送七天"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -320,7 +320,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "八折+送一个月"; + content: "8 折+送一个月"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -349,7 +349,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "八折+送两个月"; + content: "8 折+送两个月"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -379,7 +379,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "八折+送七天"; + content: "8 折+送七天"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -409,7 +409,8 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "九折"; + content: "9折"; + @* content: "@Model[0].Packages[0].Title 折"; *@ box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -437,7 +438,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "八折"; + content: "8 折"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -490,7 +491,7 @@

-

需求五个以上

+

总消费满200元,即可享受超值优惠价

联系客服设置优惠价

>>>联系客服<<<

@@ -627,9 +628,42 @@ @foreach (var package in item.Packages.Where(m => m.IsTest == 0 && m.Status == 1).OrderBy(m => m.TenantId)) { + + + @if(package.Price == 0.1M){
+

@package.Price

原价:@package.LinePrice

@@ -643,7 +677,7 @@ } else if(package.Id == 1018||package.Id==1009||package.Id==1019){ -
+

@package.Price

原价:@package.LinePrice

@@ -655,37 +689,10 @@
} - @* else if(package.Id==1020){ - -
- -

@package.Price

-

原价:@package.LinePrice

-

@(Math.Round(package.Price/package.DayCount,2))元/天

-
-

@package.Name

-

@package.Profile

-
- -
- } *@ - @* else if(package.Id==1021){ - -
- -

@package.Price

-

原价:@package.LinePrice

-

@(Math.Round(package.Price/package.DayCount,2))元/天

-
-

@package.Name

-

@package.Profile

-
- -
- } *@ else if(package.Id == 88||package.Id == 101||package.Id == 103){ -
+
+

@package.Price

原价:@package.LinePrice

@@ -697,24 +704,10 @@
} - @* else if(package.Id == 34){ - -
- -

@package.Price

-

原价:@package.LinePrice

-

@(Math.Round(package.Price/package.DayCount,2))元/天

-
-

@package.Name

-

@package.Profile

-
- -
- } *@ else if(package.Id==105){ -
- +
+

@package.Price

原价:@package.LinePrice

@(Math.Round(package.Price/package.DayCount,2))元/天

@@ -726,8 +719,8 @@
} else if(package.Id == 100||package.Id == 102) { -
- +
+

@package.Price

原价:@package.LinePrice

@(Math.Round(package.Price/package.DayCount,2))元/天

@@ -740,8 +733,8 @@ } else if(package.Id == 1007||package.Id == 1008||package.Id == 104) { -
- +
+

@package.Price

原价:@package.LinePrice

@(Math.Round(package.Price/package.DayCount,2))元/天

@@ -753,37 +746,12 @@
} - @* else if(package.Id == 63||package.Id == 64||package.Id == 65||package.Id == 66||package.Id == 67||package.Id == 13||package.Id == 14||package.Id == 15||package.Id == 16) { -
- -

@package.Price

-

原价:@package.LinePrice

-

@(Math.Round(package.Price/package.DayCount,2))元/天

-
-

@package.Name

-

@package.Profile

-
- -
- - } *@ - @* else if(package.Id == 71||package.Id == 100||package.Id == 102) { -
- -

@package.Price

-

原价:@package.LinePrice

-

@(Math.Round(package.Price/package.DayCount,2))元/天

-
-

@package.Name

-

@package.Profile

-
- -
- - } *@ else if(package.Id == 1||package.Id == 1002||package.Id == 4||package.Id == 7||package.Id == 12||package.Id == 17||package.Id == 22||package.Id == 27||package.Id == 32||package.Id == 37||package.Id == 42||package.Id == 62||package.Id == 69||package.Id == 73||package.Id == 80) { -
+ + +
+

@package.Price

原价:@package.LinePrice

@@ -798,7 +766,8 @@ } else { -
+
+ @if((package.Id == 64||package.Id == 1004)&&package.Price<60){

60.00

@@ -820,7 +789,7 @@
-

温馨提示:需求5个以上,可以联系客服设置优惠价

+

总消费满200元,即可享受超值优惠价

开通后有任何问题可无理由退款,并支持自助提现

diff --git a/Host/Views/Product/ReBuyIndex.cshtml b/Host/Views/Product/ReBuyIndex.cshtml index e9728d5..188d0be 100644 --- a/Host/Views/Product/ReBuyIndex.cshtml +++ b/Host/Views/Product/ReBuyIndex.cshtml @@ -65,7 +65,7 @@ border-left-color: transparent; border-bottom-color: transparent; } - + .packageitem10{ position: relative; } @@ -81,7 +81,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "免费送十天"; + content: "8 折+送十天"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -111,7 +111,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "七折+送一月"; + content: "7 折+送一月"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -126,6 +126,64 @@ } + .packageitem1{ + position: relative; + } + .packageitem1::before { + position: absolute; + top: 0.3rem; + left: -0.5rem; + z-index: 1; + padding-right: 0.625rem; + font-weight: bold; + line-height: 0px; + color: #FF0033; + height: 0px; + border: 1.0rem solid #FF9933; + border-right-color: transparent; + content: "首单0.1元"; + box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; + } + + .packageitem1::after { + content: ""; + position: absolute; + top: 2.1875rem; + left: -0.5rem; + border: 0.25rem solid #f64e3d; + border-left-color: transparent; + border-bottom-color: transparent; + } + + .packageitem81{ + position: relative; + } + .packageitem81::before { + position: absolute; + top: 0.3rem; + left: -0.5rem; + z-index: 1; + padding-right: 0.625rem; + font-weight: bold; + line-height: 0px; + color: white; + height: 0px; + border: 1.2rem solid #f64e3d; + border-right-color: transparent; + content: "8 折+送一个月"; + box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; + } + + .packageitem81::after { + content: ""; + position: absolute; + top: 2.1875rem; + left: -0.5rem; + border: 0.25rem solid #f64e3d; + border-left-color: transparent; + border-bottom-color: transparent; + } + .packageitem19{ position: relative; } @@ -141,7 +199,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "免费送十天"; + content: "9 折+送七天"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -155,65 +213,7 @@ border-bottom-color: transparent; } - .packageitem3{ - position: relative; - } - - .packageitem71{ - position: relative; - } - .packageitem71::before { - position: absolute; - top: 0.3rem; - left: -0.5rem; - z-index: 1; - padding-right: 0.625rem; - font-weight: bold; - line-height: 0px; - color: white; - height: 0px; - border: 1.2rem solid #f64e3d; - border-right-color: transparent; - content: "九折"; - box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; - } - - .packageitem71::after { - content: ""; - position: absolute; - top: 2.1875rem; - left: -0.5rem; - border: 0.25rem solid #f64e3d; - border-left-color: transparent; - border-bottom-color: transparent; - } - .packageitem3::before { - position: absolute; - top: 0.3rem; - left: -0.5rem; - z-index: 1; - padding-right: 0.625rem; - font-weight: bold; - line-height: 0px; - color: white; - height: 0px; - border: 1.2rem solid #f64e3d; - border-right-color: transparent; - content: "九折+送七天"; - box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; - } - - .packageitem3::after { - content: ""; - position: absolute; - top: 2.1875rem; - left: -0.5rem; - border: 0.25rem solid #f64e3d; - border-left-color: transparent; - border-bottom-color: transparent; - } - - .packageitem91{ + .packageitem91{ position: relative; } .packageitem91::before { @@ -228,7 +228,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "九折+送一个月"; + content: "8 折+送一个月"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -242,7 +242,96 @@ border-bottom-color: transparent; } - .packageitem4{ + .packageitem92{ + position: relative; + } + .packageitem92::before { + position: absolute; + top: 0.3rem; + left: -0.5rem; + z-index: 1; + padding-right: 0.625rem; + font-weight: bold; + line-height: 0px; + color: white; + height: 0px; + border: 1.2rem solid #f64e3d; + border-right-color: transparent; + content: "8 折+送两个月"; + box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; + } + + .packageitem92.contentNew::after { + content: ""; + position: absolute; + top: 2.1875rem; + left: -0.5rem; + border: 0.25rem solid #f64e3d; + border-left-color: transparent; + border-bottom-color: transparent; + } + + + .packageitem8-1{ + position: relative; + } + .packageitem8-1::before { + position: absolute; + top: 0.3rem; + left: -0.5rem; + z-index: 1; + padding-right: 0.625rem; + font-weight: bold; + line-height: 0px; + color: white; + height: 0px; + border: 1.2rem solid #f64e3d; + border-right-color: transparent; + content: "8 折+送七天"; + box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; + } + + .packageitem8-1.contentNew::after { + content: ""; + position: absolute; + top: 2.1875rem; + left: -0.5rem; + border: 0.25rem solid #f64e3d; + border-left-color: transparent; + border-bottom-color: transparent; + } + + + .packageitem71{ + position: relative; + } + .packageitem71::before { + position: absolute; + top: 0.3rem; + left: -0.5rem; + z-index: 1; + padding-right: 0.625rem; + font-weight: bold; + line-height: 0px; + color: white; + height: 0px; + border: 1.2rem solid #f64e3d; + border-right-color: transparent; + content: "9折"; + @* content: "@Model[0].Packages[0].Title 折"; *@ + box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; + } + + .packageitem71::after { + content: ""; + position: absolute; + top: 2.1875rem; + left: -0.5rem; + border: 0.25rem solid #f64e3d; + border-left-color: transparent; + border-bottom-color: transparent; + } + .packageitem4{ position: relative; } .packageitem4::before { @@ -257,7 +346,7 @@ height: 0px; border: 1.2rem solid #f64e3d; border-right-color: transparent; - content: "八折"; + content: "8 折"; box-shadow: 0px 0.3125rem 0.3125rem -0.3125rem #000; } @@ -271,6 +360,7 @@ border-bottom-color: transparent; } + @*
@@ -280,7 +370,7 @@
-

需求五个以上

+

总消费满200元,即可享受超值优惠价

联系客服设置优惠价

>>>联系客服<<<

@@ -313,7 +403,7 @@
-

一毛钱活动:不分新老用户都可参加!

+

一毛钱活动:不分新老用户都可参加!

@* @if(defaultProduct.Id == 5){

月卡赠送10天,双月卡赠送1个月,新开和续费都有赠送,活动截止时间2020年11月25日。
(同一个IP账号仅限一次,每位会员不限账号数量,您可购买多个IP账号都有赠送)

} *@ @@ -357,10 +447,40 @@
@foreach (var package in Model.Packages.Where(m => m.IsTest == 0 && m.Status == 1&& m.Id != 1009&& m.Id != 1018&& m.Id != 1019).OrderBy(m => m.TenantId)) { + @if(package.Id == 88||package.Id == 101||package.Id == 103){ -
- +
+

@package.Price

原价:@package.LinePrice

@(Math.Round(package.Price/package.DayCount,2))元/天

@@ -374,7 +494,8 @@ else if(package.Id == 1018){ -
+
+

@package.Price

原价:@package.LinePrice

@@ -402,7 +523,8 @@ } *@ else if(package.Id==105){ -
+
+

@package.Price

原价:@package.LinePrice

@@ -443,8 +565,8 @@ } *@ else if(package.Id == 1||package.Id == 1002||package.Id == 1003||package.Id == 4||package.Id == 7||package.Id == 12||package.Id == 17||package.Id == 22||package.Id == 27||package.Id == 32||package.Id == 37||package.Id == 42||package.Id == 62||package.Id == 69||package.Id == 73||package.Id == 80) { -
- +
+

@package.Price

原价:@package.LinePrice

@(Math.Round(package.Price/package.DayCount,2))元/天

@@ -457,8 +579,8 @@ } else if(package.Id != 88) { -
- +
+ @if((package.Id == 64||package.Id == 1004)&&package.Price<60){

60.00

} else { @@ -488,7 +610,7 @@
-

温馨提示:需求5个以上,可以联系客服设置优惠价

+

总消费满200元,即可享受超值优惠价

开通后有任何问题可无理由退款,并支持自助提现

diff --git a/Services/Hncore.Pass.Vpn/Controllers/ProductSchemeController.cs b/Services/Hncore.Pass.Vpn/Controllers/ProductSchemeController.cs index 62be0c5..01a1059 100644 --- a/Services/Hncore.Pass.Vpn/Controllers/ProductSchemeController.cs +++ b/Services/Hncore.Pass.Vpn/Controllers/ProductSchemeController.cs @@ -60,6 +60,7 @@ namespace Hncore.Pass.Vpn.Controllers var entity = await m_PriceSchemeService.GetById(request.Id); entity.Name = request.Name; entity.Remark = request.Remark; + entity.discount = request.discount; entity.UpdateTime = DateTime.Now; await m_PriceSchemeService.Update(entity); return Success(); diff --git a/Services/Hncore.Pass.Vpn/Domain/AgentUserEntity.cs b/Services/Hncore.Pass.Vpn/Domain/AgentUserEntity.cs index 01f4e26..e7afef8 100644 --- a/Services/Hncore.Pass.Vpn/Domain/AgentUserEntity.cs +++ b/Services/Hncore.Pass.Vpn/Domain/AgentUserEntity.cs @@ -16,6 +16,7 @@ namespace Hncore.Pass.Vpn.Domain public string username { get; set; } public string realname { get; set; } + public int discount_id { get; set; } public string phone { get; set; } diff --git a/Services/Hncore.Pass.Vpn/Domain/ProductPriceSchemeEntity.cs b/Services/Hncore.Pass.Vpn/Domain/ProductPriceSchemeEntity.cs index d688138..72276be 100644 --- a/Services/Hncore.Pass.Vpn/Domain/ProductPriceSchemeEntity.cs +++ b/Services/Hncore.Pass.Vpn/Domain/ProductPriceSchemeEntity.cs @@ -8,6 +8,7 @@ namespace Hncore.Pass.Vpn.Domain { public string Name { get; set; } public string Remark { get; set; } + public int discount { get; set; } } } diff --git a/Services/Hncore.Pass.Vpn/Domain/UserEntity.cs b/Services/Hncore.Pass.Vpn/Domain/UserEntity.cs index 15cf00f..9a48ed1 100644 --- a/Services/Hncore.Pass.Vpn/Domain/UserEntity.cs +++ b/Services/Hncore.Pass.Vpn/Domain/UserEntity.cs @@ -19,6 +19,8 @@ namespace Hncore.Pass.Vpn.Domain /// 登录密码[20] /// public string Password { get; set; } + public int discount_id { get; set; } + /// /// 微信昵称 @@ -51,6 +53,7 @@ namespace Hncore.Pass.Vpn.Domain /// 是否主管理员权限 /// public DateTime? LastLoginDate { get; set; } = DateTime.Now; + public string pay_time { get; set; } public int Sex { get; set; } diff --git a/Services/Hncore.Pass.Vpn/Service/ProductOrderService.cs b/Services/Hncore.Pass.Vpn/Service/ProductOrderService.cs index c326849..7cc302a 100644 --- a/Services/Hncore.Pass.Vpn/Service/ProductOrderService.cs +++ b/Services/Hncore.Pass.Vpn/Service/ProductOrderService.cs @@ -39,9 +39,11 @@ namespace Hncore.Pass.Vpn.Service AgentUserService m_AgentUserService; AgentScoreService m_AgentScoreService; AgentPriceService m_AgentPriceService; + ProductPriceSchemeService m_ProductPriceSchemeService; public ProductOrderService(CourseContext dbContext , AgentUserService _AgentUserService , AgentScoreService _AgentScoreService + , ProductPriceSchemeService _ProductPriceSchemeService , AgentPriceService _AgentPriceService , ProductService _ProductService , ProductPackageService _ProductPackageService @@ -56,6 +58,7 @@ namespace Hncore.Pass.Vpn.Service { m_DbContext = dbContext; m_AgentUserService = _AgentUserService; + m_ProductPriceSchemeService = _ProductPriceSchemeService; m_AgentScoreService = _AgentScoreService; m_AgentPriceService = _AgentPriceService; m_ProductService = _ProductService; @@ -258,12 +261,34 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel, var is_user_price = true; var price = packageEntity.Price; - var userPrice = await this.m_ProductUserPriceService.Query(true).FirstOrDefaultAsync(m => m.UserId == userId && m.PackageId == packageEntity.Id && m.Status == 1); - if (userPrice != null && userPrice.UserPrice > 0) - { - price = userPrice.UserPrice; - is_user_price = false; + + var dis_price = 1000000M; + + if(userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)){ + //根据折扣设置价格 + var discount = await m_ProductPriceSchemeService.GetById(userEntity.discount_id); + if (discount != null) + { + dis_price = packageEntity.LinePrice * discount.discount / 100; + is_user_price = false; + } + } else { + //根据会员价 + var userPrice = await this.m_ProductUserPriceService.Query(true).FirstOrDefaultAsync(m => m.UserId == userId && m.PackageId == packageEntity.Id && m.Status == 1); + if (userPrice != null && userPrice.UserPrice > 0) + { + dis_price = userPrice.UserPrice; + is_user_price = false; + } } + if(dis_price m.id == order.agent_id).FirstOrDefaultAsync(); - var agentPriceEntity = await m_AgentPriceService.Query(m => m.agent_id == order.agent_id && m.package_id == order.PackageId).FirstOrDefaultAsync(); - var score_money = order.PaymentAmount - order.ConnectCount * order.AccountCount * agentPriceEntity.price; + + //根据折扣设置价格 + var score_money = 0.00M; + if(userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)){ + //获取代理折扣 + var discount = await m_ProductPriceSchemeService.GetById(agentEntity.discount_id); + var packageEntity = await m_ProductPackageService.GetById(order.PackageId); + var price = packageEntity.LinePrice * discount.discount / 100; + score_money = order.PaymentAmount - order.ConnectCount * order.AccountCount * price; + } else { + var agentPriceEntity = await m_AgentPriceService.Query(m => m.agent_id == order.agent_id && m.package_id == order.PackageId).FirstOrDefaultAsync(); + score_money = order.PaymentAmount - order.ConnectCount * order.AccountCount * agentPriceEntity.price; + } + var agnetScoreEntity = new AgentScoreEntity() { @@ -764,6 +803,26 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel, await m_AgentUserService.Update(agentEntity); } + userEntity.pay_time = DateTime.Now.ToString(); + userEntity.ConsumeAmount += order.PaymentAmount; + + //折扣设置 + var user_discount_id = userEntity.discount_id; + if (userEntity.ConsumeAmount>=200 && userEntity.ConsumeAmount<500){ + userEntity.discount_id = 1; + } else if(userEntity.ConsumeAmount>=500 && userEntity.ConsumeAmount<1500) { + userEntity.discount_id = 2; + } else if(userEntity.ConsumeAmount>=1500 && userEntity.ConsumeAmount<3000) { + userEntity.discount_id = 4; + } else if(userEntity.ConsumeAmount>=3000 && userEntity.ConsumeAmount<6000) { + userEntity.discount_id = 5; + } else if(userEntity.ConsumeAmount>=6000) { + userEntity.discount_id = 6; + } + if(userEntity.discount_id !=0 && userEntity.discount_id>user_discount_id && userEntity.agent_id!=0){ + await m_UserService.Update(userEntity); + } + } @@ -894,15 +953,35 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel, } var product = await this.m_ProductService.GetById(pacageInfo.ProductId); - var userPrice = await m_ProductUserPriceService.GetPackageUserPrice(pacageInfo.Id, userId); + //折扣 + var refundDayPrice = 10.00M; + var userEntity = await m_UserService.GetById(userId); + if(userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)){ + //获取代理折扣 + var discount = await m_ProductPriceSchemeService.GetById(userEntity.discount_id); + refundDayPrice = (product.RefundDayPrice * discount.discount / 100).ToDecimal(); + } else { + var userPrice = await m_ProductUserPriceService.GetPackageUserPrice(pacageInfo.Id, userId); - var refundDayPrice = userPrice != null && userPrice.RefundDayPrice > 0 ? userPrice.RefundDayPrice : product.RefundDayPrice; + refundDayPrice = (userPrice != null && userPrice.RefundDayPrice > 0 ? userPrice.RefundDayPrice : product.RefundDayPrice).ToDecimal(); + } + + Console.WriteLine("====================================================="); + Console.WriteLine(refundDayPrice); + Console.WriteLine("====================================================="); + + var lastOrder = await GetLastOrderByAccount(account); var useDay = (int)Math.Ceiling((DateTime.Now - lastOrder.UpdateTime).TotalDays); - var refundAmount = lastOrder.PaymentAmount / lastOrder.AccountCount - useDay * refundDayPrice.Value * accountInfo.ConnectCount; + 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, @@ -958,15 +1037,25 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel, if(order.agent_id != 0 ){ + var agentEntity = await m_AgentUserService.Query(m => m.id == order.agent_id).FirstOrDefaultAsync(); - var agentPriceEntity = await m_AgentPriceService.Query(m => m.agent_id == order.agent_id && m.package_id == order.PackageId).FirstOrDefaultAsync(); var agentScoreEntity = await m_AgentScoreService.Query(m => m.agent_id == order.agent_id && m.order_id == lastOrder.Id).FirstOrDefaultAsync(); var deduct_money = agentScoreEntity.score_value / lastOrder.AccountCount; // - //使用天数 回补佣金 - var re_money = useDay * (refundDayPrice.Value - agentPriceEntity.refund) * accountInfo.ConnectCount; + + var re_money = 0.00M; + if(userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)){ + //获取代理折扣 + var discount = await m_ProductPriceSchemeService.GetById(agentEntity.discount_id); + re_money = useDay * (refundDayPrice - (product.RefundDayPrice).ToDecimal() * discount.discount / 100) * accountInfo.ConnectCount; + } else { + var agentPriceEntity = await m_AgentPriceService.Query(m => m.agent_id == order.agent_id && m.package_id == order.PackageId).FirstOrDefaultAsync(); + //使用天数 回补佣金 + re_money = useDay * (refundDayPrice - agentPriceEntity.refund) * accountInfo.ConnectCount; + } + //佣金 var score_money = agentEntity.account - deduct_money + re_money; @@ -1017,13 +1106,24 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel, } var product = await this.m_ProductService.GetById(pacageInfo.ProductId); - var userPrice = await m_ProductUserPriceService.GetPackageUserPrice(pacageInfo.Id, userId); - var refundDayPrice = userPrice == null ? product.RefundDayPrice : userPrice.RefundDayPrice; + + //折扣 + var refundDayPrice = 10.00M; + var userEntity = await m_UserService.GetById(userId); + if(userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)){ + //获取代理折扣 + var discount = await m_ProductPriceSchemeService.GetById(userEntity.discount_id); + refundDayPrice = (product.RefundDayPrice * discount.discount / 100).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 useDay = (int)Math.Ceiling((DateTime.Now - lastOrder.UpdateTime).TotalDays); - var RefundAmount = lastOrder.PaymentAmount / lastOrder.AccountCount - useDay * refundDayPrice.Value * accountInfo.ConnectCount; + var RefundAmount = lastOrder.PaymentAmount / lastOrder.AccountCount - useDay * refundDayPrice * accountInfo.ConnectCount; RefundAmount = RefundAmount <= 0 ? 0 : RefundAmount; var time = (lastOrder.EndTime - DateTime.Now).Value;