コード例 #1
0
 public void Process()
 {
     try
     {
         List <BaseParkinfo> parkings = GetParkingBySupportAutoRefund();
         if (parkings.Count > 0)
         {
             List <OnlineOrder> models = OnlineOrderServices.QueryWaitRefund(parkings.Select(p => p.PKID).ToList(), DateTime.Now.Date);
             foreach (var item in models)
             {
                 if (item.SyncResultTimes < 3)
                 {
                     continue;
                 }
                 try
                 {
                     OnlineOrderServices.AutoRefund(item.OrderID, BackgroundWorkerManager.EnvironmentPath);
                 }
                 catch (Exception ex) {
                     TxtLogServices.WriteTxtLogEx("Background", "自动退款失败:orderId:{0},Message:{1},StackTrace:{2}", item.OrderID, ex.Message, ex.StackTrace);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptionToDbAndTxt("Background", "后台工作线程处理退款异常", ex, LogFrom.WeiXin);
     }
 }
コード例 #2
0
        /// <summary>
        /// 临停缴费
        /// </summary>
        /// <returns></returns>
        public ActionResult ParkCarPayment(decimal orderId, int source = 0)
        {
            if (string.IsNullOrWhiteSpace(AliPayUserId))
            {
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取用户信息失败" }));
            }
            try
            {
                OnlineOrder order = CheckOrder(orderId);
                if (order.OrderType != OnlineOrderType.ParkFee)
                {
                    throw new MyException("支付方法不正确");
                }

                string tradeNo = MakeAlipayTradeOrder(order);

                OnlineOrderServices.UpdatePrepayIdById(tradeNo, order.OrderID);
                order.PrepayId      = tradeNo;
                ViewBag.MaxWaitTime = DateTime.Now.AddMinutes(WXOtherConfigServices.GetTempParkingWeiXinPayTimeOut(order.CompanyID)).ToString("yyyy-MM-dd HH:mm:ss");
                return(View(order));
            }
            catch (MyException ex)
            {
                return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message, returnUrl = "/QRCodeParkPayment/Index" }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("AliPay_Error", string.Format("支付失败 orderId:{0};AliUserId:{1}", orderId, AliPayUserId), ex, LogFrom.AliPay);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "支付失败,请重新支付", returnUrl = "/QRCodeParkPayment/Index" }));
            }
        }
コード例 #3
0
        public ActionResult Index()
        {
            string plateNumber = OnlineOrderServices.QueryLastPaymentPlateNumber(PaymentChannel.WeiXinPay, WeiXinUser.OpenID);

            ViewBag.PlateNumber = plateNumber;
            return(View());
        }
コード例 #4
0
        /// <summary>
        /// 临停缴费
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public ActionResult ParkCarPayment(decimal orderId, int source = 0)
        {
            string returnUrl = source == 0 ? "/ParkingPayment/Index" : "/QRCodeParkPayment/QRCodePaySuccess?orderId=" + orderId;

            try
            {
                OnlineOrder order = CheckOrder(orderId);
                if (order.OrderType != OnlineOrderType.ParkFee)
                {
                    throw new MyException("支付方法不正确");
                }
                if (!OnlineOrderServices.UpdateSFMCode(order))
                {
                    throw new MyException("处理订单信息异常【SFM】");
                }

                string             sAttach  = Convert.ToString(Session["SmartSystem_WeiXinTg_personid"]);
                UnifiedPayModel    model    = GetUnifiedPayModel(order, string.Format("临停缴费-{0}", order.PlateNo), sAttach);
                WeiXinPaySignModel payModel = GetWeiXinPaySign(order, model);
                ViewBag.MaxWaitTime = DateTime.Now.AddMinutes(WXOtherConfigServices.GetTempParkingWeiXinPayTimeOut(order.CompanyID)).ToString("yyyy-MM-dd HH:mm:ss");
                ViewBag.PayModel    = payModel;
                ViewBag.ReturnUrl   = returnUrl;
                ViewBag.Source      = source;
                Session["SmartSystem_WeiXinTg_personid"] = null;
                return(View(order));
            }
            catch (MyException ex) {
                return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message, returnUrl = returnUrl }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPayment_Error", string.Format("支付失败 orderId:{0};openId:{1}", orderId, WeiXinOpenId), ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "支付失败,请重新支付", returnUrl = returnUrl }));
            }
        }
コード例 #5
0
        /// <summary>
        /// 导出
        /// </summary>
        /// <returns></returns>
        public ActionResult Export()
        {
            List <BWYGateMapping> gates       = BWYGateMappingServices.QueryAll();
            List <OnlineOrder>    onlineOrder = OnlineOrderServices.ExportQueryPage(GetOnlineOrderCondition());
            var result = from p in onlineOrder
                         select new
            {
                订单编号   = p.OrderID.ToString(),
                车场名称   = p.PKName,
                车牌号    = p.PlateNo,
                支付金额   = p.Amount,
                续期月数   = p.OrderType == OnlineOrderType.MonthCardRecharge ? p.MonthNum.ToString() : string.Empty,
                支付人    = p.PayerNickName,
                步支付次数  = p.SyncResultTimes,
                最后同步时间 = p.LastSyncResultTime != DateTime.MinValue ? p.LastSyncResultTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
                退款订单号  = p.RefundOrderId,
                订单类型   = p.OrderType.GetDescription(),
                订单状态   = p.Status.GetDescription(),
                订单时间   = p.OrderTime.ToString("yyyy-MM-dd HH:mm:ss"),
                支付时间   = p.RealPayTime != DateTime.MinValue ? p.RealPayTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
                外部车场名称 = GetBWYParkingName(p.ExternalPKID, gates),
                备注     = p.Remark
            };
            StringBuilder sb = new StringBuilder();

            sb.Append(JsonHelper.GetJsonString(result));
            var dt = JsonToDataTable(sb.ToString());
            var dl = DownLoadExcel(dt);

            return(dl);
        }
コード例 #6
0
        /// <summary>
        /// 车牌缴费
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Index(bool updatePlateNo = false)
        {
            List <string> myLicensePlates    = new List <string>();
            string        defaultPlateNumber = string.Empty;

            if (UserAccount != null)
            {
                myLicensePlates    = CarService.GetTempCarInfoIn(UserAccount.AccountID);
                defaultPlateNumber = OnlineOrderServices.QueryLastPaymentPlateNumber(UserAccount.AccountID);
                if (!string.IsNullOrWhiteSpace(defaultPlateNumber) && !updatePlateNo)
                {
                    ParkIORecord model = ParkIORecordServices.QueryLastExitIORecordByPlateNumber(defaultPlateNumber);
                    if (model != null)
                    {
                        return(RedirectToAction("ComputeParkingFee", "H5ParkingPayment", new { licensePlate = defaultPlateNumber, parkingId = model.ParkingID }));
                    }
                }

                if (!string.IsNullOrWhiteSpace(defaultPlateNumber))
                {
                    if (myLicensePlates.Contains(defaultPlateNumber))
                    {
                        myLicensePlates.Remove(defaultPlateNumber);
                    }
                }
                else if (myLicensePlates.Count > 0)
                {
                    defaultPlateNumber = myLicensePlates.First();
                    myLicensePlates.Remove(defaultPlateNumber);
                }
            }
            ViewBag.PlateNumber = defaultPlateNumber;
            return(View(myLicensePlates));
        }
