Esempio n. 1
0
        public ActionResult PersonalInfo()
        {
            int id     = WebCookieHelper.GetUserId(0);
            var member = EnterRepository.GetRepositoryEnter().MemberRepository.LoadEntities(m => m.ID == id).FirstOrDefault();

            if (member == null)
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Utility.CookieHelper.SetCookie("returnurl", Request.Url.ToString(), "", 1);
                    return(Redirect("/weixin/account"));
                }
                else
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            var qquser         = EnterRepository.GetRepositoryEnter().QQUserRepository.LoadEntities(m => m.MemberID == id).FirstOrDefault();
            int blogsum        = EnterRepository.GetRepositoryEnter().BlogRepository.LoadEntities(m => m.MemberID == id).Count();
            int blogvideosum   = EnterRepository.GetRepositoryEnter().BlogRepository.GetBlogs(id, SystemConst.CategoryCode.BlogVideo, null).Count();
            int blogpicturesum = EnterRepository.GetRepositoryEnter().BlogRepository.GetBlogs(id, SystemConst.CategoryCode.BlogPicture, null).Count();

            if (qquser != null)
            {
                ViewBag.FigureUrl = qquser.Figureurl;
            }
            ViewBag.blogsum        = blogsum;
            ViewBag.blogvideosum   = blogvideosum;
            ViewBag.blogpicturesum = blogpicturesum;
            return(View(member));
        }
Esempio n. 2
0
        public ActionResult updatePassword()
        {
            string oldpwd = Request.Form["oldpwd"];
            string pwd    = Request.Form["pwd"];
            int    id     = WebCookieHelper.GetUserId(0);
            var    result = EnterRepository.GetRepositoryEnter().MemberRepository.LoadEntities(m => m.ID == id).FirstOrDefault();

            if (result == null)
            {
                return(Content("用户不存在,请重新登录"));
            }
            if (result.Password != Utility.MD5Helper.MD5(oldpwd))
            {
                return(Content("原始密码不对"));
            }
            result.Password = Utility.MD5Helper.MD5(pwd);
            EnterRepository.GetRepositoryEnter().MemberRepository.Get(m => m.ID == id);
            EnterRepository.GetRepositoryEnter().MemberRepository.EditEntity(result, new string[] { "Password" });
            if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
            {
                return(Content("系统错误,修改密码失败"));
            }

            return(Content(""));
        }
