认领与修改价格
This commit is contained in:
@@ -11,6 +11,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using UserService = Hncore.Pass.Vpn.Service.UserService;
|
||||
|
||||
namespace Hncore.Pass.Vpn.Controllers
|
||||
{
|
||||
@@ -19,12 +20,14 @@ namespace Hncore.Pass.Vpn.Controllers
|
||||
public class ProductController : HncoreControllerBase
|
||||
{
|
||||
private ProductService m_ProductService;
|
||||
private UserService m_UserService;
|
||||
private ProductPackageService m_ProductPackageService;
|
||||
private ProductUserPriceService m_ProductUserPriceService;
|
||||
public ProductController(ProductService _ProductServic, ProductPackageService _ProductPackageService, ProductUserPriceService m_ProductUserPriceService)
|
||||
public ProductController(UserService _UserService,ProductService _ProductServic, ProductPackageService _ProductPackageService, ProductUserPriceService m_ProductUserPriceService)
|
||||
{
|
||||
m_ProductService = _ProductServic;
|
||||
m_ProductPackageService = _ProductPackageService;
|
||||
m_UserService = _UserService;
|
||||
this.m_ProductUserPriceService = m_ProductUserPriceService;
|
||||
}
|
||||
|
||||
@@ -203,6 +206,10 @@ namespace Hncore.Pass.Vpn.Controllers
|
||||
{
|
||||
return Error("请设置会员价");
|
||||
}
|
||||
var userEntity = await m_UserService.Query(m => m.Id==userPriceEntity.UserId).FirstOrDefaultAsync();
|
||||
userEntity.discount_id = -1;
|
||||
await m_UserService.Update(userEntity);
|
||||
|
||||
userPriceEntity.Status = userPriceEntity.Status == 0 ? 1 : 0;
|
||||
await m_ProductUserPriceService.Update(userPriceEntity);
|
||||
return Success(userPriceEntity.Status);
|
||||
@@ -232,7 +239,9 @@ namespace Hncore.Pass.Vpn.Controllers
|
||||
public async Task<ApiResult> PutUserPrice([FromBody]PutUserPriceRequest request)
|
||||
{
|
||||
var userPriceEntity = await m_ProductUserPriceService.Query(m => m.PackageId == request.PackageId && m.UserId == request.UserId).FirstOrDefaultAsync();
|
||||
|
||||
var userEntity = await m_UserService.Query(m => m.Id==request.UserId).FirstOrDefaultAsync();
|
||||
userEntity.discount_id = -1;
|
||||
await m_UserService.Update(userEntity);
|
||||
var price = request.UserPrice;
|
||||
var packageEntity =await m_ProductPackageService.GetById(request.PackageId);
|
||||
// var product = await m_ProductService.GetById(packageEntity.ProductId);
|
||||
|
||||
Reference in New Issue
Block a user