コード例 #7
0
 public ActionResult Export_OnlineOrderInfo()
 {
     try
     {
         // 1.获取数据集合
         List <OnlineOrder> result = OnlineOrderServices.QueryAll(GetOnlineOrderCondition());
         var obj = (from p in result
                    select new
         {
             OrderID = p.OrderID.ToString(),
             PKName = p.PKName != null ? p.PKName : "",
             PlateNo = p.PlateNo,
             Amount = p.Amount,
             MonthNum = p.OrderType == OnlineOrderType.MonthCardRecharge ? p.MonthNum.ToString() : string.Empty,
             PayerNickName = p.PayerNickName != null ? p.PayerNickName : "",
             SyncResultTimes = p.SyncResultTimes,
             LastSyncResultTime = p.LastSyncResultTime != DateTime.MinValue ? p.LastSyncResultTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
             RefundOrderId = p.RefundOrderId != null ? p.RefundOrderId : "",
             OrderTypeDes = p.OrderType.GetDescription() != null ? p.OrderType.GetDescription() : "",
             StatusDes = p.Status.GetDescription(),
             OrderTime = p.OrderTime.ToString("yyyy-MM-dd HH:mm:ss"),
             RealPayTime = p.RealPayTime != DateTime.MinValue ? p.RealPayTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
             Remark = p.Remark != null? p.Remark : ""
                      //OrderType = (int)p.OrderType,
                      //Status = (int)p.Status,
                      //BWYParkingName = GetBWYParkingName(p.ExternalPKID, gates)
         }).ToList();
         string str = JsonHelper.GetJsonString(obj);
         var    dt  = JsonToDataTable(str.ToString());
         // 2.设置单元格抬头
         // key:实体对象属性名称,可通过反射获取值
         // value:Excel列的名称
         Dictionary <string, string> cellheader = new Dictionary <string, string> {
             { "OrderID", "订单编号" },
             { "PKName", "车场名称" },
             { "PlateNo", "车牌号" },
             { "Amount", "支付金额" },
             { "MonthNum", "续期月数" },
             { "PayerNickName", "支付人" },
             { "SyncResultTimes", "同步支付次数" },
             { "LastSyncResultTime", "最后同步时间" },
             { "RefundOrderId", "退款订单号" },
             { "OrderTypeDes", "订单类型" },
             { "StatusDes", "订单状态" },
             { "OrderTime", "订单时间" },
             { "RealPayTime", "支付时间" },
             { "Remark", "备注" },
             // 3.进行Excel转换操作,并返回转换的文件下载链接
         };
         return(EntityListToExcel(cellheader, dt, "微信订单信息"));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #8
0
        /// <summary>
        /// 扫码优免进入
        /// </summary>
        /// <param name="vid">小区编号</param>
        /// <param name="qid">二维码编号</param>
        /// <param name="type">0-长久二维码 1-临时二维码</param>
        /// <param name="sign">签名</param>
        /// <returns></returns>
        public ActionResult Index(string vid, string qid, string sign)
        {
            TxtLogServices.WriteTxtLogEx("QRCodeDerate", "进入扫码打折:vid={0},qid={1},sign={2}", vid, qid, sign);
            try
            {
                if (SourceClient != RequestSourceClient.WeiXin)
                {
                    throw new MyException("请在微信中打开");
                }
                if (!CheckSignature(vid, qid, sign))
                {
                    throw new MyException("验证签名失败");
                }

                if (SourceClient == RequestSourceClient.WeiXin)
                {
                    if (string.IsNullOrWhiteSpace(WeiXinOpenId))
                    {
                        ParkDerate derate = ParkDerateServices.Query(qid);
                        if (derate == null)
                        {
                            throw new MyException("获取优免券信息失败");
                        }

                        ParkSeller seller = ParkSellerServices.QueryBySellerId(derate.SellerID);
                        if (seller == null)
                        {
                            throw new MyException("获取商家信息失败");
                        }

                        BaseVillage village = VillageServices.QueryVillageByRecordId(seller.VID);
                        if (village == null)
                        {
                            throw new MyException("获取小区信息失败");
                        }

                        string id = string.Format("QRCodeDerate_Index_vid={0}^qid={1}^sign={2}^companyId={3}", vid, qid, sign, village.CPID);
                        return(RedirectToAction("Index", "WeiXinAuthorize", new { id = id }));
                    }
                }
                ViewBag.PlateNumber = OnlineOrderServices.QueryLastPaymentPlateNumber(PaymentChannel.WeiXinPay, WeiXinOpenId);
                ViewBag.VillageId   = vid;
                ViewBag.QId         = qid;
                return(View());
            }
            catch (MyException ex) {
                TxtLogServices.WriteTxtLogEx("QRCodeDerate", "扫码打折异常:描述:{0}", ex.Message);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message }));
            }
            catch (Exception ex)
            {
                TxtLogServices.WriteTxtLogEx("QRCodeDerate", "扫码打折异常:描述:{0},明细:{1}", ex.Message, ex.StackTrace);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "扫码失败,未知异常" }));
            }
        }
コード例 #9
0
 public ActionResult OrderPaymenting(decimal orderId)
 {
     try
     {
         OnlineOrderServices.OrderPaying(orderId);
         return(Json(MyResult.Success()));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptionToDbAndTxt("AliPay_Error", string.Format("订单状态更改为支付中失败 orderId:{0};openId:{1}", orderId, WeiXinOpenId), ex, LogFrom.WeiXin);
         return(Json(MyResult.Error("更改未支付中失败")));
     }
 }
コード例 #10
0
        public string GetOnlineOrderData()
        {
            StringBuilder strData = new StringBuilder();

            try
            {
                if (string.IsNullOrWhiteSpace(Request.Params["Query"]))
                {
                    return(strData.ToString());
                }
                int page = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]);
                int rows = string.IsNullOrEmpty(Request.Params["rows"]) ? 0 : int.Parse(Request.Params["rows"]);
                List <BWYGateMapping> gates = BWYGateMappingServices.QueryAll();
                int total = 0;
                List <OnlineOrder> result = OnlineOrderServices.QueryPage(GetOnlineOrderCondition(), page, rows, out total);
                var obj = from p in result
                          select new
                {
                    OrderID            = p.OrderID.ToString(),
                    PKName             = p.PKName,
                    PlateNo            = p.PlateNo,
                    Amount             = p.Amount,
                    MonthNum           = p.OrderType == OnlineOrderType.MonthCardRecharge ? p.MonthNum.ToString() : string.Empty,
                    PayerNickName      = p.PayerNickName,
                    SyncResultTimes    = p.SyncResultTimes,
                    LastSyncResultTime = p.LastSyncResultTime != DateTime.MinValue ? p.LastSyncResultTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
                    RefundOrderId      = p.RefundOrderId,
                    Remark             = p.Remark,
                    OrderType          = (int)p.OrderType,
                    OrderTypeDes       = p.OrderType.GetDescription(),
                    Status             = (int)p.Status,
                    StatusDes          = p.Status.GetDescription(),
                    OrderTime          = p.OrderTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    RealPayTime        = p.RealPayTime != DateTime.MinValue ? p.RealPayTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
                    BWYParkingName     = GetBWYParkingName(p.ExternalPKID, gates)
                };
                strData.Append("{");
                strData.Append("\"total\":" + total + ",");
                strData.Append("\"rows\":" + JsonHelper.GetJsonString(obj) + ",");
                strData.Append("\"index\":" + page);
                strData.Append("}");
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "查询微信订单信息失败");
            }

            return(strData.ToString());
        }
コード例 #11
0
        /// <summary>
        /// 取消订单
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public ActionResult CancelOrder(decimal orderId, int source = 0)
        {
            string actionName     = "Index";
            string controllerName = "H5ParkingPayment";

            try
            {
                OnlineOrderServices.CancelOrder(orderId);
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("H5AliPayment_Error", string.Format("取消待支付订单失败 orderId:{0};AliPayUserId:{1}", orderId, GetAliPayUserId), ex, LogFrom.WeiXin);
            }
            return(PageAlert(actionName, controllerName, new { RemindUserContent = "取消成功" }));
        }
