Example #1
0
        /// <summary>
        /// 我的消息列表
        /// </summary>
        /// <param name="pagination">分页参数</param>
        /// <param name="splitPage">查询参数</param>
        /// <param name="usage">使用范围(前台使用)</param>
        /// <param name="curStatus">状态</param>
        /// <returns>返回分页列表Json</returns>
        public ActionResult getMyMessage(Pagination pagination, SplitPage splitPage, string usage, string curStatus)
        {
            pagination.sidx = pagination.sort;
            pagination.sord = pagination.order;
            pagination.page = (pagination.page <= 0 ? 1 : pagination.page);
            pagination.rows = (pagination.rows <= 0 ? 0 : pagination.rows);
            List <Conditions> lisWhere = new List <Conditions>();

            if (splitPage.Conditions == null)
            {
                lisWhere = new List <Conditions>();
            }
            else
            {
                lisWhere = splitPage.Conditions.ToList <Conditions>();
            }
            //桌面使用
            if (!string.IsNullOrEmpty(usage) && usage.Equals("top"))
            {
                lisWhere.Add(new Conditions()
                {
                    Key = "receiver", Value = OperatorProvider.Provider.Current().UserId
                });
                lisWhere.Add(new Conditions()
                {
                    Key = "isDelete", Value = "0"
                });
                lisWhere.Add(new Conditions()
                {
                    Key = "curStatus", Value = "0"
                });                                                               //未读

                splitPage.order      = "desc";
                splitPage.sort       = "CreateDate";
                splitPage.Conditions = lisWhere.ToArray();
                var data = messagebll.GetMyList(pagination, splitPage, usage);
                return(Content(data.ToJson()));
            }
            else
            {
                //列表使用
                lisWhere.Add(new Conditions()
                {
                    Key = "receiver", Value = OperatorProvider.Provider.Current().UserId
                });
                lisWhere.Add(new Conditions()
                {
                    Key = "isDelete", Value = "0"
                });
                lisWhere.Add(new Conditions()
                {
                    Key = "curStatus", Value = curStatus
                });

                splitPage.order      = "desc";
                splitPage.sort       = "CreateDate";
                splitPage.Conditions = lisWhere.ToArray();

                var data     = messagebll.GetMyList(pagination, splitPage, usage);
                var jsonData = new
                {
                    rows  = data,
                    total = pagination.records,
                };
                return(ToJsonResult(jsonData));
            }
        }