评论系统设计
step1: 数据库表设计
| 表字段 |
数据库字段类型 |
字段说明 |
| id |
int(10) |
主键 |
| topic_id |
int(10) |
评论主题ID |
| topic_type |
int(10) |
主题类别 |
| from_uid |
int(10) |
评论用户ID |
| content |
text |
评论内容 |
| reply_count |
int(5) |
回复数 |
| support_count |
int(5) |
顶数 |
| oppose_count |
int(5) |
踩数 |
| create_time |
timestamp |
评论创建时间 |
| update_time |
timestamp |
评论状态修改时间 |
| status |
tinyint(1) |
评论状态,-1为删除,0为待审核,1为已发布 |
回复表 reply(二级评论表)
| 表字段 |
数据库字段类型 |
字段说明 |
| id |
int(10) |
主键 |
| comment_id |
int(10) |
评论ID |
| from_uid |
int(10) |
回复用户ID |
| content |
text |
回复内容 |
| support_count |
int(5) |
顶数 |
| oppose_count |
int(5) |
踩数 |
| reply_type |
tinyint(1) |
1为回复评论,2为回复别人的回复 |
| reply_id |
int(10) |
回复目标id,reply_type为1时,是comment_id,reply_type为2时为回复表的id |
| is_author |
tinyint(2) |
0为普通回复,1为后台管理员回复 |
| create_time |
timestamp |
回复创建时间 |
| update_time |
timestamp |
回复状态修改时间 |
| status |
tinyint(1) |
回复状态,-1为删除,0为待审核,1为已发布 |