Esempio n. 3
0
        public ActionResult Index(int?id)
        {
            string mine = string.IsNullOrEmpty(Request.QueryString["mine"])
               ? "false" : Request.QueryString["mine"];

            string categoryCode = string.IsNullOrEmpty(Request.QueryString["CategoryCode"])
               ? SystemConst.CategoryCode.Toutiao : Request.QueryString["CategoryCode"];
            string order = string.IsNullOrEmpty(Request.QueryString["order"])
                ? "default" : Request.QueryString["order"];

            string keyword = Request.QueryString["keyword"];

            int memberID = 0;

            if (mine == "true")
            {
                memberID = WebCookieHelper.GetUserId(0);
                if (memberID == 0)
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            string     categoryName = EnterRepository.GetRepositoryEnter().CategoryRepository.LoadEntities(m => m.Code == categoryCode).FirstOrDefault().Name;
            Pagination pagination   = new Pagination();
            int        page         = 1;

            if (id != null)
            {
                page = int.Parse(id.ToString());
            }

            int totalCount = 0;

            pagination.Size      = 30;
            pagination.ActionUrl = "toutiao/index";

            pagination.CurrentPageIndex = page;
            DateTime startTime  = DateTime.Now;
            var      mytoutiaos = ToutiaoServices.GetToutiaos(keyword, memberID, categoryCode, order, page, pagination.Size, out totalCount);
            string   time       = (DateTime.Now - startTime).TotalSeconds.ToString();

            pagination.TotalCount   = totalCount;
            pagination.Order        = order;
            pagination.CategoryCode = categoryCode;
            pagination.CategoryName = categoryName;
            pagination.Keyword      = keyword;
            ViewBag.mine            = mine;
            ViewBag.time            = time;
            ViewBag.keyword         = keyword;
            ViewBag.mytoutiaos      = mytoutiaos;
            ViewBag.Pagination      = pagination;
            return(View());
        }
Esempio n. 4
0
        public ActionResult Telephone()
        {
            int nid    = WebCookieHelper.GetUserId(0);
            var result = EnterRepository.GetRepositoryEnter().OAuthUserRepository.LoadEntities(m => m.ID == nid).FirstOrDefault();

            if (result == null)
            {
                return(Redirect("/weixin/account/"));
            }
            //ViewData["user"] = result;
            return(View(result));
        }
Esempio n. 5
0
        public ActionResult GetHtml()
        {
            string url         = Request.Form["url"];
            string htmlstr     = HtmlContentHelper.WebPageContentGet(url);
            string title       = HtmlContentHelper.WebPageTitleGet(htmlstr).Replace("- 今日头条(TouTiao.com)", "").Replace("- 今日头条(TouTiao.org)", "");
            string description = HtmlContentHelper.WebPageDescriptionGet(htmlstr);
            string keywords    = HtmlContentHelper.WebPageKeywordsGet(htmlstr);
            string article     = HtmlContentHelper.WebPageArticleGet(url, htmlstr);



            var blog = EnterRepository.GetRepositoryEnter().BlogRepository.LoadEntities(m => m.ReprintUrl == url).FirstOrDefault();

            if (blog == null)
            {
                blog            = new Models.Blog();
                blog.ReprintUrl = url;
                blog.MemberID   = WebCookieHelper.GetUserId(0);
                blog.CategoryID = EnterRepository.GetRepositoryEnter().CategoryRepository.LoadEntities(m => m.Code == "blog").FirstOrDefault().ID;
                blog.ImagePath  = HtmlContentHelper.GetFirstImgUrl(article);
                blog.IsPublic   = 1;
                blog.Keywords   = keywords;
                blog.Summary    = description;
                blog.Zhuanzai   = 1;
                blog.ModifyTime = DateTime.Now;
                blog.CreateTime = DateTime.Now;
                blog.Content    = article;
                blog.Title      = title;
                EnterRepository.GetRepositoryEnter().BlogRepository.AddEntity(blog);
            }
            else
            {
                blog.ReprintUrl = url;
                blog.MemberID   = WebCookieHelper.GetUserId(0);
                blog.ImagePath  = HtmlContentHelper.GetFirstImgUrl(article);
                blog.IsPublic   = 1;
                blog.Keywords   = keywords;
                blog.Summary    = description;
                blog.Zhuanzai   = 1;
                blog.ModifyTime = DateTime.Now;
                blog.Content    = article;
                blog.Title      = title;
                EnterRepository.GetRepositoryEnter().BlogRepository.EditEntity(blog, new string[] { "MemberID", "Content", "IsPublic", "ReprintUrl", "Keywords"
                                                                                                    , "ModifyTime", "Summary", "ImagePath", "Title", "Zhuanzai" });
            }
            if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
            {
                return(Redirect("/blog/view/" + blog.ID + ".htm"));
            }
            return(Content(""));
        }
Esempio n. 6
0
        public ActionResult PersonalInfo()
        {
            int id     = WebCookieHelper.GetUserId(0);
            var member = EnterRepository.GetRepositoryEnter().MemberRepository.LoadEntities(m => m.ID == id).FirstOrDefault();

            if (member == null)
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Utility.CookieHelper.SetCookie("returnurl", Request.Url.ToString(), "", 1);
                    return(Redirect("/weixin/account"));
                }
                else
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            var oAuthUser      = EnterRepository.GetRepositoryEnter().OAuthUserRepository.LoadEntities(m => m.MemberID == id).FirstOrDefault();
            int blogsum        = EnterRepository.GetRepositoryEnter().BlogRepository.LoadEntities(m => m.MemberID == id).Count();
            int blogvideosum   = 0;
            int blogpicturesum = 0;

            EnterRepository.GetRepositoryEnter().BlogRepository.GetBlogs(null, id, SystemConst.CategoryCode.BlogVideo, null, 0, 0, out blogvideosum);
            EnterRepository.GetRepositoryEnter().BlogRepository.GetBlogs(null, id, SystemConst.CategoryCode.BlogPicture, null, 0, 0, out blogvideosum);

            if (oAuthUser != null)
            {
                ViewBag.FigureUrl = oAuthUser.Headimgurl;
            }
            string tel      = WebCookieHelper.GetUserInfo(2);
            var    employee = EnterRepository.GetRepositoryEnter().EmployeeRepository.LoadEntities(m => m.Tel == tel).FirstOrDefault();

            if (employee != null)
            {
                WebCookieHelper.SetEmployeeCookie(employee.ID, employee.Name, employee.EmpNo, employee.Tel, 15);
            }
            ViewBag.employee       = employee;
            ViewBag.blogsum        = blogsum;
            ViewBag.blogvideosum   = blogvideosum;
            ViewBag.blogpicturesum = blogpicturesum;
            GlobalMethod.log.Info(string.Format("{0}进入个人主页", member.UserName));
            return(View(member));
        }
