Example #1
0
        public ActionResult Index()
        {
            PublicUserModel loginUser = this.GetLoginUser();
            UserTaskStat    stat      = userTaskBll.Get_UserTask_Stat(loginUser.UserID);

            ViewBag.UserName = loginUser.Name;
            ViewBag.Portrait = loginUser.Portrait;
            return(View(stat));
        }
Example #2
0
        public ApiResponse GetTask(int type = 0)
        {
            int userId = GetCurrentUserId();

            List <UserTaskModel> taskList = new List <UserTaskModel>();

            if (type == 0) //未完成
            {
                taskList = userTaskLog.GetNoCompleteTask(userId);
            }
            else if (type == 1) //已完成
            {
                taskList = userTaskLog.GetCompleteTask(userId);
            }
            UserTaskStat stat   = userTaskLog.Get_UserTask_Stat(userId);
            var          result = new
            {
                stat.PointsCount,
                stat.UserPoints,
                stat.CompleteCount,
                TaskList = taskList.IsNoNull()
                    ? taskList.Where(o => o.AppUrl != null && o.AppUrl != "").Select(p => new
                {
                    p.TaskId,
                    p.TaskName,
                    p.TaskDescription,
                    p.Points,
                    TaskType = p.Type,
                    CurNum   = p.TaskStatus > 0 ? 1 : 0,
                    MaxNum   = 1,
                    p.AppUrl
                })
                    : null
            };


            return(new ApiResponse(Metas.SUCCESS, result));
        }