This commit is contained in:
lwh 2023-10-13 17:37:44 +08:00
parent 2ea11afe9d
commit 1d01570f8f

View File

@ -17,6 +17,8 @@ using ARW.Repository.Business.Marketing.CouponManage.Coupons;
using Org.BouncyCastle.Crypto.Prng; using Org.BouncyCastle.Crypto.Prng;
using Aliyun.Acs.Core.Logging; using Aliyun.Acs.Core.Logging;
using ARW.Model.Dto.Api.Pay; using ARW.Model.Dto.Api.Pay;
using ARW.Repository.Business.Carts;
using ARW.Repository.Business.GoodsManager.Goodss;
namespace ARW.Service.Api.BusinessService.PaymentManage namespace ARW.Service.Api.BusinessService.PaymentManage
{ {
@ -29,17 +31,21 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
[AppService(ServiceType = typeof(IPayServiceApi), ServiceLifetime = LifeTime.Transient)] [AppService(ServiceType = typeof(IPayServiceApi), ServiceLifetime = LifeTime.Transient)]
public class PayServiceApi : BaseService<Payment>, IPayServiceApi public class PayServiceApi : BaseService<Payment>, IPayServiceApi
{ {
private readonly SenparcHttpClient _httpClient;
private readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly ShopRepository _ShopRepository; private readonly ShopRepository _ShopRepository;
private readonly GoodsRepository _GoodsRepository;
private readonly GoodsCategoryRepository _GoodsCategoryRepository; private readonly GoodsCategoryRepository _GoodsCategoryRepository;
private readonly CustomerRepository _CustomerRepository; private readonly CustomerRepository _CustomerRepository;
private readonly OrderRepository _OrderRepository; private readonly OrderRepository _OrderRepository;
private readonly PaymentRepository _PaymentRepository; private readonly PaymentRepository _PaymentRepository;
private readonly CouponRepository _CouponRepository; private readonly CouponRepository _CouponRepository;
private readonly SenparcHttpClient _httpClient; private readonly CartRepository _CartRepository;
private readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
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; this._ShopRepository = ShopRepository;
_GoodsCategoryRepository = goodsCategoryRepository; _GoodsCategoryRepository = goodsCategoryRepository;
@ -48,6 +54,7 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
_PaymentRepository = paymentRepository; _PaymentRepository = paymentRepository;
_CouponRepository = couponRepository; _CouponRepository = couponRepository;
_httpClient = httpClient; _httpClient = httpClient;
_GoodsRepository = goodsRepository;
} }
#region Api接口代码 #region Api接口代码
@ -72,6 +79,9 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
{ {
#region #region
/* 计算商品总价 */
/* 添加订单流水 */ /* 添加订单流水 */
var paymentGuid = await AddPayment(parm, orderNo); var paymentGuid = await AddPayment(parm, orderNo);
/* 添加业务订单 */ /* 添加业务订单 */
@ -98,6 +108,28 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
#region #region
public async Task<decimal> 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;
}
/// <summary> /// <summary>
/// 添加订单流水 /// 添加订单流水
/// </summary> /// </summary>