private void updateTargetReplies(OpenComment c, int replies) { ICommentTarget target = GetTarget(c) as ICommentTarget; if (target != null) { target.Replies = replies; db.update(target); } // feed replies Microblog mblog = getFeed(c); if (mblog != null) { mblog.Replies = replies; mblog.update(); } if (c.AppId > 0 && target != null) { Type appType = target.GetAppType(); if (appType != null) { ICommentApp app = ndb.findById(appType, c.AppId) as ICommentApp; if (app != null) { int appCount = OpenComment.count("AppId=" + c.AppId + " and TargetDataType='" + c.TargetDataType + "'"); app.CommentCount = appCount; db.update(app); } } } }
private static void updateTargetReplies(OpenComment c, int replies) { Type targetType = Entity.GetType(c.TargetDataType); ICommentTarget target = ndb.findById(targetType, c.TargetDataId) as ICommentTarget; if (target == null) { return; } target.Replies = replies; db.update(target); if (c.AppId <= 0) { return; } Type appType = target.GetAppType(); if (appType == null) { return; } ICommentApp app = ndb.findById(appType, c.AppId) as ICommentApp; if (app == null) { return; } int appCount = OpenComment.count("AppId=" + c.AppId + " and TargetDataType='" + c.TargetDataType + "'"); app.CommentCount = appCount; db.update(app); }
private static void updateTargetReplies(OpenComment c, int replies) { Type targetType = Entity.GetType(c.TargetDataType); ICommentTarget target = ndb.findById(targetType, c.TargetDataId) as ICommentTarget; if (target == null) { return; } target.Replies = replies; db.update(target); }