public int Add(string content, string targetId, string mode) { var currentUser = SESSION.Current; var inst = new CommentItem(); inst.RootID = targetId; inst.Content = content; inst.CreatorID = currentUser.UserID; inst.CreatorName = currentUser.UserName; inst.Mode = mode; inst.Save(); if (mode == "LikeCount") { DocManager.GetInstance().UpdateValue(targetId, "{$inc:{'LikeCount':1}}"); ClientBehaviorManager.Add(CONST.DB.DBName_DocService, CONST.DB.CollectionName_CommentItem, targetId, "点赞", currentUser.UserID, currentUser.UserName); } else if (mode == "text") { DocManager.GetInstance().UpdateValue(targetId, "{$inc:{'CommentCount':1}}"); ClientBehaviorManager.Add(CONST.DB.DBName_DocService, CONST.DB.CollectionName_CommentItem, targetId, "评论", currentUser.UserID, currentUser.UserName); } return(0); }
/// <summary> /// 文档聚合查询 /// </summary> /// <param name="match"></param> /// <param name="group"></param> /// <returns></returns> public object Aggregate(string type, string match, string group) { var res = new object(); if ("Doc" == type) { res = DocManager.GetInstance().Aggregate(match, group); } else if ("ClientBehavior" == type) { res = ClientBehaviorManager.GetInstance().Aggregate(match, group); } return(res); }
public static ClientBehaviorManager GetInstance() { var inst = new ClientBehaviorManager(); return(inst); }