示例#1
0
        public ActionResult <WeChatLoginResModel> Manage_WeChatLogin_User123123(WeChatLoginViewModel weChatLoginViewModel)
        {
            WeChatLoginResModel weChatLoginResModel = new WeChatLoginResModel();
            var UserSearchResult = _loginService.WeChatLogin_User(weChatLoginViewModel);

            if (UserSearchResult == null)
            {
                weChatLoginResModel.IsSuccess                  = false;
                weChatLoginResModel.baseViewModel.Message      = "用户名不存在或者密码错误";
                weChatLoginResModel.baseViewModel.ResponseCode = 400;
                _ILogger.Information("用户名不存在或者密码错误,进入系统失败");
                return(BadRequest(weChatLoginResModel));
            }
            else
            {
                weChatLoginResModel.user_session               = UserSearchResult;
                weChatLoginResModel.IsSuccess                  = true;
                weChatLoginResModel.baseViewModel.Message      = "存在该用户,查询成功";
                weChatLoginResModel.baseViewModel.ResponseCode = 200;

                TokenModelJwt tokenModel = new TokenModelJwt();
                tokenModel.Uid  = 2;
                tokenModel.Role = "Admin";
                string token = JwtHelper.IssueJwt(tokenModel);


                _ILogger.Information("查询用户信息,存在该用户,权限查询成功");

                return(Ok(weChatLoginResModel));
            }
        }
        public ActionResult <WeChatLoginResModel> Manage_XuXuLogin_User(WeChatLoginViewModel weChatLoginViewModel)
        {
            WeChatLoginResModel weChatLoginResModel = new WeChatLoginResModel();
            var UserSearchResult = _loginService.WeChatLogin_User(weChatLoginViewModel);

            if (UserSearchResult == null)
            {
                weChatLoginResModel.IsSuccess                  = false;
                weChatLoginResModel.baseViewModel.Message      = "用户名不存在或者密码错误";
                weChatLoginResModel.baseViewModel.ResponseCode = 400;
                //_ILogger.Information("用户名不存在或者密码错误,进入系统失败");
                return(BadRequest(weChatLoginResModel));
            }
            else
            {
                weChatLoginResModel.user_session               = UserSearchResult;
                weChatLoginResModel.IsSuccess                  = true;
                weChatLoginResModel.baseViewModel.Message      = "存在该用户,查询成功";
                weChatLoginResModel.baseViewModel.ResponseCode = 200;
                weChatLoginResModel.tokenViewModel.code        = "200";
                weChatLoginResModel.tokenViewModel.data        = "2728b712288da12fffd103af3bd616ff";

                //_ILogger.Information("查询用户信息,存在该用户,权限查询成功");


                return(Ok(weChatLoginResModel));
            }
        }
示例#3
0
        public ActionResult <WeChatLoginResModel> Manage_XuXuLogin_User(WeChatLoginViewModel weChatLoginViewModel)
        {
            WeChatLoginResModel weChatLoginResModel = new WeChatLoginResModel();
            var    UserSearchResult = _loginService.WeChatLogin_User(weChatLoginViewModel);
            string jwtStr           = string.Empty;

            if (UserSearchResult == null)
            {
                weChatLoginResModel.IsSuccess                  = false;
                weChatLoginResModel.baseViewModel.Message      = "用户名不存在或者密码错误";
                weChatLoginResModel.baseViewModel.ResponseCode = 400;
                _ILogger.Information("用户名不存在或者密码错误,进入系统失败");
                return(Ok(weChatLoginResModel));
            }
            else
            {
                TokenModelJwt tokenModel = new TokenModelJwt();
                tokenModel.Uid  = 2;
                tokenModel.Role = "Admin";
                jwtStr          = JwtHelper.IssueJwt(tokenModel);
                weChatLoginResModel.tokenViewModel.data        = jwtStr;//token
                weChatLoginResModel.user_session               = UserSearchResult;
                weChatLoginResModel.IsSuccess                  = true;
                weChatLoginResModel.baseViewModel.Message      = "存在该用户,查询成功";
                weChatLoginResModel.baseViewModel.ResponseCode = 200;
                //  weChatLoginResModel.tokenViewModel.code ="200";
                //  weChatLoginResModel.tokenViewModel.data  = "2728b712288da12fffd103af3bd616ff" ;

                _ILogger.Information("查询用户信息,存在该用户,权限查询成功");


                return(Ok(weChatLoginResModel));
            }
        }
