Ejemplo n.º 1
0
        private ReturnMessageModel LoginFun(JObject model)
        {
            var name = model["Name"].ToString().ToLower();
            var pass = model["Pass"].ToString().ToLower();
            var code = model["Code"].ToString().ToLower();

            ReturnMessageModel returnMessage = new ReturnMessageModel();

            if (string.IsNullOrEmpty(code))
            {
                returnMessage.ErrorType      = 3;
                returnMessage.MessageContent = "验证码不能为空";
                return(returnMessage);
            }

            if (code != Vcode)
            {
                returnMessage.ErrorType      = 2;
                returnMessage.MessageContent = "验证码错误";
                return(returnMessage);
            }
            pass = CommonLib.HashEncrypt.BgPassWord(pass);
            BLL_User userBll   = new BLL_User();
            var      UserModel = userBll.LoginUsers(name, pass);

            if (UserModel != null)
            {
                //设置个人信息
                //个人信息类  拓展

                returnMessage.IsSuccess      = true;
                returnMessage.ErrorType      = 1;
                returnMessage.MessageContent = "登录成功";
                return(returnMessage);
            }
            else
            {
                returnMessage.ErrorType      = 0; //可有可无 构造方法已赋值
                returnMessage.MessageContent = "账号密码错误";
                return(returnMessage);
            }
        }