예제 #1
0
    private void OnSendButtonClick()
    {
        if (input_Phone.text == "" || input_Phone.text == null)
        {
            hint.gameObject.SetActive(true);
            hint.text = "请输入手机号";
            StartCoroutine(Dealy());
            //Debug.Log("请输入手机号");
            return;
        }
        string patten = @"^1\d{10}$";

        if (Regex.IsMatch(input_Phone.text, patten) == false)
        {
            hint.gameObject.SetActive(true);
            hint.text = "手机号格式错误";
            StartCoroutine(Dealy());
            //Debug.Log("手机号格式错误");
            return;
        }

        m_VerCode = Random.Range(111111, 999999).ToString();
        AliyunSMS.sendSms(input_Phone.text, m_VerCode);
        hint.gameObject.SetActive(true);
        hint.text = "短信发送成功";
        StartCoroutine(Dealy());
        //Debug.Log("短信发送成功");
        txt_CountDown.gameObject.SetActive(true);
        txt_CountDown.text = "60S";
        btn_Send.gameObject.SetActive(false);
        m_IsSend = true;
    }
        /// <summary>
        /// 更新订单状态
        /// add by fruitchan
        /// 2017-1-18 20:04:20
        /// </summary>
        /// <param name="orderNo">订单号</param>
        /// <param name="otherNo">第三方订单号</param>
        /// <returns>更改订单是否成功</returns>
        private bool UpdateOrderState(string orderNo, string otherNo)
        {
            int       result    = 0;
            OrderItem orderItem = OperateContext.Current.BLLSession.IOrderItemBLL.GetListBy(m => m.OrderNo == orderNo).FirstOrDefault();
            OrderInfo order     = OperateContext.Current.BLLSession.IOrderInfoBLL.GetListBy(m => m.ID == orderItem.OrderId).FirstOrDefault();
            var       houseCode = Common.CouponHelper.Get8LCode();
            var       queryObj  = OperateContext.Current.BLLSession.IOrderInfoBLL.GetListBy(h => h.CouponCode.Equals(houseCode)).FirstOrDefault();

            while (queryObj != null)
            {
                houseCode = Common.CouponHelper.Get8LCode();
                queryObj  = OperateContext.Current.BLLSession.IOrderInfoBLL.GetListBy(h => h.CouponCode.Equals(houseCode)).FirstOrDefault();
            }
            if (orderItem != null && orderItem.State == 0 && order != null && (order.State == 0 || order.State == 1))
            {
                // 子订单
                orderItem.State   = 1;
                orderItem.OtherNo = otherNo;
                orderItem.PayTime = DateTime.Now;

                result = OperateContext.Current.BLLSession.IOrderItemBLL.Modify(orderItem, "State", "OtherNo", "PayTime");

                if (result == 1)
                {
                    // 主订单
                    order.State          = orderItem.BalancePayment == 0 ? 2 : 1;
                    order.BalancePayment = orderItem.BalancePayment;
                    order.Price          = order.TotalPrice - order.BalancePayment;
                    order.OtherNo        = otherNo;
                    order.CouponCode     = houseCode;
                    result = OperateContext.Current.BLLSession.IOrderInfoBLL.Modify(order, "State", "Price", "BalancePayment", "OtherNo", "CouponCode");
                }

                if (result == 1 && orderItem.BalancePayment == 0)
                {
                    // 更新房源购买数量
                    HouseInfo houseInfo = OperateContext.Current.BLLSession.IHouseInfoBLL.GetListBy(m => m.ID == order.HouseInfoID).FirstOrDefault();

                    if (houseInfo != null)
                    {
                        houseInfo.BuyNum += 1;
                        OperateContext.Current.BLLSession.IHouseInfoBLL.Modify(houseInfo, "BuyNum");
                    }
                }
            }

            if (result == 1)
            {
                // 发送订单短信
                AliyunSMS.SendOrderSMS(order.LandlordPhone, order.HouseTitle, order.StartDate.ToString("yyyy-MM-dd"), order.EndDate.ToString("yyyy-MM-dd"), order.PersonNum.ToString(), order.Username, order.UserPhone);
                //发送顾客订单短信
                var houseInfo = OperateContext.Current.BLLSession.IHouseInfoBLL.GetListBy(h => h.ID == order.HouseInfoID).FirstOrDefault();
                AliyunSMS.SendOrderSMSByUser(order.UserPhone, order.Username, order.StartDate.ToString("yyyy-MM-dd"), order.EndDate.ToString("yyyy-MM-dd"), houseInfo.ShopName, order.PersonNum.ToString(), order.HouseTitle, houseCode, order.LandlordPhone);
            }

            return(result == 1);
        }
예제 #3
0
        public ActionResult CheckAuthCode(string phoneNo, string authCode)
        {
            string status = "fail";
            string msg    = null;

            // 校验手机号
            if (String.IsNullOrWhiteSpace(phoneNo) || !Validate.ValidatePhone(phoneNo))
            {
                msg = "手机号输入错误,请重新输入!";
            }

            if (msg == null)
            {
                if (Session["AuthCode"] != null && Session["AuthCode"].ToString().ToLower() == authCode.ToLower())
                {
                    string smscode = "";
                    Random rand    = new Random();
                    for (int i = 0; i < 4; i++)
                    {
                        smscode += rand.Next(0, 10);
                    }

                    Session["SmsCode"] = new Model.FormatModel.PhoneSmsCode()
                    {
                        PhoneNumber = phoneNo, SmsCode = smscode
                    };


                    UserInfoView userInfo = OperateContext.Current.BLLSession.IUserInfoViewBLL.GetListBy(m => m.PhoneAccount == phoneNo).FirstOrDefault();

                    // 判断用户是否注册
                    if (userInfo != null)
                    {
                        // 判断用户状态
                        if (userInfo.State != 0)
                        {
                            msg = "此账号被禁止登录,请联系客服!";
                        }
                        else
                        {
                            msg = AliyunSMS.SendLoginAuthSMS(phoneNo, smscode);
                        }
                    }
                    else
                    {
                        msg = AliyunSMS.SendRegisterSMS(phoneNo, smscode);
                    }

                    if (msg == "ok")
                    {
                        status = "ok";
                        msg    = "发送短信成功!";
                    }

#if DEBUG
                    msg = smscode;
#endif
                }
                else
                {
                    msg = "验证码错误!";
                }
            }

            Session["AuthCode"] = null;

            return(OperateContext.Current.RedirectAjax(status, msg, null, null));
        }