Exemplo n.º 1
0
        public JsonResult GetUserTask(int type = 0)
        {
            PublicUserModel      loginUser = this.GetLoginUser();
            List <UserTaskModel> taskList  = new List <UserTaskModel>();

            if (type == 0)//未完成
            {
                taskList = userTaskBll.GetNoCompleteTask(loginUser.UserID);
            }
            else if (type == 1)//已完成
            {
                taskList = userTaskBll.GetCompleteTask(loginUser.UserID);
            }
            return(Json(new { data = taskList }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 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));
        }