diff --git a/ARW.Service/Api/BusinessService/PayManage/PayServiceApi.cs b/ARW.Service/Api/BusinessService/PayManage/PayServiceApi.cs index c4995bb..f490d57 100644 --- a/ARW.Service/Api/BusinessService/PayManage/PayServiceApi.cs +++ b/ARW.Service/Api/BusinessService/PayManage/PayServiceApi.cs @@ -17,6 +17,8 @@ using ARW.Repository.Business.Marketing.CouponManage.Coupons; using Org.BouncyCastle.Crypto.Prng; using Aliyun.Acs.Core.Logging; using ARW.Model.Dto.Api.Pay; +using ARW.Repository.Business.Carts; +using ARW.Repository.Business.GoodsManager.Goodss; namespace ARW.Service.Api.BusinessService.PaymentManage { @@ -29,17 +31,21 @@ namespace ARW.Service.Api.BusinessService.PaymentManage [AppService(ServiceType = typeof(IPayServiceApi), ServiceLifetime = LifeTime.Transient)] public class PayServiceApi : BaseService, IPayServiceApi { + private readonly SenparcHttpClient _httpClient; + private readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); + private readonly ShopRepository _ShopRepository; + private readonly GoodsRepository _GoodsRepository; private readonly GoodsCategoryRepository _GoodsCategoryRepository; private readonly CustomerRepository _CustomerRepository; private readonly OrderRepository _OrderRepository; private readonly PaymentRepository _PaymentRepository; private readonly CouponRepository _CouponRepository; - private readonly SenparcHttpClient _httpClient; - private readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); + private readonly CartRepository _CartRepository; - public PayServiceApi(ShopRepository ShopRepository, GoodsCategoryRepository goodsCategoryRepository, CustomerRepository customerRepository, OrderRepository orderRepository, PaymentRepository paymentRepository, CouponRepository couponRepository, SenparcHttpClient httpClient) + + public PayServiceApi(ShopRepository ShopRepository, GoodsCategoryRepository goodsCategoryRepository, CustomerRepository customerRepository, OrderRepository orderRepository, PaymentRepository paymentRepository, CouponRepository couponRepository, SenparcHttpClient httpClient, GoodsRepository goodsRepository) { this._ShopRepository = ShopRepository; _GoodsCategoryRepository = goodsCategoryRepository; @@ -48,6 +54,7 @@ namespace ARW.Service.Api.BusinessService.PaymentManage _PaymentRepository = paymentRepository; _CouponRepository = couponRepository; _httpClient = httpClient; + _GoodsRepository = goodsRepository; } #region Api接口代码 @@ -72,6 +79,9 @@ namespace ARW.Service.Api.BusinessService.PaymentManage { #region 业务处理 + /* 计算商品总价 */ + + /* 添加订单流水 */ var paymentGuid = await AddPayment(parm, orderNo); /* 添加业务订单 */ @@ -98,6 +108,28 @@ namespace ARW.Service.Api.BusinessService.PaymentManage #region 业务方法调用 + + public async Task CalculatePrice(CommitPayDtoApi parm) + { + decimal price = 0; + + foreach (var item in parm.GoodsRequestList) + { + var cart = await _CartRepository.GetFirstAsync(s => s.CartId == item.CartId); + var goods = await _GoodsRepository.GetFirstAsync(s => s.GoodsGuid == cart.GoodsGuid); + // 是否有规格 + if(cart.GoodsSkuId != 0) + { + + } + + } + + + return price; + } + + /// /// 添加订单流水 ///