Esempio n. 7
0
        public ActionResult GetHtmlToutiao()
        {
            string url         = Request.Form["url"];
            string htmlstr     = HtmlContentHelper.WebPageContentGet(url);
            string title       = HtmlContentHelper.WebPageTitleGet(htmlstr).Replace("- 今日头条(TouTiao.com)", "").Replace("- 今日头条(TouTiao.org)", "");
            string description = HtmlContentHelper.WebPageDescriptionGet(htmlstr);
            string keywords    = HtmlContentHelper.WebPageKeywordsGet(htmlstr);
            string article     = HtmlContentHelper.WebPageArticleGet(url, htmlstr);



            var item = EnterRepository.GetRepositoryEnter().ToutiaoRepository.LoadEntities(m => m.ReprintUrl == url).FirstOrDefault();

            if (item == null)
            {
                item            = new Models.Toutiao();
                item.ReprintUrl = url;
                item.MemberID   = WebCookieHelper.GetUserId(0);
                item.CategoryID = EnterRepository.GetRepositoryEnter().CategoryRepository.LoadEntities(m => m.Code == "toutiao").FirstOrDefault().ID;
                item.ImagePath  = HtmlContentHelper.GetFirstImgUrl(article);
                item.IsPublic   = 1;
                item.Keywords   = keywords;
                item.Summary    = description;
                item.Zhuanzai   = 1;
                item.ModifyTime = DateTime.Now;
                item.CreateTime = DateTime.Now;
                item.Content    = article;
                item.Title      = title;
                EnterRepository.GetRepositoryEnter().ToutiaoRepository.AddEntity(item);
                if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
                {
                    return(Redirect("/toutiao/view/" + item.ID + ".htm"));
                }
                return(Content(""));
            }
            else
            {
                return(Redirect("/toutiao/view/" + item.ID + ".htm"));
            }
        }
Esempio n. 8
0
        public ActionResult LuckyRoller()
        {
            int id     = WebCookieHelper.GetUserId(0);
            var member = EnterRepository.GetRepositoryEnter().MemberRepository.LoadEntities(m => m.ID == id).FirstOrDefault();

            if (member == null)
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Utility.CookieHelper.SetCookie("returnurl", Request.Url.ToString(), "", 1);
                    return(Redirect("/weixin/account"));
                }
                else
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            var invites = EnterRepository.GetRepositoryEnter().InviteRepository.LoadEntities(m => m.InviteTel == member.Tel).ToList();

            if (invites != null && invites.Count > 0)
            {
                List <string> lstBeinvite = new List <string>();
                foreach (var item in invites)
                {
                    lstBeinvite.Add(item.BeInviteTel);
                }
                //获取邀请名额
                var result = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => lstBeinvite.Contains(m.Tel) && m.EmployeeID != 0).ToList();
                ViewBag.users = result;
            }
            var lottery = EnterRepository.GetRepositoryEnter().LotteryRepository.LoadEntities(m => m.Tel == member.Tel).FirstOrDefault();

            ViewBag.lottery = lottery;
            string szName = WebCookieHelper.GetUserInfo(1);

            GlobalMethod.log.Info(string.Format("{0}进入幸运大转盘抽奖", szName));
            return(View());
        }