示例#4
0
        //private List<RightsParentSearchMiddlecs> BianLi(List<RightsParentSearchMiddlecs> user_All,
        //                    List<RightsParentSearchMiddlecs> right_chlid,
        //                    List<RightsParentSearchMiddlecs> right_parent,
        //                    List<User_Rights> user_Rights)
        //{
        //    for (int j = 0; j < user_Rights.Count; j++)
        //    {
        //        if (user_Rights[j].ParentId == "0")
        //        {
        //            right_parent.Add(user_All[j]);//遍历出所有父权限
        //        }
        //        else
        //        {
        //            right_chlid.Add(user_All[j]);//遍历出所有子权限
        //        }
        //    }
        //    right_parent = right_parent.OrderBy(x => x.Sort).ToList();//按照sort 字段排序
        //    List<RightsParentSearchMiddlecs> right_chlid5 = new List<RightsParentSearchMiddlecs>();
        //    for (int n = 0; n < right_parent.Count; n++)//父权限
        //    {
        //        List<RightsParentSearchMiddlecs> right_chlid2 = new List<RightsParentSearchMiddlecs>();
        //        for (int z = 0; z < right_chlid.Count; z++)//子权限
        //        {
        //            if (right_chlid[z].ParentId == right_parent[n].Id.ToString())
        //            {
        //                right_chlid2.Add(right_chlid[z]);
        //                right_chlid5.Add(right_chlid[z]);
        //            }

        //        }
        //        if (right_chlid2.Count != 0)
        //        {

        //            right_parent[n].Children = right_chlid2.OrderBy(x => x.Sort).ToList();//按照sort 字段排序
        //        }

        //    }


        //    if (right_chlid.Count!= right_chlid5.Count)//存在三级权限
        //    {
        //        List<RightsParentSearchMiddlecs> right_chlid3 = new List<RightsParentSearchMiddlecs>();

        //        right_chlid3 = Enumerable.Except(right_chlid.Union(right_chlid5), right_chlid.Intersect(right_chlid5)).ToList();
        //        for (int i = 0; i < right_parent.Count; i++)
        //        {
        //            if(right_parent[i].Children!=null)
        //            {
        //                for (int j = 0; j < right_parent[i].Children.Count; j++)
        //                {
        //                    List<RightsParentSearchMiddlecs> right_chlid4 = new List<RightsParentSearchMiddlecs>();
        //                    for (int z = 0; z < right_chlid3.Count; z++)
        //                    {
        //                        if (right_chlid3[z].ParentId == right_parent[i].Children[j].Id.ToString())
        //                        {
        //                            right_chlid4.Add(right_chlid3[z]);
        //                        }
        //                    }
        //                    if (right_chlid4.Count != 0)
        //                    {

        //                        right_parent[i].Children[j].Children = right_chlid4.OrderBy(x => x.Sort).ToList();//按照sort字段排序
        //                    }
        //                }
        //            }

        //        }
        //    }

        //    return right_parent;

        //}

        /// <summary>
        /// 根据账号和密码查询用户信息(用于存储session)
        /// </summary>
        /// <param name="weChatLoginViewModel"></param>
        /// <returns></returns>
        public WeChatLoginMiddlecs WeChatLogin_User(WeChatLoginViewModel weChatLoginViewModel)
        {
            WeChatLoginMiddlecs weChatLoginMiddlecs = new WeChatLoginMiddlecs();
            var user_Infos   = _ILoginRepository.ValideUserInfo(weChatLoginViewModel);
            var user_session = _IMapper.Map(user_Infos, weChatLoginMiddlecs);

            return(user_session);
        }
示例#5
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="weChatLoginViewModel"></param>
        /// <returns></returns>
        public User_Info ValideUserInfo(WeChatLoginViewModel weChatLoginViewModel)
        {
            var       preciate         = SearchUserWhere(weChatLoginViewModel);
            User_Info SearchResultTemp = DbSet
                                         .Where(preciate)
                                         .FirstOrDefault();

            return(SearchResultTemp);
        }
示例#6
0
        //根据条件查询用户
        private Expression <Func <User_Info, bool> > SearchUserWhere(WeChatLoginViewModel weChatLoginViewModel)
        {
            var predicate = WhereExtension.True <User_Info>();//初始化where表达式

            predicate = predicate.And(p => p.UserId == weChatLoginViewModel.UserId);
            predicate = predicate.And(p => p.UserPwd == weChatLoginViewModel.UserPwd);
            predicate = predicate.And(p => p.status == "0");
            return(predicate);
        }
示例#7
0
        public ActionResult <UserBindResModel> GetVisitInfo(string openID, string userId, string passWord)
        {
            UserBindResModel result = new UserBindResModel();
            int count = 0;
            WeChatLoginViewModel weChatLoginViewModel = new WeChatLoginViewModel();

            weChatLoginViewModel.UserId  = userId;
            weChatLoginViewModel.UserPwd = passWord;
            var UserSearchResult = _loginService.WeChatLogin_User(weChatLoginViewModel);

            if (UserSearchResult == null)
            {
                result.BindStatus = "0";
                result.Msg        = "绑定失败,账号或者密码存在问题";
            }
            else
            {
                var res = _loginService.UserBindSearch2(userId);

                if (res.Count > 0)
                {
                    result.BindStatus = "2";
                    result.Msg        = "不是本人";
                }
                else
                {
                    count = _loginService.AddUserBind(openID, userId, passWord);
                    string msg = string.Empty;
                    if (count > 0)
                    {
                        msg = "账号绑定成功;";
                        result.BindStatus = "1";
                        result.OpenID     = openID;
                        result.RoleName   = "0";
                        result.Status     = "0";
                    }
                    else
                    {
                        result.BindStatus = "0";
                        result.Msg        = "绑定失败,参数存在问题";
                    }
                }
            }

            return(Ok(result));
        }
示例#8
0
 public List <User_Info> SearchInfoByWeChatWhere(WeChatLoginViewModel weChatLoginViewModel)
 {
     throw new NotImplementedException();
 }