示例#1
0
        public JsonResult Check(NewsDetailModel model)
        {
            ServiceResult <NewsFlashOM> result = new ServiceResult <NewsFlashOM>
            {
                Data = _component.CheckNewsFlash(model.Id)
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ApiResultModel NewsDetail([FromUri] NewsDetailModel model)
        {
            ApiResultModel resultModel = new ApiResultModel();

            try
            {
                //根据用户ID查找业主
                IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

                T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果业主存在
                if (owner != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    owner.LatelyLoginTime  = DateTime.Now;
                    owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    ownerBll.Update(owner);

                    IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL");

                    var post = postBll.GetEntity(p => p.Id == model.PostId && p.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && p.PublishedFlag == 1);
                    if (post != null)
                    {
                        // 返回详细页面url
                        resultModel.result = new
                        {
                            PlaceTel = post.PropertyPlace.Tel,
                            Url      = "MobilePage/NewsDetail?id=" + model.PostId
                        };
                    }
                    else
                    {
                        resultModel.Msg = "新闻公告不存在";
                    }
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }
            return(resultModel);
        }
示例#3
0
 // GET: News/Details/5
 public ActionResult Details(int id)
 {
     try
     {
         NewsDetailModel model = new NewsDetailModel(id);
         ViewBag.Title = model.news.Name;
         return(View(model));
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#4
0
        public IActionResult HyzxDetail(int id)
        {
            News        thisNews, nextNews, preNews;
            List <News> allHyzx = db.News.Where(m => m.Type == 2).ToList();
            int         k       = 0;

            while (id != allHyzx[k].ID)
            {
                k++;
                if (k == allHyzx.Count())
                {
                    return(RedirectToAction("News", "Solution"));
                }
            }
            int    uid      = allHyzx[k].ID;
            int    authorID = db.News.SingleOrDefault(m => m.ID == id).UID;
            string author   = db.Users.SingleOrDefault(m => m.ID == authorID).Username;

            if (k == 0) //第一条
            {
                preNews  = null;
                thisNews = allHyzx[0];
                nextNews = allHyzx[1];
            }
            else if (k == allHyzx.Count() - 1) // 最后一条
            {
                nextNews = null;
                thisNews = allHyzx[k];
                preNews  = allHyzx[k - 1];
            }
            else //位于中间 有前有后
            {
                thisNews = allHyzx[k];
                preNews  = allHyzx[k - 1];
                nextNews = allHyzx[k + 1];
            }
            NewsDetailModel newsDetailModel = new NewsDetailModel
            {
                ThisNews = thisNews,
                NextNews = nextNews,
                PreNews  = preNews,
                Author   = author
            };

            return(View(newsDetailModel));
        }
示例#5
0
        public ApiResultModel CompanyNewsDetail([FromUri] NewsDetailModel model)
        {
            ApiResultModel resultModel = new ApiResultModel();

            try
            {
                //根据用户ID查找物业用户
                IPropertyUserBLL propertyUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL");

                T_PropertyUser propertyUser = propertyUserBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果物业用户存在
                if (propertyUser != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > propertyUser.TokenInvalidTime || model.Token != propertyUser.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    propertyUser.LatelyLoginTime  = DateTime.Now;
                    propertyUser.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    propertyUserBll.Update(propertyUser);

                    // 返回详细页面url
                    resultModel.result = "MobilePage/CompanyNewsDetail?id=" + model.PostId;
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }
            return(resultModel);
        }