コード例 #12
0
 public ActionResult AsynCancelOrder(decimal orderId)
 {
     try
     {
         OnlineOrderServices.CancelOrder(orderId);
         return(Json(MyResult.Success()));
     }
     catch (MyException ex)
     {
         ExceptionsServices.AddExceptionToDbAndTxt("H5WeiXinPayment_Error", string.Format("支付超时或用户手动取消待支付订单失败 orderId:{0};", orderId), ex, LogFrom.WeiXin);
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptionToDbAndTxt("H5WeiXinPayment_Error", string.Format("支付超时或用户手动取消待支付订单失败 orderId:{0};", orderId), ex, LogFrom.WeiXin);
         return(Json(MyResult.Error("取消订单失败")));
     }
 }
コード例 #13
0
        private OnlineOrder CheckOrder(decimal orderId)
        {
            OnlineOrder order = OnlineOrderServices.QueryByOrderId(orderId);

            if (order == null)
            {
                throw new MyException("获取支付信息失败,请重新支付");
            }
            if (order.PaymentChannel != PaymentChannel.WeiXinPay)
            {
                throw new MyException("支付方法不正确");
            }
            if (order.Status != OnlineOrderStatus.WaitPay)
            {
                throw new MyException("订单不是可支付状态");
            }
            return(order);
        }
コード例 #14
0
        public ActionResult AliPayRequest(decimal orderId, int requestSource)
        {
            try
            {
                OnlineOrder order = OnlineOrderServices.QueryByOrderId(orderId);
                if (order == null)
                {
                    throw new MyException("获取订单信息失败");
                }
                if (order.Status != Common.Entities.Enum.OnlineOrderStatus.WaitPay)
                {
                    throw new MyException("订单不是可支付状态");
                }

                if (string.IsNullOrWhiteSpace(GetAliPayUserId))
                {
                    string id = string.Format("H5Order_AliPayRequest_orderId={0}^companyId={1}^requestSource={2}", order.OrderID, order.CompanyID, requestSource);
                    return(RedirectToAction("Index", "AliPayAuthorize", new { id = id }));
                }

                bool result = OnlineOrderServices.UpdatePayAccount(orderId, GetAliPayUserId);
                if (!result)
                {
                    throw new MyException("更改支付账号失败");
                }
                if (requestSource == 1)
                {
                    return(RedirectToAction("ParkCarPayment", "H5AliPayment", new { orderId = orderId }));
                }
                if (requestSource == 2)
                {
                    return(RedirectToAction("MonthCardPayment", "H5AliPayment", new { orderId = orderId }));
                }
                throw new MyException("未知请求来源");
            }
            catch (MyException ex) {
                return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("H5OrderError", string.Format("更改支付人信息失败,订单编号:{0},单位编号:{1}", orderId, GetRequestCompanyId), ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "更改支付账号失败!" }));
            }
        }
コード例 #15
0
        /// <summary>
        /// 取消订单
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public ActionResult CancelOrder(decimal orderId, int source = 0)
        {
            string actionName     = "Index";
            string controllerName = "ParkingPayment";

            try
            {
                OnlineOrder order = OnlineOrderServices.QueryByOrderId(orderId);
                if (order != null)
                {
                    OnlineOrderServices.CancelOrder(orderId);
                    if (order.OrderType == OnlineOrderType.MonthCardRecharge)
                    {
                        controllerName = "CardRenewal";
                        actionName     = "Index";
                    }
                    if (order.OrderType == OnlineOrderType.ParkFee)
                    {
                        if (source == 0)
                        {
                            controllerName = "ParkingPayment";
                            actionName     = "Index";
                        }
                        else
                        {
                            controllerName = "QRCodeParkPayment";
                            actionName     = "Index";
                        }
                    }
                    if (order.OrderType == OnlineOrderType.PkBitBooking)
                    {
                        controllerName = "ParkBitBooking";
                        actionName     = "Index";
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("AliPay_Error", string.Format("取消待支付订单失败 orderId:{0};openId:{1}", orderId, WeiXinOpenId), ex, LogFrom.WeiXin);
            }
            return(PageAlert(actionName, controllerName, new { RemindUserContent = "取消成功" }));
        }
コード例 #16
0
        private UnifiedPayModel GetUnifiedPayModel(OnlineOrder order, string description, string attach = "")
        {
            UnifiedPayModel model = UnifiedPayModel.CreateUnifiedModel(order.CompanyID);

            if (string.IsNullOrWhiteSpace(order.PrepayId))
            {
                string payNotifyAddress = string.Format("{0}{1}", WXApiConfigServices.QueryWXApiConfig(order.CompanyID).Domain, "/WeiXinPayNotify/Index");
                //预支付
                string postData             = model.CreatePrePayPackage(order.OrderID.ToString(), ((int)(order.Amount * 100)).ToString(), WeiXinOpenId, description, payNotifyAddress, attach);
                UnifiedPrePayMessage result = PaymentServices.UnifiedPrePay(postData);
                if (result == null || !result.ReturnSuccess || !result.ResultSuccess || string.IsNullOrEmpty(result.Prepay_Id))
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPayment_Error", "预支付", string.Format("postData:{0}", postData), LogFrom.WeiXin);
                    throw new Exception(string.Format("获取PrepayId 失败,Message:{0}", result.ToXmlString()));
                }
                OnlineOrderServices.UpdatePrepayIdById(result.Prepay_Id, order.OrderID);
                order.PrepayId = result.Prepay_Id;
            }
            return(model);
        }
コード例 #17
0
        public ActionResult CheckOrderState(decimal orderId)
        {
            try
            {
                OnlineOrder order = OnlineOrderServices.QueryByOrderId(orderId);
                //int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(order.PayDetailID);

                int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(order.PayDetailID, order.PKID, order.InOutID);
                if (interfaceOrderState != 1)
                {
                    string msg = interfaceOrderState == 2 ? "重复支付" : "订单已失效";
                    return(Json(MyResult.Error(msg)));
                }
                return(Json(MyResult.Success()));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPayment_Error", string.Format("检查订单是否有效失败 orderId:{0};openId:{1}", orderId, WeiXinOpenId), ex, LogFrom.WeiXin);
                return(Json(MyResult.Error("检查订单是否有效失败")));
            }
        }
コード例 #18
0
 public JsonResult SynchAliPayPaymentResult(decimal orderId)
 {
     try
     {
         bool result = OnlineOrderServices.SyncPaymentResult(orderId);
         if (!result)
         {
             throw new MyException("同步失败");
         }
         return(Json(MyResult.Success()));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "同步支付结果失败");
         return(Json(MyResult.Error("同步支付结果失败")));
     }
 }
コード例 #19
0
 public JsonResult ManualRefund(decimal orderId)
 {
     try
     {
         bool result = OnlineOrderServices.ManualRefund(orderId, Server.MapPath("~"));
         if (!result)
         {
             throw new MyException("退款失败");
         }
         return(Json(MyResult.Success()));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "手动退款失败");
         return(Json(MyResult.Error("手动退款失败")));
     }
 }
コード例 #20
0
 public void Process()
 {
     try
     {
         List <OnlineOrder> models = OnlineOrderServices.QueryBySyncPayResultFail();
         foreach (var item in models)
         {
             int index = item.SyncResultTimes == 0?0:item.SyncResultTimes - 1;
             if (index > 5)
             {
                 continue;
             }
             if (item.LastSyncResultTime.AddSeconds(IntervalTime[index]) < DateTime.Now)
             {
                 OnlineOrderServices.AgainSyncPayResult(item.OrderID, item.RealPayTime);
             }
         }
     }
     catch (Exception ex) {
         ExceptionsServices.AddExceptionToDbAndTxt("Background", "后台工作线程同步处理支付结果失败", ex, LogFrom.WeiXin);
     }
 }
コード例 #21
0
        public ActionResult SubmitMonthRenewals(string cardId, int month, double paymoney, PaymentChannel paytype, DateTime afterdate, string plateno, int source)
        {
            try
            {
                TxtLogServices.WriteTxtLog("1");

                TxtLogServices.WriteTxtLog(plateno);
                TxtLogServices.WriteTxtLog(cardId);
                TxtLogServices.WriteTxtLog(source.ToString());
                //TxtLogServices.WriteTxtLog(carInfos.Count().ToString());

                List <ParkUserCarInfo> carInfos = source == 1
                    ?RechargeService.GetMonthCarInfoByPlateNumber(plateno)
                    : RechargeService.GetMonthCarInfoByAccountID(WeiXinUser.AccountID);

                ParkUserCarInfo card = carInfos.FirstOrDefault(p => p.CardID == cardId);

                if (card == null)
                {
                    TxtLogServices.WriteTxtLog(carInfos.Count().ToString());
                    TxtLogServices.WriteTxtLog("2");
                }
                TxtLogServices.WriteTxtLog("3");

                CheckMonthCardOrder(card, month, paymoney, paytype, afterdate);
                TxtLogServices.WriteTxtLog("4");
                BaseCompany company = CompanyServices.QueryByParkingId(card.PKID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                }
                if (config.CompanyID != WeiXinUser.CompanyID)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "微信用户所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, WeiXinUser.CompanyID), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信用户所属公众号和当前公众号不匹配,不能支付!" }));
                }
                if (CurrLoginWeiXinApiConfig == null || config.CompanyID != CurrLoginWeiXinApiConfig.CompanyID)
                {
                    string loginCompanyId = CurrLoginWeiXinApiConfig != null ? CurrLoginWeiXinApiConfig.CompanyID : string.Empty;
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "车场所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "车场所属公众号和当前公众号不匹配,不能支付!" }));
                }

                OnlineOrder model = new OnlineOrder();
                model.OrderID        = IdGenerator.Instance.GetId();
                model.CardId         = card.CardID;
                model.PKID           = card.PKID;
                model.PKName         = card.PKName;
                model.EntranceTime   = card.EndDate;
                model.ExitTime       = afterdate;
                model.MonthNum       = month;
                model.Amount         = (decimal)paymoney;
                model.Status         = OnlineOrderStatus.WaitPay;
                model.PaymentChannel = PaymentChannel.WeiXinPay;
                model.Payer          = WeiXinUser.OpenID;
                model.PayAccount     = WeiXinUser.OpenID;
                model.OrderTime      = DateTime.Now;
                model.PayeeChannel   = paytype;
                model.AccountID      = WeiXinUser.AccountID;
                model.OrderType      = OnlineOrderType.MonthCardRecharge;
                model.PlateNo        = card.PlateNumber;
                model.PayeeUser      = config.SystemName;
                model.PayeeAccount   = config.PartnerId;
                model.CompanyID      = config.CompanyID;
                bool result = OnlineOrderServices.Create(model);
                if (!result)
                {
                    throw new MyException("续期失败[保存订单失败]");
                }

                Response.Cookies.Add(new HttpCookie("SmartSystem_MonthCardPayment_Month", string.Format("{0},{1}", month, (int)paytype)));

                switch (model.PaymentChannel)
                {
                case PaymentChannel.WeiXinPay:
                {
                    return(RedirectToAction("MonthCardPayment", "WeiXinPayment", new { orderId = model.OrderID }));
                }

                default: throw new MyException("支付方式错误");
                }
            }
            catch (MyException ex)
            {
                return(PageAlert("MonthCardRenewal", "CardRenewal", new { cardId = cardId, RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinWeb", string.Format("获取续费信息失败,编号:" + cardId), ex, LogFrom.WeiXin);
                return(PageAlert("MonthCardRenewal", "CardRenewal", new { cardId = cardId, RemindUserContent = "提交支付失败" }));
            }
        }
コード例 #22
0
        public ActionResult SubmitMonthRenewals(string cardId, int month, double paymoney, PaymentChannel paytype, DateTime afterdate, string plateno, int source)
        {
            try
            {
                List <ParkUserCarInfo> carInfos = new List <ParkUserCarInfo>();
                if (source == 1)
                {
                    carInfos = RechargeService.GetMonthCarInfoByPlateNumber(plateno);
                }
                else
                {
                    if (UserAccount != null)
                    {
                        carInfos = RechargeService.GetMonthCarInfoByAccountID(UserAccount.AccountID);
                    }
                }
                ParkUserCarInfo card = carInfos.FirstOrDefault(p => p.CardID == cardId);
                if (card == null)
                {
                    throw new MyException("获月卡信息失败");
                }
                CheckMonthCardOrder(card, month, paymoney, paytype, afterdate);

                BaseCompany company = CompanyServices.QueryByParkingId(card.PKID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                OnlineOrder model = new OnlineOrder();
                if (paytype == PaymentChannel.AliPay)
                {
                    AliPayApiConfig config = AliPayApiConfigServices.QueryAliPayConfig(company.CPID);
                    if (config == null)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", "获取支付宝配置信息失败[0001]", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取支付宝配置信息失败!" }));
                    }
                    if (!config.Status)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", "该支付宝暂停使用", "单位编号:" + config.CompanyID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用支付宝支付!" }));
                    }
                    AliPayApiConfig requestConfig = AliPayApiConfigServices.QueryAliPayConfig(GetRequestCompanyId);
                    if (requestConfig == null)
                    {
                        throw new MyException("获取请求单位微信配置失败");
                    }

                    if (config.CompanyID != requestConfig.CompanyID)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", "支付的支付宝配置和请求的支付配置不匹配,不能支付", string.Format("支付单位:{0},请求单位:{1}", config.CompanyID, requestConfig.CompanyID), LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "支付的支付宝配置和请求的支付配置不匹配,不能支付!" }));
                    }
                    model.PayeeUser      = config.SystemName;
                    model.PayeeAccount   = config.PayeeAccount;
                    model.PayeeChannel   = PaymentChannel.AliPay;
                    model.PaymentChannel = PaymentChannel.AliPay;
                    model.CompanyID      = config.CompanyID;
                }
                else
                {
                    WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                    if (config == null)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                    }
                    if (!config.Status)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                    }
                    WX_ApiConfig requestConfig = WXApiConfigServices.QueryWXApiConfig(GetRequestCompanyId);
                    if (requestConfig == null)
                    {
                        throw new MyException("获取请求单位微信配置失败");
                    }

                    if (config.CompanyID != requestConfig.CompanyID)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", "微信支付配置和当前请求微信支付配置不匹配,不能支付", string.Format("支付单位:{0},请求单位:{1}", config.CompanyID, requestConfig.CompanyID), LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信支付配置和当前请求微信支付配置不匹配,不能支付!" }));
                    }
                    model.PayeeUser      = config.SystemName;
                    model.PayeeAccount   = config.PartnerId;
                    model.PayeeChannel   = PaymentChannel.WeiXinPay;
                    model.PaymentChannel = PaymentChannel.WeiXinPay;
                    model.CompanyID      = config.CompanyID;
                }

                model.OrderID      = IdGenerator.Instance.GetId();
                model.CardId       = card.CardID;
                model.PKID         = card.PKID;
                model.PKName       = card.PKName;
                model.EntranceTime = card.EndDate;
                model.ExitTime     = afterdate;
                model.MonthNum     = month;
                model.Amount       = (decimal)paymoney;
                model.Status       = OnlineOrderStatus.WaitPay;

                model.OrderTime = DateTime.Now;
                model.AccountID = LoginAccountID;
                model.OrderType = OnlineOrderType.MonthCardRecharge;
                model.PlateNo   = card.PlateNumber;

                bool result = OnlineOrderServices.Create(model);
                if (!result)
                {
                    throw new MyException("续期失败[保存订单失败]");
                }

                Response.Cookies.Add(new HttpCookie("SmartSystem_MonthCardPayment_Month", string.Format("{0},{1}", month, (int)paytype)));

                switch (model.PaymentChannel)
                {
                case PaymentChannel.WeiXinPay:
                {
                    return(RedirectToAction("MonthCardPayment", "H5WeiXinPayment", new { orderId = model.OrderID }));
                }

                case PaymentChannel.AliPay:
                {
                    return(RedirectToAction("AliPayRequest", "H5Order", new { orderId = model.OrderID, requestSource = 2 }));
                }

                default: throw new MyException("支付方式错误");
                }
            }
            catch (MyException ex)
            {
                return(PageAlert("MonthCardRenewal", "H5CardRenewal", new { cardId = cardId, RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("H5CardRenewalError", string.Format("获取续费信息失败,编号:" + cardId), ex, LogFrom.WeiXin);
                return(PageAlert("MonthCardRenewal", "CardRenewal", new { cardId = cardId, RemindUserContent = "提交支付失败" }));
            }
        }
コード例 #23
0
        public ActionResult SaveRecharge(decimal Amount)
        {
            try
            {
                BaseVillage village = VillageServices.QueryVillageByRecordId(SellerLoginUser.VID);
                if (village == null)
                {
                    throw new MyException("获取小区信息失败");
                }

                WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(village.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "获取微信配置信息失败", "单位编号:" + village.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "该车场暂停使用微信支付", "单位编号:" + village.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                }
                if (config.CompanyID != WeiXinUser.CompanyID)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "微信用户所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, WeiXinUser.CompanyID), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信用户所属公众号和当前公众号不匹配,不能支付!" }));
                }
                if (CurrLoginWeiXinApiConfig == null || config.CompanyID != CurrLoginWeiXinApiConfig.CompanyID)
                {
                    string loginCompanyId = CurrLoginWeiXinApiConfig != null ? CurrLoginWeiXinApiConfig.CompanyID : string.Empty;
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "车场所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "车场所属公众号和当前公众号不匹配,不能支付!" }));
                }

                OnlineOrder order = new OnlineOrder();
                order.OrderID        = IdGenerator.Instance.GetId();
                order.InOutID        = SellerLoginUser.SellerID;
                order.PKID           = SellerLoginUser.SellerID;
                order.Status         = OnlineOrderStatus.WaitPay;
                order.PayAccount     = WeiXinUser.OpenID;
                order.Payer          = WeiXinUser.OpenID;
                order.PKName         = SellerLoginUser.SellerName;
                order.Amount         = Amount;
                order.PayeeUser      = config.SystemName;
                order.PayeeAccount   = config.PartnerId;
                order.OrderType      = OnlineOrderType.SellerRecharge;
                order.PaymentChannel = PaymentChannel.WeiXinPay;
                order.PayeeChannel   = PaymentChannel.WeiXinPay;
                order.AccountID      = WeiXinUser.AccountID;
                order.Amount         = Amount;
                order.CardId         = WeiXinUser.AccountID;
                order.CompanyID      = config.CompanyID;
                order.OrderTime      = DateTime.Now;
                order.Remark         = "商家充值";
                bool result = OnlineOrderServices.Create(order);
                if (!result)
                {
                    throw new MyException("充值失败[保存订单失败]");
                }

                return(RedirectToAction("SellerRechargePayment", "WeiXinPayment", new { orderId = order.OrderID }));
            }
            catch (MyException ex)
            {
                return(PageAlert("Index", "SellerRecharge", new { RemindUserContent = ex.Message }));
            }
            catch (Exception ex) {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "提交商家充值信息失败", ex, LogFrom.WeiXin);
                return(PageAlert("Index", "SellerRecharge", new { RemindUserContent = "提交商家充值信息失败" }));
            }
        }
