实现post的关闭和重新打开机制

xlpyo6sf  于 2021-06-25  发布在  Mysql
关注(0)|答案(0)|浏览(145)

我正试图实现这样一个关闭和重新打开的机制。
这是我目前的算法:我有这样一个表:

// close_posts
+----+---------+---------+
| id | post_id | user_id |
+----+---------+---------+

我还有一个专栏 posts 名为的表
closed (tinyint default 0) 插入后会增加 close_posts 表通过触发器。
我也有这样的情况:

if ( $post['closed'] >= 5 ){
    echo "the post is closed"
}

这决定了邮局是关闭的。
现在我想知道我如何也添加重开机制呢?
我需要另一张类似的table吗 open_posts 应该减少 closed 列(英寸 posts table)(在这种情况下 if -声明不再有效)
我需要修改吗 close-posts 表并添加一些列来指定关闭或重新打开投票的类型?
或者有更好的主意?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题