public void ConfirmPay(HttpContext context) { string text = context.Request["id"]; if (string.IsNullOrWhiteSpace(text)) { throw new HidistroAshxException("错误的编号"); } OrderInfo orderInfo = new OrderDao().GetOrderInfo(text); if (orderInfo == null) { throw new HidistroAshxException("错误的编号"); } if (!orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { throw new HidistroAshxException("权限不足"); } PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankrequest"); if (paymentMode != null) { orderInfo.Gateway = paymentMode.Gateway; orderInfo.PaymentType = paymentMode.Name; orderInfo.PaymentTypeId = paymentMode.ModeId; } else { orderInfo.Gateway = "hishop.plugins.payment.bankrequest"; orderInfo.PaymentType = "线下支付"; orderInfo.PaymentTypeId = 0; } int num = 0; int num2 = 0; int num3 = 0; if (orderInfo.CountDownBuyId > 0) { string empty = string.Empty; foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems) { CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId); if (countDownInfo == null) { throw new HidistroAshxException(empty); } } } if (orderInfo.FightGroupId > 0) { string empty2 = string.Empty; foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems) { FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty2); if (fightGroupActivityInfo == null) { throw new HidistroAshxException(empty2); } } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { throw new HidistroAshxException("当前的订单为团购订单,此团购活动已结束,所以不能支付"); } num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId); num = groupBuy.MaxCount; num3 = orderInfo.GetGroupBuyOerderNumber(); if (num < num2 + num3) { throw new HidistroAshxException("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付"); } } if (orderInfo.PreSaleId > 0) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo == null) { throw new HidistroAshxException("预售活动不存在"); } if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now) { throw new HidistroAshxException("预售活动已结束不能支付定金,所以不能确认收款"); } } string empty3 = string.Empty; switch (TradeHelper.CheckOrderBeforePay(orderInfo, out empty3)) { case 1: throw new HidistroAshxException($"当前有商品{empty3}下架或者被删除,不能确认收款"); case 2: if ((orderInfo.PreSaleId <= 0 || orderInfo.DepositDate.HasValue) && orderInfo.PreSaleId > 0) { break; } throw new HidistroAshxException($"当前有商品{empty3}库存不足,不能确认收款"); } if (OrderHelper.ConfirmPay(orderInfo)) { if (orderInfo.GroupBuyId > 0 && num == num2 + num3) { PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } if (orderInfo.ParentOrderId == "-1") { OrderQuery orderQuery = new OrderQuery(); orderQuery.ParentOrderId = orderInfo.OrderId; IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery); foreach (OrderInfo item in listUserOrder) { OrderHelper.OrderConfirmPaySendMessage(item); } } else { OrderHelper.OrderConfirmPaySendMessage(orderInfo); } base.ReturnSuccessResult(context, "成功的确认了订单收款", 0, true); return; } throw new HidistroAshxException("确认订单收款失败"); }