一些好像点评的系统,比如:文章下面,显示:好评/差评 这样的按钮
也就是像csdn论坛的文章页面的...
对我有用[0] 丢个板砖[0]
个人理解:
点一下经由ajax/jq这类发送去php操作mysql, 把好评/差评的字段+1
但是,一般这类的东,都是限制ip,甚至是只限cookie...
如果好评/差评的数据确有需要非常准确无水份
我是想用会员登入后才能点评(投票好差)的
那mysql 是否需要建议一个独立的点评表?
还有数据架构有什么比较好的方法,可以限制会员只能投一次?
请教一下各位,有什么好的建议?
------解决方案--------------------
建表是必须的,还不止一张
因为你还可能有 xx 关注了 xx、xx 是 xx 的好友等一系列的需求
需要综合考量
你现在思索的的是 sns 网站的核心(或称基础)
------解决方案--------------------
参考下:
投票信息表:
create table `votes` (
`id` int(11) not null auto_increment,
`ip` varchar(250) not null,
·uid· int(11) not null,
`vid` int(11) not null,
`fstcreate` timestamp not null default current_timestamp on update current_timestamp,
primary key (`id`)
) engine=myisam auto_increment=1 default charset=utf8
文章表
create table `article` (
`id` int(11) not null auto_increment,
`article_title` varchar(250) not null,
`article_type` int(11) not null,
`article_content` longtext not null,
`article_author` varchar(50) not null,
`article_click_count` int(11) not null default '0',
`status` int(11) not null default '0',
`likes` int(11) default '0',
`unlikes` int(11) default '0',
`fstcreate` timestamp not null default current_timestamp on update current_timestamp,
`lastmodify` datetime default null,
primary key (`id`),
fulltext key `fulltext_article_title` (`article_title`,`article_content`,`key_words`)
) engine=myisam auto_increment=119 default charset=utf8 checksum=1 delay_key_write=1 row_format=dynamic comment='文章表'
如果限定登陆用户才可以投票,这样只要控制用户id和投票的主题id即可。
------解决方案--------------------
同一篇評論同一個用戶只能投一次就可以了。
表結構可以這樣
id
aid 評論id
mid 用戶id
addtime 發佈時間
select count(*) from table where aid=? and mid=? 判斷是否=1 來確定用戶是否可以再投這個評論。