コード例 #24
0
        public ActionResult PaymentSuccess(decimal orderId)
        {
            OnlineOrder order = OnlineOrderServices.QueryByOrderId(orderId);

            return(View(order));
        }
コード例 #25
0
        /// <summary>
        /// 扫描缴费
        /// </summary>
        /// <param name="pid">车场编号</param>
        /// <param name="pn">车牌号</param>
        /// <param name="bid">岗亭编号</param>
        /// <returns></returns>
        public ActionResult Index(string pid, string pn, string bid, string personId = "")
        {
            TxtLogServices.WriteTxtLogEx("QRCodeParkPayment", "进入Index,pid:{0}, pn:{1}, bid:{2},personId:{3}", pid, pn, bid, personId);

            try
            {
                if (SourceClient != RequestSourceClient.AliPay && SourceClient != RequestSourceClient.WeiXin)
                {
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "请在微信或支付宝中打开" }));
                }
                string companyId = CompanyServices.GetCompanyId(pid, bid);
                if (string.IsNullOrWhiteSpace(companyId))
                {
                    throw new MyException("获取单位编号失败");
                }

                if (SourceClient == RequestSourceClient.AliPay)
                {
                    if (string.IsNullOrWhiteSpace(AliPayUserId))
                    {
                        string id = string.Format("QRCodeParkPayment_Index_pid={0}^pn={1}^bid={2}^companyId={3}^personId={4}", pid, pn, bid, companyId, personId);
                        return(RedirectToAction("Index", "AliPayAuthorize", new { id = id }));
                    }
                }
                else if (SourceClient == RequestSourceClient.WeiXin)
                {
                    if (string.IsNullOrWhiteSpace(WeiXinOpenId))
                    {
                        string id = string.Format("QRCodeParkPayment_Index_pid={0}^pn={1}^bid={2}^companyId={3}^personId={4}", pid, pn, bid, companyId, personId);
                        return(RedirectToAction("Index", "WeiXinAuthorize", new { id = id }));
                    }
                }

                if (!string.IsNullOrWhiteSpace(bid))
                {
                    return(RedirectToAction("ComputeParkingFee", "QRCodeParkPayment", new { bid = bid }));
                }
                else
                {
                    if (SourceClient == RequestSourceClient.WeiXin || SourceClient == RequestSourceClient.AliPay)
                    {
                        TxtLogServices.WriteTxtLogEx("QRCodeParkPayment", "车牌号:" + pn);
                        if (!string.IsNullOrWhiteSpace(pn))
                        {
                            return(RedirectToAction("ComputeParkingFee", "QRCodeParkPayment", new { pid = pid, licensePlate = pn }));
                        }
                    }
                    else
                    {
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "请在微信或支付宝中打开" }));
                    }
                }
                ViewBag.CurrParkingId = pid;

                if (SourceClient == RequestSourceClient.AliPay)
                {
                    ViewBag.PlateNumber = OnlineOrderServices.QueryLastPaymentPlateNumber(PaymentChannel.AliPay, AliPayUserId);
                }
                else
                {
                    ViewBag.PlateNumber = OnlineOrderServices.QueryLastPaymentPlateNumber(PaymentChannel.WeiXinPay, WeiXinOpenId);
                }

                if (!string.IsNullOrWhiteSpace(personId))
                {
                    Session["SmartSystem_WeiXinTg_personid"] = personId;
                }

                return(View());
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("QRCodeParkPayment", "Index方法处理异常", ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "处理异常" }));
            }
        }
