Exemple #1
0
        /// <summary>
        /// 生成订单号
        /// </summary>
        /// <param name="payType">充值类型</param>
        /// <param name="merId">商户号</param>
        /// <param name="money">金额(单位:分)</param>
        /// <param name="orderId">订单号</param>
        /// <param name="feeConfigId">资费配置Id(赠送)</param>
        /// <param name="brief">备注</param>
        /// <param name="userType"></param>
        /// <returns></returns>
        protected virtual bool GetOrderId(int payType, string merId, int money, out string orderId, int feeConfigId = 0, string brief = "", int userType = 0)
        {
            orderId = string.Empty;

            string name = string.Empty;
            int    fee  = 0;

            if (!string.IsNullOrEmpty(merId) && payType > 0 &&
                GetOrderFee(payType, money, out name, out fee, userType))
            {
                try
                {
                    RechargeInfo model = new RechargeInfo();
                    model                  = GetLogInfo(model) as RechargeInfo;
                    model.MerchantId       = merId;
                    model.FOrderId         = "";
                    model.Name             = name;
                    model.UserId           = 0;
                    model.UserName         = currentUser.UserName;
                    model.NickName         = "";
                    model.Fee              = fee;
                    model.RebateFee        = 0;
                    model.RebateExpression = "";
                    model.Balance          = 0;
                    model.Cash             = fee;
                    model.Integral         = 0;
                    model.PayType          = payType;
                    model.PayMobile        = "";
                    model.SpNumber         = "";
                    model.SMSOrder         = "";
                    model.MerchantPrivate  = "";
                    model.MerchantExpand   = "";
                    model.Brief            = brief;
                    model.Status           = (int)Constants.Status.no;
                    model.CompleteTime     = DateTime.Now;
                    model.AddTime          = DateTime.Now;
                    model.PromotionCode    = HeaderInfo.PromotionCode;

                    int          result       = 0;
                    RechargeInfo rechargeInfo = _rechargeService.Generate(model, (userType == 0 ? feeConfigId : 0), (int)Constants.PayType.sms, out result);
                    if (result == (int)ErrorMessage.成功 && rechargeInfo != null)
                    {
                        orderId = rechargeInfo.OrderId;
                    }
                }
                catch (Exception ex)
                {
                    Log(ex, "");
                }
            }

            return(!string.IsNullOrEmpty(orderId));
        }