public ActionResult AddRelation(ht_comm_relation relation) { AuthenticationUser loginInfo = BLLUser.GetLoginUserInfo(); if (loginInfo == null) { apiResp.msg = "请先登录"; apiResp.code = (int)HT.Model.Enum.APIErrCode.UserIsNotLogin; return(Json(apiResp)); } if (BLLRelation.IsExistRelation(relation.main_id, loginInfo.id.ToString(), "praise")) { apiResp.msg = "重复关注"; apiResp.code = (int)HT.Model.Enum.APIErrCode.UserIsNotLogin; return(Json(apiResp)); } ht_comm_relation model = new ht_comm_relation(); model.add_time = DateTime.Now; model.relation_type = "praise"; model.main_id = relation.main_id; model.relation_id = loginInfo.id.ToString(); if (BLLNews.AddPraise(int.Parse(relation.main_id), model) > 0) { apiResp.status = true; apiResp.msg = "点赞成功"; } else { apiResp.msg = "点赞出错"; apiResp.code = (int)HT.Model.Enum.APIErrCode.OperateFail; } return(Json(apiResp)); }
/// <summary> /// 获取信息详情 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult BaseNewsDetails(int id) { HT.Model.ht_news model = BLLNews.GetNewsDetails(id); if (model != null) { model.is_praise = BLLRelation.IsExistRelation(model.id.ToString(), BLLUser.GetUserId().ToString(), "praise"); } if (Request.IsAjaxRequest()) { apiResp.status = true; apiResp.result = model; return(Json(apiResp)); } return(View(model)); }