最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

如何限制用户内容帖子

IT培训 admin 8浏览 0评论

如何限制用户内容帖子

我想对每个用户进行限制,每天只发布5次内容。

{
    _id: 5a3a67b102d9d926f8cd66b8
    groupname: 'Testing',
    member: [
        {userid:123},
        {userid:456},
        {userid:789},
        {userid:879}
    ]
}

实际上,我有一种方法,即

First create the column which may be named as entries_counter, after that every entry did successfully, we have to increment the counter till it 5. After 5 we will stop doing the entries. And every day at night or some time format we will update the entries_counter value to 0 through CronJob.

建议我一些最佳或预定义/预建的方法,这将有效地处理这些类型的情况。任何帮助都是赞赏的。

回答如下:

发布后,执行查询,计算用户在过去24小时内创建的帖子数。如果超过MAX_POSTS_ALLOWED,请不要允许。

在我看来,你不应该明确跟踪每天创建的帖子数量。或者您需要每天清除该列。

如何限制用户内容帖子

我想对每个用户进行限制,每天只发布5次内容。

{
    _id: 5a3a67b102d9d926f8cd66b8
    groupname: 'Testing',
    member: [
        {userid:123},
        {userid:456},
        {userid:789},
        {userid:879}
    ]
}

实际上,我有一种方法,即

First create the column which may be named as entries_counter, after that every entry did successfully, we have to increment the counter till it 5. After 5 we will stop doing the entries. And every day at night or some time format we will update the entries_counter value to 0 through CronJob.

建议我一些最佳或预定义/预建的方法,这将有效地处理这些类型的情况。任何帮助都是赞赏的。

回答如下:

发布后,执行查询,计算用户在过去24小时内创建的帖子数。如果超过MAX_POSTS_ALLOWED,请不要允许。

在我看来,你不应该明确跟踪每天创建的帖子数量。或者您需要每天清除该列。

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论