public ActionResult QuitGroup(long groupUserID) { BizResultInfo result = new BizResultInfo(); var bizModel = BizGroupUser.LoadByGroupUserID(groupUserID); if (groupUserID == 0 || bizModel == null) { result.IsSuccess = false; result.ErrorMessage = "取不到这个数据啊呀...不要逗我玩吧。"; return(Json(result)); } var groupInfo = BizGroupInfo.LoadByGroupID(bizModel.GroupInfoID); if (UILoginHelper.GetUIDFromHttpContext(HttpContext) == groupInfo.CreateUesrID) { result.IsSuccess = false; result.ErrorMessage = "不允许移除自己...."; return(Json(result)); } if (bizModel.IsPass == (int)ApplyStatus.Pass) { MessageBo.CreateMessage(0, MessageTypeEnum.QuitGroupSuccess, bizModel); } bizModel.IsPass = (int)ApplyStatus.Quit; bizModel.Save(); result.IsSuccess = true; return(Json(result)); }
/// <summary> /// 驳回用户 /// </summary> /// <param name="groupUserID"></param> /// <returns></returns> public ActionResult RejectGroupUser(long groupUserID) { BizResultInfo result = new BizResultInfo(); var bizModel = BizGroupUser.LoadByGroupUserID(groupUserID); if (groupUserID == 0 || bizModel == null) { result.IsSuccess = false; result.ErrorMessage = "取不到这个数据啊呀...不要逗我玩吧。"; return(Json(result)); } if (UILoginHelper.GetUIDFromHttpContext(HttpContext) == bizModel.UserInfoID) { result.IsSuccess = false; result.ErrorMessage = "不允许驳回自己...."; return(Json(result)); } bizModel.IsPass = (int)ApplyStatus.Reject; bizModel.Save(); MessageBo.CreateMessage(0, MessageTypeEnum.RejecrApplyJoinGroup, bizModel); result.IsSuccess = true; return(Json(result)); }
/// <summary> /// 申请加入群组 /// </summary> /// <param name="groupID"></param> /// <returns></returns> public ActionResult ApplyToGroup(long groupID) { BizResultInfo result = new BizResultInfo(); if (groupID == 0 || BizGroupInfo.LoadByGroupID(groupID) == null) { result.IsSuccess = false; result.ErrorMessage = "群组ID不能为空呀,这个数据肯定有问题...不要逗我玩吧。"; return(Json(result)); } var lstGroupUser = BizGroupUser.LoadGroupUser(UILoginHelper.GetUIDFromHttpContext(HttpContext)); if (lstGroupUser != null && lstGroupUser.Any(model => model.GroupInfoID == groupID)) { result.IsSuccess = false; result.ErrorMessage = "已经申请加入了,再等等吧...."; return(Json(result)); } BizGroupUser groupUser = new BizGroupUser(); groupUser.GroupInfoID = groupID; groupUser.IsPass = (int)ApplyStatus.Waiting; groupUser.CreateTime = DateTime.Now; groupUser.UserInfoID = UILoginHelper.GetUIDFromHttpContext(HttpContext); groupUser.Save(); MessageBo.CreateMessage(0, MessageTypeEnum.ApplyJoinGroup, groupUser); result.IsSuccess = true; result.SuccessMessage = "申请成功...."; return(Json(result)); }
public ActionResult AddToGroupAgain(long groupUserID) { BizResultInfo result = new BizResultInfo(); var bizModel = BizGroupUser.LoadByGroupUserID(groupUserID); if (groupUserID == 0 || bizModel == null) { result.IsSuccess = false; result.ErrorMessage = "取不到这个数据啊呀...不要逗我玩吧。"; return(Json(result)); } bizModel.IsPass = (int)ApplyStatus.Waiting; bizModel.Save(); MessageBo.CreateMessage(0, MessageTypeEnum.ApplyJoinGroup, bizModel); result.IsSuccess = true; return(Json(result)); }
public ActionResult AddBookmarkLikeLog(long bookmarkID) { BizResultInfo result = new BizResultInfo(); var loginUID = UILoginHelper.GetUIDFromHttpContext(HttpContext); var bookmarkInfo = BizBookmarkInfo.LoadByID(bookmarkID); if (bookmarkInfo != null) { var likelog = BizLikeLog.LoadUserIDAndBookmarkID(loginUID, bookmarkID); if (likelog != null) { result.IsSuccess = false; result.ErrorMessage = "你已经点赞过了呀,不要重复点赞了。"; } else { likelog = new BizLikeLog(); likelog.InfoID = bookmarkID; likelog.InfoType = (int)InfoTypeEnum.Bookmark; likelog.UserInfoID = loginUID; likelog.Save(); bookmarkInfo.LoadLikeLog(); result.Target = bookmarkInfo.LikeCount; result.IsSuccess = true; result.SuccessMessage = "点赞成功。"; UserDynamicInfoBo.CreateDynamicInfoMessage(loginUID, DynamicInfoType.NewLikeBookmark, bookmarkInfo); MessageBo.CreateMessage(loginUID, MessageTypeEnum.NewLikeBookmarkLog, bookmarkInfo); } } else { result.IsSuccess = false; result.ErrorMessage = "找不到书签呀,刷新一下再来试试?"; } return(Json(result)); }
public ActionResult SaveBookmarkComment(long bookmarkID, string content) { BizResultInfo result = new BizResultInfo(); try { var bookmark = BizBookmarkInfo.LoadByID(bookmarkID); if (bookmark == null || bookmark.BookmarkInfoID == 0) { result.IsSuccess = false; result.ErrorMessage = "序列化书签数据失败,目测你要重新加载页面。"; return(Json(result)); } BizBookmarkComment comment = new BizBookmarkComment(); comment.CriticsUserID = UILoginHelper.GetUIDFromHttpContext(HttpContext); comment.CommentTitle = ""; comment.CommentContent = content; comment.BookmarkInfoID = bookmark.BookmarkInfoID; comment.CreateTime = DateTime.Now; comment.BookmarkUserID = bookmark.UserInfoID; comment.Save(); var loginUID = UILoginHelper.GetUIDFromHttpContext(HttpContext); MessageBo.CreateMessage(bookmark.UserInfoID, MessageTypeEnum.NewBookmarkComment, comment); UserDynamicInfoBo.CreateDynamicInfoMessage(loginUID, DynamicInfoType.NewBookmarkComment, bookmark); result.IsSuccess = true; result.SuccessMessage = "提交成功。"; }catch (Exception ex) { LogHelper.WriteException("SaveBookmarkComment", ex, new { BookmarkID = bookmarkID, SubmitUser = UILoginHelper.GetUIDFromHttpContext(HttpContext), Content = content, }); result.ErrorMessage = "提交失败,目测网络挂了或者别的...."; result.IsSuccess = false; } return(Json(result)); }
public ActionResult FollowUser(long beFollowUserID) { BizResultInfo result = new BizResultInfo(); var befollower = BizUserInfo.LoadByUserInfoID(beFollowUserID); if (beFollowUserID == 0 || befollower == null || befollower.UserInfoID == 0) { result.IsSuccess = false; result.ErrorMessage = "关注者ID为空,这是一条垃圾数据呀。"; return(Json(result)); } long userID = UILoginHelper.GetUIDFromHttpContext(HttpContext); var status = UserRelationshipBo.CheckFollowStatus(beFollowUserID, userID); if (status) { result.IsSuccess = false; result.ErrorMessage = "您已经关注了此用户,不能重复关注。"; return(Json(result)); } var userRelationship = new BizUserRelationship() { BeFollwedUID = beFollowUserID, FollowerID = userID, CreateTime = DateTime.Now, }; userRelationship.Save(); MessageBo.CreateMessage(userID, MessageTypeEnum.NewBeFollow, userRelationship); UserDynamicInfoBo.CreateDynamicInfoMessage(userID, DynamicInfoType.NewFollower, befollower); result.IsSuccess = true; return(Json(result)); }