Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何限制firestore中的写入_Reactjs_Firebase_Redux_Google Cloud Firestore_Spam - Fatal编程技术网

Reactjs 如何限制firestore中的写入

Reactjs 如何限制firestore中的写入,reactjs,firebase,redux,google-cloud-firestore,spam,Reactjs,Firebase,Redux,Google Cloud Firestore,Spam,我想允许用户在上一篇文章的每3小时后发布一篇博客。我不希望我的每日免费计划被firestore中的垃圾邮件所抵消。我该怎么开始呢。我正在使用redux、react、firestore。目标是如何启动我的代码和逻辑您应该使用firestore规则来确保100%的安全。 Puf对你的问题有很好的答案 如果您允许写入特定用户,我建议使用firebase函数在users/writetimes/{userUid}下保存他创建最后一篇文章的时间,并在再次写入时检查用户最后一次时间戳是否超过3小时 大概是这样

我想允许用户在上一篇文章的每3小时后发布一篇博客。我不希望我的每日免费计划被firestore中的垃圾邮件所抵消。我该怎么开始呢。我正在使用redux、react、firestore。目标是如何启动我的代码和逻辑

您应该使用firestore规则来确保100%的安全。 Puf对你的问题有很好的答案

如果您允许写入特定用户,我建议使用firebase函数在
users/writetimes/{userUid}
下保存他创建最后一篇文章的时间,并在再次写入时检查用户最后一次
时间戳
是否超过3小时

大概是这样的:

match/users/{document=**}{
允许创建:如果是isCalm();
函数isCalm(){
return request.time>get(/databases/$(database)/documents/users/writetimes/$(request.auth.uid)).data.timestamp+duration.value(3,'h');
}
}

将博客存储到Firestore时,为什么不包括存储的日期和时间?然后,在存储博客时,首先检查用户是否有在过去3小时内发布的内容。。。如果没有,允许他们发布!