Exemplo n.º 1
0
        /// <summary>
        /// 更新订单状态信息为付款中并生成流水号
        /// </summary>
        /// <param name="backPayAccBanlanEntity"></param>
        /// <param name="feeAmount">实际要支付的价格</param>
        /// <returns></returns>
        public static bool UpdateOrderStatusByXFResultToPayment(BackPayAccBalanceEntity backPayAccBanlanEntity, out string logInfo)
        {
            List <DB.Model.M_OrderInfo> orderInfoList = new List <DB.Model.M_OrderInfo>();

            DB.Model.M_OrderInfo orderInfo = new DB.Model.M_OrderInfo();
            decimal amountCount            = 0;

            logInfo = string.Empty;
            if (!string.IsNullOrEmpty(backPayAccBanlanEntity.OrderNo))//判断子订单ID是否为空或null,不为空代表是子订单支付的
            {
                orderInfo = new SQLEntityHelper().GetOrderInfoByOrderSn(backPayAccBanlanEntity.OrderNo);
                orderInfoList.Add(orderInfo);
            }
            else //是统一下单ID下单的
            {
                orderInfoList = new SQLEntityHelper().GetOrderInfoListByOrderUnifySn(backPayAccBanlanEntity.UnifyOrderNo);
            }
            //准备完成
            if (orderInfoList != null && orderInfoList.Count > 0)
            {
                foreach (var item in orderInfoList)
                {
                    amountCount += item.OrderAmount;
                }
                if (amountCount != Convert.ToDecimal(backPayAccBanlanEntity.OrderMoney))
                {
                    logInfo = "与消费系统校验金额存在差异,请检查消费系统的付款流水。订单流水号:" + backPayAccBanlanEntity.TradeNo + "订单编号:" + backPayAccBanlanEntity.UnifyOrderNo + " | " + backPayAccBanlanEntity.OrderNo + " | " + amountCount + " | " + backPayAccBanlanEntity.OrderMoney + ",与XF系统资金结算出错,错误信息:消费系统返回的订单金额对账不相等,请立即检查流水号相应订单";
                    throw new Exception("1001");//向上抛出自定义错误信息1001代表支付流程出错,让外面try-catch到错误信息后执行更新订单状态信息为异常操作
                }
                else//校对成功
                {
                    //开始事务
                    DB.Model.M_Payment paymentInfo = new DB.BLL.MY_Bll(DBEnum.Slave).GetModel <DB.Model.M_Payment>(" PayID=20 ", null);
                    if (new DB.BLL.MY_Bll(DBEnum.Master).UpdateOrderInfoFromXFPayment(orderInfoList, Convert.ToDecimal(backPayAccBanlanEntity.OrderMoney), backPayAccBanlanEntity.TradeNo, Convert.ToDateTime(backPayAccBanlanEntity.TradeTime), paymentInfo, backPayAccBanlanEntity.UnifyOrderNo, backPayAccBanlanEntity.OrderNo, WebLoginHelper.GetUserPhone(), backPayAccBanlanEntity.CpySysID, backPayAccBanlanEntity.CpyName))
                    {
                        return(true);//如果更新订单信息成功,直接返回true
                    }
                    else
                    {
                        logInfo = "数据库更新从消费系统返回的记录时发生错误,事务进行回滚,请客服介入,手动更改订单信息,执行订单支付通过操作。订单流水号:" + backPayAccBanlanEntity.TradeNo + "订单编号:" + backPayAccBanlanEntity.UnifyOrderNo + " | " + backPayAccBanlanEntity.OrderNo + ",数据库更新从消费系统返回的记录时发生错误,事务进行回滚,请客服介入,手动更改订单信息,执行订单支付通过操作";
                    }
                }
            }
            else//订单信息都查不到了,直接返回错误信息就行
            {
                logInfo = "获取到消费系统返回的数据内容后,查询本地订单信息不存在,请核实消费系统进行扣款的订单ID是否正确,订单流水号:" + backPayAccBanlanEntity.TradeNo + "订单编号:" + backPayAccBanlanEntity.UnifyOrderNo + " | " + backPayAccBanlanEntity.OrderNo + ",与XF系统资金结算出错,错误信息:消费系统返回的订单号找不到对应的订单信息,请立即检查流水号相应订单";
            }
            if (!string.IsNullOrEmpty(logInfo))
            {
                ToolHelper.WriteLogInfoToLocalText(logInfo);
            }                                                                                   //判读日志不为空,写文本日志,否则不进行任何操作,最后返回false
            return(false);
        }
