public SimpleResultModel ChangeWorkStatus(ChangeWorkStatusPM paraModel)
 {
     if (paraModel.WorkStatus == null) //检查非空
     {
         return(SimpleResultModel.Conclude(ChangeWorkStatusEnum.WorkStatusError));
     }
     if (paraModel.Id == null) //检查非空
     {
         return(SimpleResultModel.Conclude(ChangeWorkStatusEnum.ClienterError));
     }
     return(SimpleResultModel.Conclude(iClienterProvider.ChangeWorkStatus(paraModel)));
 }
        public SimpleResultModel VoiceCheckCode(SmsParaModel model)
        {
            if (!CommonValidator.IsValidPhoneNumber(model.PhoneNumber))
            {
                return(SimpleResultModel.Conclude(SendCheckCodeStatus.InvlidPhoneNumber));
            }
            var    redis = new RedisCache();
            string msg   = string.Empty;
            string key   = model.Stype == "0" ? RedissCacheKey.PostRegisterInfo_C + model.PhoneNumber : RedissCacheKey.PostForgetPwd_C + model.PhoneNumber;


            object obj = redis.Get <object>(key);

            if (obj == null)
            {
                return(SimpleResultModel.Conclude(SendCheckCodeStatus.CodeNotExists));
            }
            string tempcode = obj.ToString().Aggregate("", (current, c) => current + (c.ToString() + ','));

            bool userStatus = iClienterProvider.CheckClienterExistPhone(model.PhoneNumber);

            if (model.Stype == "0") //注册
            {
                if (userStatus)     //判断该手机号是否已经注册过
                {
                    return(SimpleResultModel.Conclude(SendCheckCodeStatus.AlreadyExists));
                }
                msg = string.Format(SupermanApiConfig.Instance.SmsContentCheckCodeVoice, tempcode, SystemConst.MessageClinenter);
            }
            else //修改密码
            {
                if (!userStatus)
                {
                    return(SimpleResultModel.Conclude(SendCheckCodeStatus.NotExists));
                }
                msg = string.Format(SupermanApiConfig.Instance.SmsContentCheckCodeFindPwdVoice, tempcode, SystemConst.MessageClinenter);
            }
            try
            {
                // 更新短信通道
                Task.Factory.StartNew(() =>
                {
                    SendSmsHelper.SendSmsSaveLogNew(model.PhoneNumber, msg, SystemConst.SMSSOURCE);
                });
                return(SimpleResultModel.Conclude(SendCheckCodeStatus.Sending));
            }
            catch (Exception)
            {
                return(SimpleResultModel.Conclude(SendCheckCodeStatus.SendFailure));
            }
        }
Exemple #3
0
        public SimpleResultModel RegisterStepFirst(string cardNumber, string userName, string idNumber)
        {
            SimpleResultModel result = new SimpleResultModel();

            result.suc = false;

            if (isCardNumberExisted(cardNumber))
            {
                result.msg = "你的厂牌号已经注册过,请直接登陆";
            }
            else
            if (db.ei_specialUsers.Where(u => u.card_no == cardNumber).Count() > 0)
            {
                result.msg = "你的用户处于特殊保护状态,如要注册请联系管理员";
            }
            else
            {
                var emps = db.GetHREmpInfo(cardNumber).ToList();
                if (emps.Count() < 1)
                {
                    result.msg = "你的厂牌在人事系统不存在";
                }
                else
                {
                    var emp = emps.First();
                    if (!userName.Equals(emp.emp_name))
                    {
                        result.msg = "姓名和厂牌不匹配";
                    }
                    else if (!emp.id_code.EndsWith(idNumber))
                    {
                        result.msg = "身份证号后六位不正确";
                    }
                    else if (string.IsNullOrEmpty(emp.email) && string.IsNullOrEmpty(emp.tp))
                    {
                        result.msg = "你在人事系统中没有登记邮箱或者手机号码,不能注册";
                    }
                    else
                    {
                        result.suc   = true;
                        result.msg   = "第一步验证成功";
                        result.extra = JsonConvert.SerializeObject(new { email = emp.email, phone = emp.tp });
                    }
                }
            }

            return(result);
        }
        public SimpleResultModel CheckCode(string PhoneNumber, string type)
        {
            if (!CommonValidator.IsValidPhoneNumber(PhoneNumber))
            {
                return(SimpleResultModel.Conclude(SendCheckCodeStatus.InvlidPhoneNumber));
            }
            var    randomCode = new Random().Next(1000).ToString("D4");
            string msg        = string.Empty;
            string key        = "";
            bool   checkUser  = iClienterProvider.CheckClienterExistPhone(PhoneNumber);

            if (type == "0")   //注册
            {
                if (checkUser) //判断该手机号是否已经注册过
                {
                    return(SimpleResultModel.Conclude(SendCheckCodeStatus.AlreadyExists));
                }
                key = RedissCacheKey.PostRegisterInfo_C + PhoneNumber;
                msg = string.Format(SupermanApiConfig.Instance.SmsContentCheckCode, randomCode, SystemConst.MessageClinenter);
            }
            else //修改密码
            {
                if (!checkUser)
                {
                    //如果骑士不存在
                    return(SimpleResultModel.Conclude(SendCheckCodeStatus.NotExists));
                }
                key = RedissCacheKey.PostForgetPwd_C + PhoneNumber;
                msg = string.Format(SupermanApiConfig.Instance.SmsContentFindPassword, randomCode, SystemConst.MessageClinenter);
            }
            try
            {
                var redis = new RedisCache();
                redis.Add(key, randomCode, DateTime.Now.AddHours(1));

                // 更新短信通道
                Task.Factory.StartNew(() =>
                {
                    SendSmsHelper.SendSendSmsSaveLog(PhoneNumber, msg, SystemConst.SMSSOURCE);
                });
                return(SimpleResultModel.Conclude(SendCheckCodeStatus.Sending));
            }
            catch (Exception)
            {
                return(SimpleResultModel.Conclude(SendCheckCodeStatus.SendFailure));
            }
        }
        public SimpleResultModel PostDistribSubsidy_B(BusiDistribInfoPM mod)
        {
            if (mod.userId <= 0 || mod.price < 0) //判断传入参数是否正常
            {
                return(SimpleResultModel.Conclude(DistribSubsidyStatus.Failed));
            }

            var selResult = iBusinessProvider.GetBusiness(mod.userId);

            if (selResult == null) //商户是否存在
            {
                return(SimpleResultModel.Conclude(DistribSubsidyStatus.Failed));
            }
            int modResult = iBusinessProvider.ModifyWaiMaiPrice(mod.userId, mod.price);

            if (modResult > 0)
            {
                return(SimpleResultModel.Conclude(DistribSubsidyStatus.Success));
            }
            else
            {
                return(SimpleResultModel.Conclude(DistribSubsidyStatus.Failed));
            }
        }