public ResponseEntity <string> Follow(Follow follow) { ResponseEntity <string> response = new ResponseEntity <string>(); var dao = new FollowDao(ConfigurationManager.AppSettings["mysqlConnStr"]); bool success = dao.Add(follow); if (success) { response = new ResponseEntity <string>(true, "关注成功", "关注成功"); } else { response = new ResponseEntity <string>(true, "关注失败", "关注失败"); } return(response); }
public void FollowByPost(string postId, string followerId) { var graphicMessageDao = new GraphicMessageDao(ConfigurationManager.AppSettings["mysqlConnStr"]); var graphicMsg = graphicMessageDao.GetById(postId); if (graphicMsg != null && !string.IsNullOrEmpty(graphicMsg.openId)) { var followDao = new FollowDao(ConfigurationManager.AppSettings["mysqlConnStr"]); bool isFollowed = followDao.GetFollowed(graphicMsg.openId, followerId); if (!isFollowed) { followDao.Add(new dataentity.Model.Follow() { followee = graphicMsg.openId, follower = followerId }); } } }