Exemplo n.º 1
0
        public TBaseResult <UsersQueryItem> GetPageDataUsers(UsersQueryItem queryItem)
        {
            this.SafetySecretKey = queryItem.SafetySecretKey;
            this.Usable          = queryItem.IsUsable ? BasePluginType.Type.启用 : BasePluginType.Type.卸载;
            var result = new TBaseResult <UsersQueryItem>()
            {
                Code    = (int)EnumCore.CodeType.失败,
                Message = "系统错误",
                TData   = new UsersQueryItem()
            };

            if (string.IsNullOrWhiteSpace(this.SafetySecretKey) || this.Usable == BasePluginType.Type.卸载 || PluginCore.GetInstance.VerifySafetySecretKey(this.SafetySecretKey))
            {
                return(result);
            }
            var dt = UsersManager.GetInstance.GetPageDataUsers(queryItem);

            result.Code = (int)EnumCore.CodeType.成功;
            if (dt.PageData.Count <= 0)
            {
                result.Message = "暂无数据";
                result.TData   = dt;
                return(result);
            }
            result.Message = "获取成功";
            result.TData   = dt;
            return(result);
        }
        public ActionResult LoginResult(UsersQueryItem entity)
        {
            entity.SafetySecretKey = PluginCore.GetInstance.SafetySecretValue;
            entity.IsUsable        = true;
            var result = IocPlugin.IocLoginPlugin.VerifyLogin(entity);

            return(Json(result));
        }
Exemplo n.º 3
0
        public bool VerifyUsersInfo(UsersQueryItem entity, out string message)
        {
            message = "系统错误";
            if (string.IsNullOrWhiteSpace(entity.UserName))
            {
                message = "用户名不能为空";
                return(false);
            }
            if (string.IsNullOrWhiteSpace(entity.UserPwd))
            {
                message = "密码不能为空";
                return(false);
            }

            if (string.IsNullOrWhiteSpace(entity.ValidateCode))
            {
                message = "验证码不能为空";
                return(false);
            }
            if (!string.Equals(entity.ValidateCode, RedisCore.GetInstance.Get <string>(Config.SessionValidate), StringComparison.CurrentCultureIgnoreCase))
            {
                message = "验证码错误";
                return(false);
            }
            var usersModel = IocRepository.IocUsersRepository.GetUsersByName(entity.UserName);

            if (string.IsNullOrWhiteSpace(usersModel.UserName))
            {
                message = "用户名错误";
                return(false);
            }

            var pwdModel = IocCore.Container.Resolve <IPwdRepository>().GetEntityByPwd(MD5Core.GetStringMD5(entity.UserPwd));

            if (string.IsNullOrWhiteSpace(pwdModel.OpenId))
            {
                message = "密码错误";
                return(false);
            }
            RedisCore.GetInstance.Remove(Config.SessionUserInfo);
            RedisCore.GetInstance.Set(Config.SessionUserInfo, usersModel.OpenId, 600);
            message = "登录成功";
            return(true);
        }
        public ActionResult GetPageDataUsers(UsersQueryItem queryEntity)
        {
            queryEntity.SafetySecretKey = PluginCore.GetInstance.SafetySecretValue;
            queryEntity.IsUsable        = true;

            var result     = IocPlugin.IocGetPageDataUsersPlugin.GetPageDataUsers(queryEntity);
            var pageResult = result.TData;
            var pageList   = pageResult.PageData.Select(m =>
            {
                return(new
                {
                    displayID = m.ID,
                    displayUserName = m.UserName,
                    displayCTime = m.CTimeStr,
                    displayOperation = GetDisplayOperationUsers(m.OpenId, m.IsAdministrator)
                });
            });

            return(Json(new { code = 0, msg = string.Empty, count = pageResult.Totals, data = pageList }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        public BaseResult VerifyLogin(UsersQueryItem entity)
        {
            this.SafetySecretKey = entity.SafetySecretKey;
            this.Usable          = entity.IsUsable ? BasePluginType.Type.启用 : BasePluginType.Type.卸载;
            var result = new BaseResult
            {
                Code    = (int)EnumCore.CodeType.失败,
                Message = "获取失败"
            };

            if (string.IsNullOrWhiteSpace(this.SafetySecretKey) || this.Usable == BasePluginType.Type.卸载 || PluginCore.GetInstance.VerifySafetySecretKey(this.SafetySecretKey))
            {
                return(result);
            }
            if (UsersManager.GetInstance.VerifyUsersInfo(entity, out string message))
            {
                result.Code = (int)EnumCore.CodeType.成功;
            }
            result.Message = message;
            return(result);
        }
Exemplo n.º 6
0
        public UsersQueryItem GetPageDataUsers(UsersQueryItem queryItem)
        {
            if (!string.IsNullOrWhiteSpace(queryItem.UserName))
            {
                queryItem.Sql += string.Format(" and t.UserName like '{0}'", queryItem.UserName);
            }

            if (queryItem.StartCTime != null && queryItem.StartCTime.Year > 2000 && queryItem.EndCTime != null && queryItem.EndCTime.Year > 2000)
            {
                queryItem.Sql += string.Format(" and t.CTime>='{0}' and t.CTime<='{1}'", queryItem.StartCTime, queryItem.EndCTime);
            }
            if (queryItem.StartCTime != null && queryItem.StartCTime.Year > 2000 && (queryItem.EndCTime == null || queryItem.EndCTime.Year <= 2000))
            {
                queryItem.Sql += string.Format(" and t.CTime>='{0}'", queryItem.StartCTime);
            }
            if ((queryItem.StartCTime == null || queryItem.StartCTime.Year <= 2000) && (queryItem.EndCTime != null && queryItem.EndCTime.Year >= 2000))
            {
                queryItem.Sql += string.Format(" and t.CTime<='{0}'", queryItem.EndCTime);
            }
            queryItem.PageData = PageCore <UsersQueryItem> .GetInstance.GetPageData(queryItem.Sql, queryItem.Page, queryItem.Limit, ref queryItem.Totals);

            return(queryItem);
        }