public JsonResult GetLoginInfo()
        {
            var data     = new PyStudioData();
            var userInfo = HttpContext.Session.Get <PyUserInfo>(HttpContext.Session.SessionKey());

            if (userInfo != null)
            {
                data.Data = userInfo;
                data.IsOk = true;
            }
            data.Msg = data.IsOk ? "已登录" : "未登录";
            return(Json(data));
        }
Beispiel #2
0
        public JsonResult UserLog(int?codeId, int page = 1, int pageSize = 5)
        {
            var data = new PyStudioData();

            if (codeId == null)
            {
                return(Json(data));
            }

            page      = page <= 0 ? 1 : page;
            pageSize  = pageSize > 20 ? 20 : pageSize;
            data.Data = _db.ToUserLog
                        .Where(b => b.UserId == _MyUserInfo.Id && b.CodeId == codeId)
                        .OrderByDescending(b => b.Id)
                        .Skip((page - 1) * pageSize)
                        .Take(pageSize)
                        .ToList();
            data.IsOk = true;

            return(Json(data));
        }
Beispiel #3
0
        public JsonResult UserUp()
        {
            var data = new PyStudioData();

            //留图数(Private)
            var userContent = _db.ToContent
                              .Where(b => b.UserId == _MyUserInfo.Id && b.Status != (int)EmContentStatus.除)
                              .OrderByDescending(b => b.CreateTime)
                              .Take(5)
                              .Select(b => new {
                Id      = b.Id,
                Name    = b.Name,
                ReadNum = b.ReadNum,
                ZanNum  = b.ZanNum,
                MinPic  = b.MinPic,
                MaxPic  = b.MaxPic
            });

            data.Data = userContent;
            data.IsOk = true;
            return(Json(data));
        }
Beispiel #4
0
        public JsonResult UserStatis()
        {
            var data = new PyStudioData();
            var list = new List <dynamic>();

            var userContent = _db.ToContent
                              .Where(b => b.UserId == _MyUserInfo.Id)
                              .AsEnumerable();

            //Public留图数
            var total1 = userContent.Count(b => b.Status == (int)EmContentStatus.公有);

            list.Add(new { name = "留图数(公有)", total = $"{total1}(张)" });

            //Private留图数
            var total2 = userContent.Count(b => b.Status == (int)EmContentStatus.私有);

            list.Add(new { name = "留图数(私有)", total = $"{total2}(张)" });

            //点赞数
            var total3 = userContent.Where(b => b.Status != (int)EmContentStatus.除).Sum(b => b.ZanNum);

            list.Add(new { name = "点赞数", total = $"{total3}(个)" });

            //浏览数
            var total4 = userContent.Where(b => b.Status != (int)EmContentStatus.除).Sum(b => b.ReadNum);

            list.Add(new { name = "浏览数", total = $"{total4}(次)" });

            //爱心积分
            var total5 = _MyUserInfo.LevelNum;

            list.Add(new { name = "爱心积分", total = $"{total5}(分)" });

            data.Data = list;
            data.IsOk = true;

            return(Json(data));
        }