Esempio n. 9
0
        public ActionResult Write(FormCollection form)
        {
            var blog = new Models.Blog();

            blog.ID         = int.Parse(form["ID"]);
            blog.CategoryID = int.Parse(form["CategoryID"]);
            blog.Content    = form["Content"];
            blog.IsPublic   = int.Parse(form["IsPublic"]);
            blog.Keywords   = form["Keywords"];
            blog.ReprintUrl = form["ReprintUrl"];
            blog.Title      = form["Title"];

            blog.Zhuanzai = int.Parse(form["Zhuanzai"]);

            blog.MemberID  = WebCookieHelper.GetUserId(0);
            blog.Summary   = HtmlContentHelper.GetSummary(blog.Content);
            blog.ImagePath = HtmlContentHelper.GetFirstImgUrl(blog.Content);
            //创建会员信息
            if (blog.ID == 0)
            {
                blog.CreateTime = DateTime.Now;
                blog.ModifyTime = DateTime.Now;
                EnterRepository.GetRepositoryEnter().BlogRepository.AddEntity(blog);
            }
            else
            {
                blog.ModifyTime = DateTime.Now;
                EnterRepository.GetRepositoryEnter().BlogRepository.Get(m => m.ID == blog.ID);
                EnterRepository.GetRepositoryEnter().BlogRepository.EditEntity(blog
                                                                               , new string[] { "Content", "IsPublic", "ReprintUrl", "Keywords"
                                                                                                , "ModifyTime", "Summary", "ImagePath", "CategoryID", "Title", "Zhuanzai" });
            }
            if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
            {
                return(Content("error"));
            }
            return(Content(blog.ID.ToString()));
        }
Esempio n. 10
0
 public ActionResult Detail()
 {
     if (!WebCookieHelper.UserCheckLogin())
     {
         return(Redirect("/weixin/account/"));
     }
     try
     {
         int nid = WebCookieHelper.GetUserId(0);
         //查找用户信息
         var result = EnterRepository.GetRepositoryEnter().OAuthUserRepository.LoadEntities(m => m.ID == nid).FirstOrDefault();
         if (result == null)
         {
             return(Redirect("/weixin/account/"));
         }
         return(View(result));
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return(Redirect("/weixin/account/"));
     }
 }
Esempio n. 11
0
        //
        // GET: /Advise/

        public ActionResult Write(int?id)
        {
            int memberID = WebCookieHelper.GetUserId(0);

            if (memberID == 0)
            {
                return(Redirect("/member/login?returnurl=" + Request.Url));
            }

            var item = new Models.Toutiao();

            if (id != null)
            {
                item = EnterRepository.GetRepositoryEnter().ToutiaoRepository.LoadEntities(m => m.ID == id).FirstOrDefault();
            }
            else
            {
                item.IsPublic = 1;
            }
            var categorylist = EnterRepository.GetRepositoryEnter().CategoryRepository.GetCategorys("toutiao").ToList();

            ViewBag.categorylist = categorylist;
            return(View(item));
        }
Esempio n. 12
0
        //
        // GET: /sui/Account/

        public ActionResult Index()
        {
            if (!WebCookieHelper.UserCheckLogin())
            {
                return(Redirect("/weixin/account/"));
            }
            try
            {
                int nid = WebCookieHelper.GetUserId(0);
                //查找用户信息
                var result = EnterRepository.GetRepositoryEnter().OAuthUserRepository.LoadEntities(m => m.ID == nid).FirstOrDefault();
                if (result == null)
                {
                    return(Redirect("/weixin/account/"));
                }
                log.Info(string.Format("用户:{0}登录个人中心", result.NickName));
                return(View(result));
            }
            catch (Exception ex)
            {
                log.Error(ex);
                return(Redirect("/weixin/account/"));
            }
        }