示例#1
0
        public Result RegisterAccount([FromBody] RegisterDTO dto)
        {
            Result result = new Result()
            {
                code = 1
            };

            try
            {
                #region 验证
                if (string.IsNullOrEmpty(dto.FAccount) || string.IsNullOrEmpty(dto.FPwd))
                {
                    result.code    = 0;
                    result.message = "用户名或密码不可为空";
                    return(result);
                }
                if (string.IsNullOrEmpty(dto.FMobile))
                {
                    result.code    = 0;
                    result.message = "手机号码不可为空";
                    return(result);
                }
                //用户名是否已存在
                if (RegisterBll.CheckAccount(dto.FAccount))
                {
                    result.code    = 0;
                    result.message = "该用户名已存在";
                    return(result);
                }
                //判断昵称是否已存在
                if (RegisterBll.CheckNickName(dto.FNickName))
                {
                    result.code    = 0;
                    result.message = "该昵称已存在";
                    return(result);
                }
                if (RegisterBll.CheckMobile(dto.FMobile))
                {
                    result.code    = 0;
                    result.message = "该手机号已存在";
                    return(result);
                }
                #endregion

                EMobileUser registerInfo = Mapper.Map <RegisterDTO, EMobileUser>(dto);

                registerInfo.FPwd     = EncryptUtils.MD5(registerInfo.FPwd.Trim().ToLower()).ToLower();
                registerInfo.FAddTime = DateTime.Now;
                registerInfo.SaveOnSubmit();
            }
            catch (Exception ex)
            {
                LogService.Default.Fatal("提交注册申请报错:" + ex.Message);
                result.code    = 0;
                result.message = "提交申请失败!请联系客服";
            }

            return(result);
        }
示例#2
0
        public Result CheckAccount(string FAccount)
        {
            Result result = new Result()
            {
                code = 1
            };

            result.@object = RegisterBll.CheckAccount(FAccount) ? 1 : 0;

            return(result);
        }