Exemplo n.º 2
0
        public void BindDdl()
        {
            string url      = WebToolHelper.GetProfilesUrl();
            var    rollInfo = new DB.BLL.MY_Bll(DBEnum.Slave).GetModelList("SELECT R.*,CONCAT(@PathAdd,R.Picture) AS NPicture FROM M_Roll AS R WHERE R.IsEnable =1 ORDER BY R.OrderBy ASC", new { PathAdd = url }).Select(info => { return(new { info.NPicture, info.TargetSysID, info.TargetUrl }); });

            repeaterNoticeList.DataSource = rollInfo;
            repeaterNoticeList.DataBind();
            string cpyName = WebLoginHelper.GetSimpleName();

            if (!string.IsNullOrEmpty(cpyName))
            {
                cpyNameSpan.InnerHtml = cpyName + "商品专供";
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 对电话号码与验证码进行校验
 /// </summary>
 /// <param name="phone">电话</param>
 /// <param name="code">验证码</param>
 /// <param name="resWrite">返回信息</param>
 /// <returns></returns>
 public static bool TelphoneModalCount(string phone, string code, out string resWrite)
 {
     resWrite = string.Empty;
     if (!string.IsNullOrEmpty(phone) && !string.IsNullOrEmpty(code))
     {
         M_TelPhoneCode telPhoneInfo = new DB.BLL.MY_Bll(DBEnum.Slave).GetModel <M_TelPhoneCode>(" Telphone=@_Telphone ", new { _Telphone = phone });
         if (telPhoneInfo != null)
         {
             if (telPhoneInfo.Code == code)
             {
                 if (telPhoneInfo.LoginTimes < 10)
                 {
                     long ss = ToolHelper.TimeQuantum(DateTime.Now, telPhoneInfo.CreatTime);
                     if (ToolHelper.TimeQuantum(DateTime.Now, telPhoneInfo.CreatTime) < 180000)
                     {
                         return(true);
                     }
                     else
                     {
                         resWrite = "验证码已失效,请重新获取";
                     }
                 }
                 else
                 {
                     resWrite = "验证码错误次数已达上限,请重新获取";
                 }
             }
             else
             {
                 resWrite = "验证码错误";
                 telPhoneInfo.LoginTimes++;
                 new DB.BLL.MY_Bll(DBEnum.Master).UpdateModel <M_TelPhoneCode>(" Telphone=@_Telphone ", new { _Telphone = phone, LoginTimes = telPhoneInfo.LoginTimes });
             }
         }
         else
         {
             resWrite = "验证码失效,请重新获取验证码";
         }
     }
     else
     {
         resWrite = "短信验证失败,验证码参数不正确";
     }
     return(false);
 }
Exemplo n.º 4
0
 private void BindGrid()
 {
     try
     {
         string goodsSysID = Request.QueryString["goodsId"].Trim();
         string url        = WebToolHelper.GetProfilesUrl();
         if (!string.IsNullOrEmpty(goodsSysID))
         {
             StringBuilder strSql = new StringBuilder();
             strSql.Append(" SELECT *,CONCAT(@PathAdd,GLY.ImgUrl) AS NImgUrl FROM M_GoodsGallery AS GLY WHERE GLY.GoodsID =@GoodsID ");
             object dt = new DB.BLL.MY_Bll(DBEnum.Slave).GetModelList(strSql.ToString(), new { PathAdd = url, GoodsID = goodsSysID }).Select(info => { return(new { info.NImgUrl }); });
             repeaterGoodsPicetureShow.DataSource = dt;
             repeaterGoodsPicetureShow.DataBind();
             strSql.Clear();
             strSql.Append(" SELECT G.GoodsID,G.GoodsSn,G.GoodsName,G.BrandID,G.Weight,G.GoodsBrief,G.GoodsDesc,G.MarketPrice,G.ShopPrice,G.QuotaNumber,G.GoodsNumber,B.BrandName,S.SuppliersName,C.CateName,G.SaleNumber,FT.FareTime,");
             strSql.Append(" CASE WHEN FT.FareType=10 THEN '按件数计费' WHEN FT.FareType= 20 THEN '按重量计费' WHEN FT.FareType= 30 THEN '按体积计费' ELSE '未指定运费模板' END NFareType , ");
             strSql.Append(" CONCAT('默认运费:',ROUND(FC.FirstCount),'(件/公斤)内:',FC.FirstMoney,'元,','续:',FC.ContinueMoney,'/(件/公斤)')  AS NFareInfo ");
             strSql.Append(" FROM M_Goods AS G ");
             strSql.Append(" LEFT JOIN M_Brand AS B ON B.BrandID = G.BrandID  ");
             strSql.Append(" LEFT JOIN M_Category AS C ON G.CateID = C.CateID ");
             strSql.Append(" LEFT JOIN M_Suppliers AS S ON S.SuppliersID = G.SuppliersID ");
             strSql.Append(" LEFT JOIN M_FareTemplate AS FT ON G.FareSysID= FT.FareSysID ");
             strSql.Append(" LEFT JOIN M_FareCarry AS FC ON G.FareSysID =FC.FareSysID ");
             strSql.Append(" WHERE G.GoodsID = @GoodsID AND G.IsDelete=0 ORDER BY FC.IsDefault DESC LIMIT 1 ");
             IEnumerable <dynamic> goodsInfo = new DB.BLL.MY_Bll(DBEnum.Slave).GetModelList(strSql.ToString(), new { GoodsID = goodsSysID });
             string fileUrl = WebToolHelper.GetProfilesUrl();
             foreach (var item in goodsInfo)
             {
                 item.GoodsDesc = WebToolHelper.ReplaceImgUrl_1(item.GoodsDesc.ToString(), fileUrl);
             }
             repeaterGoodsInfo.DataSource = goodsInfo.Select(info => { return(new { info.GoodsID, info.GoodsSn, info.GoodsName, info.GoodsDesc, info.MarketPrice, info.ShopPrice, info.GoodsNumber, info.BrandName, info.SuppliersName, info.SaleNumber, info.CateName, info.GoodsBrief, Weight = info.Weight <= 0.1 ? "小于 1":info.Weight, info.NFareType, info.NFareInfo, info.FareTime, info.QuotaNumber, NQuotaNumber = (info.QuotaNumber <= 0) ? "不限购":"件" }); });
             repeaterGoodsInfo.DataBind();
         }
     }
     catch
     {
         Response.Redirect("/web/mall_Index.aspx", false);
     }
 }
Exemplo n.º 5
0
        public void BindDdl()
        {
            string parentCateIDStr = string.Empty;

            if (HttpRuntime.Cache["parentCateID"] == null)
            {
                string url    = WebToolHelper.GetProfilesUrl();
                string strSql = "SELECT *, CONCAT(@AddPath,ShowImage) AS NPicture  FROM M_Category WHERE IsDelete = 0 AND IsEnable =1 AND ShowInNav =1 AND ParentID = 0";
                IEnumerable <dynamic> info      = new DB.BLL.MY_Bll(DBEnum.Slave).GetModelList(strSql, new { AddPath = url });
                StringBuilder         innerText = new StringBuilder();
                foreach (var item in info)
                {
                    innerText.Append("<li name=\"parentCateID\"><a href=\"javascript:void(0);\" mydata=\"" + item.CateID + "\" > " + item.CateName + " </a></li>");
                }
                parentCateIDStr = innerText.ToString();
                HttpRuntime.Cache.Insert("parentCateID", parentCateIDStr, null, DateTime.Now.AddMinutes(60), System.Web.Caching.Cache.NoSlidingExpiration);
            }
            else
            {
                parentCateIDStr = Convert.ToString(HttpRuntime.Cache["parentCateID"]);
            }
            gridTopCategoryList.InnerHtml = parentCateIDStr;
        }
Exemplo n.º 6
0
 /// <summary>
 /// 管理员进行手动同步流水状态
 /// </summary>
 /// <param name="tradeSysID"></param>
 /// <param name="resMsg"></param>
 /// <returns></returns>
 public static bool GetOrderInfoPaymentStatusSync(string tradeSysID, out string resMsg)
 {
     resMsg = string.Empty;
     DB.Model.M_OrderTrade orderTradeInfo = new DB.BLL.MY_Bll(DBEnum.Slave).GetModel <DB.Model.M_OrderTrade>(" TradeSysID=@_TradeSysID ", new { _TradeSysID = tradeSysID });
     if (orderTradeInfo != null)
     {
         DSMT_TAE_ServiceSoapClient taeCilent = new DSMT_TAE_ServiceSoapClient();
         GetQueryTradeStatusEntity  queryTradeStatusEntity = null;
         VerifyHelper verifyHelper = new VerifyHelper();
         BackQueryTradeStatusEntity backQueryTradeStatusEntity = null;
         DateTime nowTime   = DateTime.Now;
         string   outOpenID = string.Empty;
         queryTradeStatusEntity     = new GetQueryTradeStatusEntity();                                        //初始化
         backQueryTradeStatusEntity = null;
         if (!string.IsNullOrEmpty(orderTradeInfo.TradeNo) && !string.IsNullOrEmpty(orderTradeInfo.CpySysID)) //判断流水号公司ID都存在的情况下调用XF接口,并且流水号的创建时间超时10分钟
         {
             queryTradeStatusEntity.CpySysID  = orderTradeInfo.CpySysID;
             queryTradeStatusEntity.TradeNo   = orderTradeInfo.TradeNo;
             queryTradeStatusEntity.TradeTime = Convert.ToString(orderTradeInfo.PayTime); //流水时间是XF系统返回给我的时间
             verifyHelper.EncryptPmtEntity(queryTradeStatusEntity);                       //加密加签
             try
             {
                 backQueryTradeStatusEntity = taeCilent.QueryTradeStatus(queryTradeStatusEntity); //调用XF接口
             }
             catch (Exception e)                                                                  //通讯异常
             {
                 resMsg = "与XF系统扣款状态同步查询出错,错误信息:" + e.Message;
             }
             if (verifyHelper.CheckPmtSign(ref backQueryTradeStatusEntity))                                                //尝试解签,解签失败的话不执行任何代码
             {
                 if (backQueryTradeStatusEntity.TradeType == "0")                                                          //交易类型是0
                 {
                     if (backQueryTradeStatusEntity.TradeStatus == "10" || backQueryTradeStatusEntity.TradeStatus == "20") //交易状态10-已完成20-已撤销(余额不足付款失败?)30-待同步40-交易信息不存在
                     {
                         if (new DB.BLL.MY_Bll(DBEnum.Master).UpdateOrderStatusByXFPaymentToComfirm(ToolHelper.ConventToDecimal(backQueryTradeStatusEntity.TradeMoney, 999), orderTradeInfo.TradeSysID, backQueryTradeStatusEntity.TradeStatus, out outOpenID))
                         {
                             //WeChatAPI.SendMsg("付款审核成功", "您有一笔订单流水付款审核已通过,正等待仓库发货", outOpenID);
                             return(true);
                         }
                     }
                     else if (backQueryTradeStatusEntity.TradeStatus == "40")
                     {
                         resMsg = "与XF系统扣款状态同步查询出错,错误信息:XF系统该笔流水号信息不存在";
                     }
                     else if (backQueryTradeStatusEntity.TradeStatus == "30")
                     {
                         resMsg = "XF系统尚未同步,扣款尚未完成";
                     }
                 }
                 else
                 {
                     resMsg = "XF系统返回的数据有误,返回的流水类型是退款流水";
                 }
             }
             else
             {
                 resMsg = "XF系统返回的解签数据出错";
             }
         }
         else
         {
             resMsg = "该流水号数据存在问题";
         }
     }
     else
     {
         resMsg = "该流水号数据存在问题";
     }
     return(false);
 }
Exemplo n.º 7
0
        /// <summary>
        /// 发送手机验证码
        /// </summary>
        /// <param name="telPhone">手机号码</param>
        /// <param name="note">提示消息</param>
        public static string GetTelphoneCode(string telPhone, string note)
        {
            string resStrCode = string.Empty;

            if (MetarnetRegex.IsMobilePhone(telPhone))
            {
                DB.Model.M_TelPhoneCode newTelCode = new DB.BLL.MY_Bll(DBEnum.Slave).GetModel <DB.Model.M_TelPhoneCode>("Telphone=@_Telphone", new { _Telphone = telPhone });
                int randomCode = new Random().Next(100000, 999999);//随机生成6位数的随机数
                if (newTelCode == null)
                {
                    newTelCode            = new DB.Model.M_TelPhoneCode();
                    newTelCode.Telphone   = telPhone;
                    newTelCode.Code       = randomCode.ToString();
                    newTelCode.CreatTime  = DateTime.Now;
                    newTelCode.LoginTimes = 0;
                    if (new DB.BLL.MY_Bll(DBEnum.Master).AddModel(newTelCode))
                    {
                        string smsurl = "http://utf8.sms.webchinese.cn/?";
                        smsurl += "Uid=llkj&Key=llkjbyflood&";
                        smsurl += "smsMob=" + telPhone + "&smsText=" + note + ",您的验证码:" + randomCode;
                        string resStr = string.Empty;
                        if (SendSMS.GetHtmlFromUrl(smsurl, out resStr))
                        {
                            resStrCode = "SUCCESS";
                        }
                        else
                        {
                            resStrCode = "ERR,发送失败,请重试";
                            ToolHelper.WriteLogInfoToLocalText(resStr);
                        }
                    }
                    else
                    {
                        resStrCode = "ERR,发送失败,请重试";
                    }
                }
                else//数据库已经存在这条数据
                {
                    if (DateTime.Now < newTelCode.CreatTime.AddMinutes(1))//间隔时间小于1分钟
                    {
                        resStrCode = "ERR,获取验证码的时间间隔为1分钟";
                    }
                    else
                    {
                        newTelCode.Code       = randomCode.ToString();
                        newTelCode.CreatTime  = DateTime.Now;
                        newTelCode.LoginTimes = 0;//更新验证码的时候归零次数
                        if (new DB.BLL.MY_Bll(DBEnum.Master).UpdateModel <DB.Model.M_TelPhoneCode>(" Telphone=@Telphone ", newTelCode))
                        {
                            string smsurl = "http://utf8.sms.webchinese.cn/?";
                            smsurl += "Uid=llkj&Key=llkjbyflood&";
                            smsurl += "smsMob=" + telPhone + "&smsText=" + note + ",您的验证码:" + randomCode;
                            string resStr = string.Empty;
                            if (SendSMS.GetHtmlFromUrl(smsurl, out resStr))
                            {
                                resStrCode = "SUCCESS";
                            }
                            else
                            {
                                resStrCode = "ERR,发送失败,请重试";
                            }
                        }
                        else
                        {
                            resStrCode = "ERR,发送失败,请重试";
                        }
                    }
                }
            }
            else
            {
                resStrCode = "提示:不是合法的手机号码";
            }
            return(resStrCode);
        }