コード例 #26
0
        public ActionResult SubmitParkingPaymentRequest(OnlineOrder model)
        {
            try
            {
                if (model.OrderSource == PayOrderSource.Platform)
                {
                    //int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(model.PayDetailID);

                    int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(model.PayDetailID, model.PKID, model.InOutID);
                    if (interfaceOrderState != 1)
                    {
                        string msg       = interfaceOrderState == 2 ? "重复支付" : "订单已失效";
                        string companyId = GetCompanyId(model.PKID, string.Empty, string.Empty);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = msg, returnUrl = "/QRCode/Index?companyId=" + companyId + "" }));
                    }
                }
                model.OrderID   = IdGenerator.Instance.GetId();
                model.Status    = OnlineOrderStatus.WaitPay;
                model.OrderType = OnlineOrderType.ParkFee;
                model.Amount    = model.Amount;

                BaseCompany company = CompanyServices.QueryByParkingId(model.PKID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                if (model.PaymentChannel == PaymentChannel.AliPay)
                {
                    if (string.IsNullOrWhiteSpace(AliPayUserId))
                    {
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取用户信息失败,请重新扫码进入" }));
                    }
                    AliPayApiConfig config = AliPayApiConfigServices.QueryAliPayConfig(company.CPID);
                    if (config == null)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取支付宝配置信息失败[0001]", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取支付宝配置信息失败!" }));
                    }
                    if (!config.Status)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该支付宝暂停使用", "单位编号:" + config.CompanyID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用支付宝支付!" }));
                    }
                    if (model.OrderSource == PayOrderSource.Platform && (CurrLoginAliPayApiConfig == null || CurrLoginAliPayApiConfig.CompanyID != config.CompanyID))
                    {
                        string loginCompanyId = CurrLoginAliPayApiConfig != null ? CurrLoginAliPayApiConfig.CompanyID : string.Empty;
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "支付宝配置信息和当前支付宝配置信息不匹配,不能支付", string.Format("支付单位:{0},用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                        if (CurrLoginAliPayApiConfig == null)
                        {
                            return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取支付宝授权信息失败,请重试!" }));
                        }
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "支付宝配置信息和当前支付宝配置信息不匹配,不能支付!" }));
                    }
                    model.AccountID      = string.Empty;
                    model.CardId         = string.Empty;
                    model.PayeeChannel   = PaymentChannel.AliPay;
                    model.PaymentChannel = PaymentChannel.AliPay;
                    model.PayeeUser      = config.SystemName;
                    model.PayeeAccount   = config.PayeeAccount;
                    model.Payer          = AliPayUserId;
                    model.PayAccount     = AliPayUserId;
                    model.CompanyID      = config.CompanyID;
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(WeiXinOpenId))
                    {
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取用户信息失败,请重新扫码进入" }));
                    }

                    WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                    if (config == null)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                    }
                    if (!config.Status)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                    }
                    if (model.OrderSource == PayOrderSource.Platform && (CurrLoginWeiXinApiConfig == null || config.CompanyID != CurrLoginWeiXinApiConfig.CompanyID))
                    {
                        string loginCompanyId = CurrLoginWeiXinApiConfig != null ? CurrLoginWeiXinApiConfig.CompanyID : string.Empty;
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "车场所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                        if (CurrLoginWeiXinApiConfig == null)
                        {
                            return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信授权信息失败,请重试!" }));
                        }
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "车场所属公众号和当前公众号不匹配,不能支付!" }));
                    }

                    model.PayeeUser      = config.SystemName;
                    model.PayeeAccount   = config.PartnerId;
                    model.PayAccount     = WeiXinOpenId;
                    model.Payer          = model.PayAccount;
                    model.AccountID      = model.AccountID;
                    model.CardId         = model.AccountID;
                    model.PayeeChannel   = PaymentChannel.WeiXinPay;
                    model.PaymentChannel = PaymentChannel.WeiXinPay;
                    model.CompanyID      = config.CompanyID;
                }

                bool result = OnlineOrderServices.Create(model);
                if (!result)
                {
                    throw new MyException("生成待缴费订单失败");
                }

                switch (model.PaymentChannel)
                {
                case PaymentChannel.WeiXinPay:
                {
                    return(RedirectToAction("ParkCarPayment", "WeiXinPayment", new { orderId = model.OrderID, source = 1 }));
                }

                case PaymentChannel.AliPay:
                {
                    return(RedirectToAction("ParkCarPayment", "AliPayment", new { orderId = model.OrderID, source = 1 }));
                }

                default: throw new MyException("支付方式错误");
                }
            }
            catch (MyException ex)
            {
                return(RedirectToAction("ComputeParkingFee", "QRCodeParkPayment", new { licensePlate = model.PlateNo, RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "保存临停缴费订单失败", ex, LogFrom.WeiXin);
                return(RedirectToAction("ComputeParkingFee", "QRCodeParkPayment", new { licensePlate = model.PlateNo, RemindUserContent = "提交支付失败" }));
            }
        }
コード例 #27
0
        public string Pay()
        {
            string sTag = Request["paytype"];
            //string sBody = Request["body"];
            string sAmount      = Request["fee"];
            string sPayAccount  = Request["auth_code"];
            string sPlateNumber = Request["PlateNumber"];
            string sPKID        = Request["PKID"];

            if (sTag.IsEmpty() || (sTag != "0" && sTag != "1" && sTag != "2"))
            {
                return("2");
            }

            //if (string.IsNullOrEmpty(sBody))
            //{
            //    return "2sBody";
            //}
            if (string.IsNullOrEmpty(sAmount))
            {
                return("2");
            }

            if (sTag != "2")
            {
                if (string.IsNullOrEmpty(sPayAccount))
                {
                    return("2");
                }
            }
            if (string.IsNullOrEmpty(sPlateNumber))
            {
                return("2");
            }
            if (string.IsNullOrEmpty(sPKID))
            {
                return("2");
            }

            OnlineOrder model = new OnlineOrder();

            model.OrderTime = DateTime.Now;

            TempParkingFeeResult result = RechargeService.WXTempParkingFee(sPlateNumber, sPKID, sPayAccount, model.OrderTime);

            if (result.Result == APPResult.NoNeedPay)
            {
                return("3"); //不需要交费
            }
            if (result.Result == APPResult.RepeatPay)
            {
                return("4"); //重复交费
            }

            decimal dAmount = decimal.Parse(sAmount) / 100;

            //if (result.Pkorder.Amount != dAmount)
            //{
            //    return "6"; //金额不一致
            //}
            try
            {
                RechargeService.CheckCalculatingTempCost(result.Result);
            }
            catch (Exception ex)
            {
                return(((int)result.Result).ToString());
            }

            if (result.OrderSource == PayOrderSource.Platform)
            {
                bool testResult = CarService.WXTestClientProxyConnectionByPKID(result.ParkingID);
                if (!testResult)
                {
                    throw new MyException("车场网络异常,暂无法缴停车费!");
                }
                //int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(result.Pkorder.OrderNo);

                int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(result.Pkorder.OrderNo, result.ParkingID, result.Pkorder.TagID);
                if (interfaceOrderState != 1)
                {
                    if (interfaceOrderState == 2)
                    {
                        return("4"); //重复交费
                    }
                    else
                    {
                        return("5"); //订单已失效
                    }
                }
            }

            model.ParkCardNo   = result.CardNo;
            model.PKID         = result.ParkingID;
            model.PKName       = result.ParkName;
            model.InOutID      = result.Pkorder.TagID;
            model.PlateNo      = result.PlateNumber;
            model.EntranceTime = result.EntranceDate;
            model.ExitTime     = model.OrderTime.AddMinutes(result.OutTime);
            //model.Amount = result.Pkorder.Amount;
            model.Amount         = dAmount;
            model.PayDetailID    = result.Pkorder.OrderNo;
            model.DiscountAmount = result.Pkorder.DiscountAmount;
            // model.OrderSource = PayOrderSource.HAND;
            model.ExternalPKID = result.ExternalPKID;

            model.OrderID   = IdGenerator.Instance.GetId();
            model.Status    = OnlineOrderStatus.WaitPay;
            model.OrderType = OnlineOrderType.ParkFee;

            BaseCompany company = CompanyServices.QueryByParkingId(model.PKID);

            if (company == null)
            {
                throw new MyException("获取单位信息失败");
            }

            if (sTag == "0")
            {
                WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return("-1");
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return("-1");
                }

                model.PayeeUser      = config.SystemName;
                model.PayeeAccount   = config.PartnerId;
                model.PayAccount     = sPayAccount;
                model.Payer          = sPayAccount;
                model.AccountID      = model.AccountID;
                model.CardId         = model.AccountID;
                model.PayeeChannel   = PaymentChannel.WeiXinPay;
                model.PaymentChannel = PaymentChannel.WeiXinPay;
                model.CompanyID      = config.CompanyID;

                bool isSuc = OnlineOrderServices.Create(model);
                if (!isSuc)
                {
                    throw new MyException("生成待缴费订单失败");
                }
            }
            else if (sTag == "1")
            {
                //支付宝
                AliPayApiConfig config = AliPayApiConfigServices.QueryAliPayConfig(company.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取支付宝配置信息失败[0001]", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return("-1");
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该支付宝暂停使用", "单位编号:" + config.CompanyID, LogFrom.WeiXin);
                    return("-1");
                }

                model.AccountID      = string.Empty;
                model.CardId         = string.Empty;
                model.PayeeChannel   = PaymentChannel.AliPay;
                model.PaymentChannel = PaymentChannel.AliPay;
                model.PayeeUser      = config.SystemName;
                model.PayeeAccount   = config.PayeeAccount;
                model.Payer          = sPayAccount;
                model.PayAccount     = sPayAccount;
                model.CompanyID      = config.CompanyID;

                bool isSuc = OnlineOrderServices.Create(model);
                if (!isSuc)
                {
                    throw new MyException("生成待缴费订单失败");
                }
            }
            else if (sTag == "2")
            {
                //现金支付的
                model.AccountID  = string.Empty;
                model.CardId     = string.Empty;
                model.Payer      = sPayAccount;
                model.PayAccount = sPayAccount;
                model.CompanyID  = company.CPID;
            }

            //调用刷卡支付,如果内部出现异常则在页面上显示异常原因
            try
            {
                //int status=1;

                string tradeNo   = "";
                string sDataInfo = "";
                if (sTag == "0")    //微信
                {
                    if (!MicroPay.Run(model, out sDataInfo))
                    {
                        return("-2");
                    }
                    else
                    {
                        tradeNo = sDataInfo;
                        //发送通知开闸
                        bool isPayState = OnlineOrderServices.PaySuccess(model.OrderID, tradeNo, DateTime.Now, sPayAccount);
                        if (!isPayState)
                        {
                            throw new Exception("修改微信订单状态失败");
                        }

                        TxtLogServices.WriteTxtLogEx("WXPayReturn", string.Format("WXPayResult:{0}支付完成", tradeNo));
                    }
                }
                else if (sTag == "1")   //支付宝
                {
                    if (AliPayPay.Run(model, out sDataInfo) == false)
                    {
                        return("-3");
                    }
                    else
                    {
                        tradeNo = sDataInfo;

                        bool isPayState = OnlineOrderServices.PaySuccess(model.OrderID, tradeNo, DateTime.Now, sPayAccount);
                        if (!isPayState)
                        {
                            throw new Exception("修改支付宝订单状态失败");
                        }

                        TxtLogServices.WriteTxtLogEx("AliPayReturn", string.Format("AliPayShowResult:{0}支付完成", tradeNo));
                    }
                }
                else if (sTag == "2") //现金支付的
                {
                    TempStopPaymentResult payResult = RechargeService.WXTempStopPayment(result.Pkorder.OrderNo, (int)OrderPayWay.Cash, dAmount, sPKID, "", model.OrderID.ToString(), DateTime.Now);
                    TxtLogServices.WriteTxtLogEx("CashReturn", string.Format("CashShowResult:{1}:{0} 支付完成", payResult.ToXml(System.Text.Encoding.UTF8), dAmount));
                    if (payResult.Result != APPResult.Normal)
                    {
                        return("5");
                    }
                }

                //不是预支付的订单 就暂时不修改了
                //bool results = OnlineOrderServices.UpdatePrepayIdById(tradeNo, model.OrderID);
                //Response.Write("<span style='color:#00CD00;font-size:20px'>" + result + "</span>");
                ParkingFeeService.DeleteParkingFee(model.PlateNo + model.PKID);
                return("0");
            }
            //catch (WxPayException ex)
            //{
            //    return "1";
            //    //Response.Write("<span style='color:#FF0000;font-size:20px'>" + ex.ToString() + "</span>");
            //}
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("PayError", "该支付失败", "单位编号:" + model.CompanyID + "<br/>" + ex.StackTrace, LogFrom.UnKnown);
                return("-4");
                //Response.Write("<span style='color:#FF0000;font-size:20px'>" + ex.ToString() + "</span>");
            }
        }
