📅  最后修改于: 2022-03-11 14:56:32.949000             🧑  作者: Mango
private void onStarClicked(String uid, String key) {
Map updates = new HashMap<>();
updates.put("posts/"+key+"/stars/"+uid, true);
updates.put("posts/"+key+"/starCount", ServerValue.increment(1));
updates.put("user-posts/"+uid+"/"+key+"/stars/"+uid, true);
updates.put("user-posts/"+uid+"/"+key+"/starCount", ServerValue.increment(1));
mDatabase.child(child).updateChildren(updates);
}