예제 #1
0
        protected override void Seed(DoubleX.Module.Member.MemberContext context)
        {
            var defaultUser = new MemberEntity()
            {
                Account        = "user1",
                Password       = MD5Helper.Get("123456"),
                RealName       = "userA",
                Sex            = EnumHelper.GetValue(EnumSex.±£ÃÜ),
                Email          = "",
                EmailIsVerify  = false,
                Mobile         = "",
                MobileIsVerify = false,
                Credits        = "",
                Birthday       = DateTimeHelper.DefaultDateTime,
                Country        = "",
                Area           = "",
                Address        = "",
                LastLoginIP    = "#",
                LastLoginDt    = DateTimeHelper.DefaultDateTime,
                Balance        = 0,
                Type           = EnumHelper.GetValue(EnumMemberType.Default),
                State          = EnumHelper.GetValue(EnumMemberState.ÆôÓÃ),
                IsDelete       = false,
                CreateId       = Guid.Empty,
                CreateDt       = DateTime.Now,
                LastId         = Guid.NewGuid(),
                LastDt         = DateTime.Now
            };

            context.MemberEntities.AddOrUpdate(
                p => p.Id, defaultUser);
        }
    }
예제 #2
0
 /// <summary>
 /// 获取加密密码
 /// </summary>
 public static string GetPassword(string password)
 {
     if (VerifyHelper.IsEmpty(password))
     {
         return("");
     }
     return(MD5Helper.Get(password));
 }
예제 #3
0
        /// <summary>
        /// 会员注册
        /// </summary>
        /// <param name="account">账号</param>
        /// <param name="email">邮箱</param>
        /// <param name="mobile">手机</param>
        /// <param name="password">密码</param>
        /// <param name="clientIp">客户端ip</param>
        public MemberEntity Regist(string account, string email, string mobile, string password, string nameTag, string clientIp)
        {
            if ((VerifyHelper.IsEmpty(mobile) && VerifyHelper.IsEmpty(email)) || VerifyHelper.IsEmpty(password) || VerifyHelper.IsEmpty(clientIp))
            {
                throw new DefaultException(EnumResultCode.参数错误, "mobile", "email", "password", "clientIp");
            }

            var query = Query(x => x.Account.ToLower().Trim() == account ||
                              (x.Email.ToLower().Trim() == email && x.EmailIsVerify) ||
                              (x.Mobile.ToLower().Trim() == mobile && x.MobileIsVerify));

            if (!VerifyHelper.IsEmpty(query))
            {
                throw new MessageException(EnumMessageCode.该账号己注册);
            }

            var entity = new MemberEntity()
            {
                Account        = VerifyHelper.IsEmpty(email) ? mobile : email,
                Password       = MD5Helper.Get(password),
                RealName       = "",
                NameTag        = nameTag,
                Sex            = EnumHelper.GetValue(EnumSex.保密),
                Email          = email,
                EmailIsVerify  = VerifyHelper.IsEmpty(email) ? false : true,
                Mobile         = mobile,
                MobileIsVerify = VerifyHelper.IsEmpty(mobile) ? false : true,
                Credits        = "",
                Birthday       = DateTimeHelper.DefaultDateTime,
                Country        = "",
                Area           = "",
                Address        = "",
                LastLoginIP    = "#",
                LastLoginDt    = DateTimeHelper.DefaultDateTime,
                //Balance = 0,
                Balance  = 100,
                Type     = EnumHelper.GetValue(EnumMemberType.Default),
                State    = EnumHelper.GetValue(EnumMemberState.启用),
                IsDelete = false,
                CreateId = Guid.Empty,
                CreateDt = DateTime.Now,
                LastId   = Guid.NewGuid(),
                LastDt   = DateTime.Now
            };

            Insert(entity);

            return(entity);
        }
예제 #4
0
        protected override void Seed(DoubleX.Module.Organize.OrganizeContext context)
        {
            var adminModel = new EmployeeEntity()
            {
                Account  = "admin",
                Password = MD5Helper.Get("admin888"),
                IsDelete = false,
                CreateId = Guid.Empty,
                CreateDt = DateTime.Now,
                LastId   = Guid.NewGuid(),
                LastDt   = DateTime.Now
            };

            context.EmployeeEntities.AddOrUpdate(
                p => p.Id,
                adminModel
                );
        }
예제 #5
0
        /// <summary>
        /// 找回密码修改
        /// </summary>
        /// <param name="email">邮箱</param>
        /// <param name="mobile">手机</param>
        /// <param name="password">密码</param>
        /// <param name="clientIp">客户端ip</param>
        public MemberEntity MemberForgetPwd(string email, string mobile, string password, string clientIp)
        {
            if ((VerifyHelper.IsEmpty(mobile) && VerifyHelper.IsEmpty(email)) || VerifyHelper.IsEmpty(password) || VerifyHelper.IsEmpty(clientIp))
            {
                throw new DefaultException(EnumResultCode.参数错误, "mobile", "email", "password", "clientIp");
            }

            var query = Query(x => (x.Email.ToLower().Trim() == email && x.EmailIsVerify) ||
                              (x.Mobile.ToLower().Trim() == mobile && x.MobileIsVerify));

            if (VerifyHelper.IsEmpty(query))
            {
                throw new MessageException(EnumMessageCode.未找到账号信息);
            }

            var entity = query.FirstOrDefault();

            entity.Password = MD5Helper.Get(password);
            entity.LastDt   = DateTime.Now;
            Update(entity);

            return(entity);
        }