コード例 #28
0
        public ActionResult SubmitParkingPaymentRequest(OnlineOrder model)
        {
            try
            {
                if (model.OrderSource == PayOrderSource.Platform)
                {
                    int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(model.PayDetailID);
                    if (interfaceOrderState != 1)
                    {
                        string msg = interfaceOrderState == 2 ? "重复支付" : "订单已失效";
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = msg, returnUrl = "/H5ParkingPayment/Index" }));
                    }
                }
                model.OrderID   = IdGenerator.Instance.GetId();
                model.Status    = OnlineOrderStatus.WaitPay;
                model.OrderType = OnlineOrderType.ParkFee;
                model.Amount    = model.Amount;

                BaseCompany company = CompanyServices.QueryByParkingId(model.PKID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                if (model.PaymentChannel == PaymentChannel.AliPay)
                {
                    AliPayApiConfig config = AliPayApiConfigServices.QueryAliPayConfig(company.CPID);
                    if (config == null)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5ParkingPaymentError", "获取支付宝配置信息失败[0001]", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取支付宝配置信息失败!" }));
                    }
                    if (!config.Status)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5ParkingPaymentError", "该支付宝暂停使用", "单位编号:" + config.CompanyID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用支付宝支付!" }));
                    }
                    AliPayApiConfig requestConfig = AliPayApiConfigServices.QueryAliPayConfig(GetRequestCompanyId);
                    if (requestConfig == null)
                    {
                        throw new MyException("获取请求单位微信配置失败");
                    }

                    if (config.CompanyID != requestConfig.CompanyID)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "支付的支付宝配置和请求的支付配置不匹配,不能支付", string.Format("支付单位:{0},请求单位:{1}", config.CompanyID, requestConfig.CompanyID), LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "支付的支付宝配置和请求的支付配置不匹配,不能支付!" }));
                    }
                    model.AccountID      = LoginAccountID;
                    model.CardId         = string.Empty;
                    model.PayeeChannel   = PaymentChannel.AliPay;
                    model.PaymentChannel = PaymentChannel.AliPay;
                    model.PayeeUser      = config.SystemName;
                    model.PayeeAccount   = config.PayeeAccount;
                    model.PayAccount     = string.Empty;
                    model.Payer          = model.PayAccount;
                    model.CompanyID      = config.CompanyID;
                }
                else
                {
                    WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                    if (config == null)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5ParkingPaymentError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                    }
                    if (!config.Status)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("H5ParkingPaymentError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                    }
                    WX_ApiConfig requestConfig = WXApiConfigServices.QueryWXApiConfig(GetRequestCompanyId);
                    if (requestConfig == null)
                    {
                        throw new MyException("获取请求单位微信配置失败");
                    }

                    if (config.CompanyID != requestConfig.CompanyID)
                    {
                        ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "微信支付配置和当前请求微信支付配置不匹配,不能支付", string.Format("支付单位:{0},请求单位:{1}", config.CompanyID, requestConfig.CompanyID), LogFrom.WeiXin);
                        return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信支付配置和当前请求微信支付配置不匹配,不能支付!" }));
                    }
                    model.PayeeUser      = config.SystemName;
                    model.PayeeAccount   = config.PartnerId;
                    model.PayAccount     = string.Empty;
                    model.Payer          = model.PayAccount;
                    model.AccountID      = LoginAccountID;
                    model.CardId         = model.AccountID;
                    model.PayeeChannel   = PaymentChannel.WeiXinPay;
                    model.PaymentChannel = PaymentChannel.WeiXinPay;
                    model.CompanyID      = config.CompanyID;
                }

                bool result = OnlineOrderServices.Create(model);
                if (!result)
                {
                    throw new MyException("生成待缴费订单失败");
                }

                switch (model.PaymentChannel)
                {
                case PaymentChannel.WeiXinPay:
                {
                    return(RedirectToAction("ParkCarPayment", "H5WeiXinPayment", new { orderId = model.OrderID }));
                }

                case PaymentChannel.AliPay:
                {
                    return(RedirectToAction("AliPayRequest", "H5Order", new { orderId = model.OrderID, requestSource = 1 }));
                }

                default: throw new MyException("支付方式错误");
                }
            }
            catch (MyException ex)
            {
                return(RedirectToAction("ComputeParkingFee", "H5CodeParkPayment", new { licensePlate = model.PlateNo, RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("H5ParkingPaymentError", "保存临停缴费订单失败", ex, LogFrom.WeiXin);
                return(RedirectToAction("ComputeParkingFee", "H5CodeParkPayment", new { licensePlate = model.PlateNo, RemindUserContent = "提交支付失败" }));
            }
        }
コード例 #29
0
        public void Index()
        {
            //TxtLogServices.WriteTxtLogEx("AliPayNotify", Request.Url.AbsoluteUri + ":" + Request.Form.ToString());

            try
            {
                string notify_time         = Request.Params["notify_time"];
                string notify_type         = Request.Params["notify_type"];
                string notify_id           = Request.Params["notify_id"];
                string app_id              = Request.Params["app_id"];
                string charset             = Request.Params["charset"];
                string version             = Request.Params["version"];
                string sign_type           = Request.Params["sign_type"];
                string sign                = Request.Params["sign"];
                string trade_no            = Request.Params["trade_no"];
                string out_trade_no        = Request.Params["out_trade_no"];
                string out_biz_no          = Request.Params["out_biz_no"];
                string buyer_id            = Request.Params["buyer_id"];
                string buyer_logon_id      = Request.Params["buyer_logon_id"];
                string seller_id           = Request.Params["seller_id"];
                string seller_email        = Request.Params["seller_email"];
                string trade_status        = Request.Params["trade_status"];
                string total_amount        = Request.Params["total_amount"];
                string receipt_amount      = Request.Params["receipt_amount"];
                string invoice_amount      = Request.Params["invoice_amount"];
                string buyer_pay_amount    = Request.Params["buyer_pay_amount"];
                string point_amount        = Request.Params["point_amount"];
                string refund_fee          = Request.Params["refund_fee"];
                string subject             = Request.Params["subject"];
                string gmt_create          = Request.Params["gmt_create"];
                string gmt_payment         = Request.Params["gmt_payment"];
                string gmt_refund          = Request.Params["gmt_refund"];
                string gmt_close           = Request.Params["gmt_close"];
                string fund_bill_list      = Request.Params["fund_bill_list"];
                string passback_params     = Request.Params["passback_params"];
                string voucher_detail_list = Request.Params["voucher_detail_list"];


                OnlineOrder order = OnlineOrderServices.QueryByOrderId(decimal.Parse(out_trade_no));
                if (order == null)
                {
                    throw new Exception("获取订单失败");
                }

                if (!CheckNotifySign(order.CompanyID))
                {
                    throw new Exception("验证签名失败");
                }

                TxtLogServices.WriteTxtLogEx("AliPayNotify", "验签成功:out_trade_no:" + out_trade_no);
                DateTime payTime = DateTime.Now;
                DateTime.TryParse(gmt_payment, out payTime);
                WeiXinInerface.ParkingFeeService.DeleteParkingFee(order.PlateNo + order.PKID);
                bool result = OnlineOrderServices.PaySuccess(decimal.Parse(out_trade_no), trade_no, payTime, buyer_id);
                if (!result)
                {
                    throw new Exception("修改订单状态未已支付失败");
                }

                TxtLogServices.WriteTxtLogEx("AliPayNotify", string.Format("AliPayShowResult:{0}支付完成", trade_no));
                Response.Write("success");
                Response.End();
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("AliPayNotify", "支付通知出错", ex, LogFrom.AliPay);
                Response.Write("fail");
                Response.End();
            }
        }
コード例 #30
0
        public ActionResult SubmitBookingPayment(OnlineOrder model)
        {
            try
            {
                BaseCompany company = CompanyServices.QueryByParkingId(model.PKID);
                if (company == null)
                {
                    throw new MyException("获取单位信息失败");
                }

                WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID);
                if (config == null)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" }));
                }
                if (!config.Status)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" }));
                }
                if (config.CompanyID != WeiXinUser.CompanyID)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "微信用户所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, WeiXinUser.CompanyID), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信用户所属公众号和当前公众号不匹配,不能支付!" }));
                }
                if (CurrLoginWeiXinApiConfig == null || config.CompanyID != CurrLoginWeiXinApiConfig.CompanyID)
                {
                    string loginCompanyId = CurrLoginWeiXinApiConfig != null ? CurrLoginWeiXinApiConfig.CompanyID : string.Empty;
                    ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "车场所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin);
                    return(RedirectToAction("Index", "ErrorPrompt", new { message = "车场所属公众号和当前公众号不匹配,不能支付!" }));
                }

                model.OrderID    = IdGenerator.Instance.GetId();
                model.Status     = OnlineOrderStatus.WaitPay;
                model.PayAccount = WeiXinUser.OpenID;
                model.Payer      = WeiXinUser.OpenID;
                model.PayeeUser  = config.SystemName;
                model.OrderType  = OnlineOrderType.PkBitBooking;
                model.AccountID  = WeiXinUser.AccountID;
                model.OrderTime  = DateTime.Now;
                model.CompanyID  = config.CompanyID;
                bool result = OnlineOrderServices.Create(model);
                if (!result)
                {
                    throw new MyException("生成车位预约订单失败");
                }
                switch (model.PaymentChannel)
                {
                case PaymentChannel.WeiXinPay:
                {
                    return(RedirectToAction("BookingBitNoPayment", "WeiXinPayment", new { orderId = model.OrderID }));
                }

                default: throw new MyException("支付方式错误");
                }
            }
            catch (MyException ex)
            {
                return(PageAlert("SaveBooking", "ParkBitBooking", new { plateNo = model.PlateNo, parkingId = model.PKID, areaId = model.CardId, startTime = model.BookingStartTime, endTime = model.BookingEndTime, RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinWeb", "预约失败", ex, LogFrom.WeiXin);
                return(PageAlert("SaveBooking", "ParkBitBooking", new { plateNo = model.PlateNo, parkingId = model.PKID, areaId = model.CardId, startTime = model.BookingStartTime, endTime = model.BookingEndTime, RemindUserContent = "预约失败" }));
            }
        }