//根据订单号查询订单号是否已经存在支付成功。
        public ActionResult IsPaidSuccess(string trade_no)
        {
            string guid    = Request["userId"];
            var    user    = Common.CacheHelper.Get(guid) as PersonalUser;
            var    userMsg = UserMessageBll.LoadEntities(um => trade_no.Equals(um.orderNo) && um.UserId == user.Id).FirstOrDefault();

            if (userMsg.orderNo != null && userMsg.orderNo != "")
            {
                return(Content("ok"));
            }
            else
            {
                return(Content("no"));
            }
        }
        public ActionResult UserTop()
        {
            ViewData.Model = GetCurrentUser();
            var user = ViewData.Model as PersonalUser;
            //-------------最新的五条消息-----------------------------
            var data = UserMessageBll.LoadEntities(um => um.UserId == user.Id && (um.IsDel == "0" || um.IsDel == null)).ToList()
                       .OrderByDescending(um => um.InTime)
                       .Select(um => new UserMessage()
            {
                Title = um.Title, Id = um.Id, InTime = um.InTime
            }).Take(4).ToList();

            ViewBag.TopFiveMsg = data;
            //------------爽币余额--------------------------------------------
            ViewBag.CoinsUsed = UserMessageBll.CoolCoinsUsed(user);
            return(PartialView("UserTop", ViewData.Model));
        }
        public ActionResult GetCurrentUserInfo()
        {
            string guid      = Request["userId"];
            var    user      = Common.CacheHelper.Get(guid) as PersonalUser;
            int    noReadmsg = 0;

            if (user == null)
            {
                user = null;
            }
            else
            {
                //状态未读,未删除的
                noReadmsg = UserMessageBll.LoadEntities(um => um.State == 0 && um.UserId == user.Id && (um.IsDel == "0" || um.IsDel == null)).Select(um => um.Id).Count();
            }
            //未读消息
            // var noReadmsg = UserMessageBll.LoadEntities(um => um.State == 0&&um.UserId==user.Id).Select(um => um.Id).Count();
            return(Json(new { User = user, NoReadMsg = noReadmsg }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult CoolCoins()
        {
            var user = GetCurrentUser();

            //---------------赚爽币记录-------

            ViewBag.Pays = UserMessageBll.LoadEntities(um => um.PayType == "1" && um.UserId == user.Id).Sum(um => (int?)um.Pay);
            //------------充值记录-----------

            ViewData["payRecord"] = UserMessageBll.LoadEntities(um => um.PayType == "2" && um.UserId == user.Id && um.Pay != null).Sum(um => (int?)um.Pay);

            //------------消费记录-----------

            ViewData["expenseRecord"] = UserMessageBll.LoadEntities(um => um.PayType == "3" && um.UserId == user.Id).Sum(um => (int?)um.Pay);
            //-----------爽币余额-------
            ViewBag.CoolCoinsUsedCount = UserMessageBll.CoolCoinsUsed(user);

            return(View());
        }
        public ActionResult MyMsgCenter()
        {
            int pageIndex  = int.Parse(Request["pageIndex"] ?? "1");
            int pageSize   = int.Parse(Request["pageSize"] ?? "20");
            int totalCount = 0;
            var user       = GetCurrentUser();
            var data       = UserMessageBll.LoadPageEntities(pageSize, pageIndex, out totalCount, um => um.UserId == user.Id && (um.IsDel == "0" || um.IsDel == null), false, um => um.InTime)
                             .Select(um => new
            {
                um.Title,
                um.Id,
                um.Msg,
                um.InTime,
                um.State
            }).ToList();
            var msg    = UserMessageBll.LoadEntities(um => um.UserId == user.Id && (um.IsDel == "0" || um.IsDel == null)).Select(um => um.Id).Count();
            var NavStr = Common.LaomaPager.ShowPageNavigate(pageSize, pageIndex, totalCount);
            var result = new { Data = data, NavStr = NavStr, allCount = msg };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }