Exemplo n.º 1
0
        public BaseController()
        {
            string DesUserModel = Util.GetCookie("easyzy.user", "useridentity");
            string DesKey       = Util.GetAppSetting("DesKey");

            UserCookieHelper.UserCookieModel u = UserCookieHelper.DescryptUserCookie(DesUserModel, DesKey);

            UserId           = u._id;
            UserName         = u._uname;
            ViewBag.UserName = UserName;
        }
Exemplo n.º 2
0
        public baseController()
        {
            string DesUserModel = Util.GetCookie("easyzy.user", "useridentity");
            string DesKey       = Util.GetAppSetting("DesKey");

            UserCookieHelper.UserCookieModel u = UserCookieHelper.DescryptUserCookie(DesUserModel, DesKey);

            UserId = u._id;
            if (UserId != 0)
            {
                UserInfo = B_UserRedis.GetUser(UserId);
            }
            ViewBag.UserInfo = UserInfo;
        }
Exemplo n.º 3
0
        public BaseController()
        {
            string DesUserModel = Util.GetCookie("easyzy.user", "useridentity");
            string DesKey       = Util.GetAppSetting("DesKey");

            UserCookieHelper.UserCookieModel u = UserCookieHelper.DescryptUserCookie(DesUserModel, DesKey);

            UserId = u._id;
            int invites = 0;

            if (UserId != 0)
            {
                UserInfo = B_UserRedis.GetUser(UserId);
                invites  = B_Topic.GetInviteCount(UserInfo.UserName);
            }

            ViewBag.UserInfo = UserInfo;
            ViewBag.Invites  = invites;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 如果登录,且control和action在计算activity的集合内,则添加活跃度
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            string DesUserModel = Util.GetCookie("easyzy.user", "useridentity");

            if (!string.IsNullOrEmpty(DesUserModel))
            {
                string DesKey = Util.GetAppSetting("DesKey");
                UserCookieHelper.UserCookieModel u = UserCookieHelper.DescryptUserCookie(DesUserModel, DesKey);
                int uId = u._id;

                var    controllerName = (filterContext.RouteData.Values["controller"]).ToString().ToLower();
                var    actionName     = (filterContext.RouteData.Values["action"]).ToString().ToLower();
                string key            = string.Concat(controllerName, "_", actionName);
                int    value          = 0;
                var    aw             = ActivityWeightConst.ActivityWeights.TryGetValue(key, out value);
                if (aw)
                {
                    DateTime FirstCycleDay = DateTime.Now.AddDays(1 - Convert.ToInt32(DateTime.Now.DayOfWeek.ToString("d"))).Date;
                    B_Topic.AddActivity(uId, key, value, FirstCycleDay);
                }
            }
            base.OnActionExecuting(filterContext);
        }